Posts

Showing posts with the label Certificate

How to generate SSL Key, CSR and Self Signed Certificate using OpenSSL.

Image
I have already discussed how to generate SSL certificate using keytool over here . In this article, I am going to explain how can you achieved the same thing using OpenSSL tool. The three differnet files that I am going to generate i.e. : waheedtechblog.key waheedtechblog.csr waheedtechblog.crt Generate Private key : waheedtechblog.key openssl genrsa -des3 -out waheedtechblog.key 1024 Generate a Certificate Signing Request (CSR) Using above generated key file, We will now create the CSR file openssl req -new -key waheedtechblog.key -out waheedtechblog.csr Generate a Self-Signed SSL Certificate openssl x509 -req -days 365 -in waheedtechblog.csr -signkey waheedtechblog.key -out waheedtechblog.crt These file can be used to enable SSL in Apache Server. Sometime, we need to remove passphrase to run key in Apache Server, if you get such issue while enabling SSL in Apache Server then run following command to remove p...

How to read certificates using CertificateFactory class

In my previous blog , I have explained how can you create self signed certificate using bouncy castle API and how to import it into keystore. This tutorial will explain how to read existing certificate file using java.security.cert.CertificateFactory class. import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.security.KeyStore; import java.security.PublicKey; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; /**  * Reads the certificate and import into Java keystore.  *  * @author abdul  *  */ public class ReadCertificateFile {      /**      * @param args      * @throws Exception      */     public static void main(String[] args) throws Exception {         ReadCertificateFile readCertificateFile = new ReadCertificateFile();   ...