Monday, 11 May 2020

Security File Type Detection with Apache Tikka - OWASP

       
import java.io.IOException;

import java.io.InputStream;

import org.apache.tika.detect.DefaultDetector;

import org.apache.tika.detect.Detector;

import org.apache.tika.metadata.Metadata;

import org.apache.tika.mime.MediaType;



public class FileypeDetection {

 

 public static void main(String[] args) throws IOException {

   InputStream stream = FileypeDetection.class.getClassLoader()

         .getResourceAsStream("C:\\template.pdf");

  System.out.println(detectDocTypeUsingDetector(stream));

 }


 public static String detectDocTypeUsingDetector(InputStream stream)

     throws IOException {

       Detector detector = new DefaultDetector();

       Metadata metadata = new Metadata();

   

       MediaType mediaType = detector.detect(stream, metadata);

       return mediaType.toString();

   }



}









   

 

AWS Certificate Manager - Import Certificate

How to import a certificate. Use Key Store Explorer to open the cert and export keypair in PEM format  This will save a file cert.pem. Make ...