Using Certificates in Java : Certificate « Security « Java Tutorial






import java.io.FileInputStream;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;

public class MainClass {

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

    CertificateFactory certFactory = CertificateFactory.getInstance("X.509");

    FileInputStream fis = new FileInputStream("a.dat");

    Certificate cert = certFactory.generateCertificate(fis);
    fis.close();

    System.out.println(cert);
  }
}








36.7.Certificate
36.7.1.Using Certificates in Java
36.7.2.KeyStore Example
36.7.3.Creating a Certificate in Java
36.7.4.Import certificate
36.7.5.Generate X.509 certificate
36.7.6.Store Certificate
36.7.7.Validate certificate
36.7.8.Exporting a Certificate to a File
36.7.9.Validating a Certification Path using the most-trusted CAs in the JDK's cacerts file.