Code example for X509Certificate

Methods: getPublicKey

0
    private final Date expirationDate;
 
    X509Certificate getX509Certificate() { return x509Certificate; }
    public String getCommonName() { return commonName; }
    public Date getExpirationDate() { return expirationDate; }
    public PublicKey getPublicKey() { return x509Certificate.getPublicKey(); }
 
    Certificate(X509Certificate certificate) throws IOException {
        if (certificate != null) {
            this.x509Certificate = certificate;
            this.commonName = new X500Name(certificate.getSubjectDN().getName()).getCommonName();
            this.expirationDate = certificate.getNotAfter();
        } 
        else { 
            throw new IOException("Can not instantiate certificate object");
        } 
    } 
}