
An X.509 certificate is a digital certificate that uses the widely accepted international X.509 public key infrastructure standard to verify that a public key belongs to the user, computer or service identity contained within the certificate.
X.509 certificate object is supported in mostly popular languages such as Java, C#, VB, JavaScript...Today, this post will show you how to generate X509Certificate object from byte array in Java.
byte[] bytes; // byte array
try {
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
InputStream in = new ByteArrayInputStream(bytes);
X509Certificate cert = (X509Certificate)certFactory.generateCertificate(in);
} catch (Exception e) {
e.printStackTrace();
}
These objects above is imported by: import java.io.ByteArrayInputStream; import java.io.InputStream; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate;
No comments:
Post a Comment