Example usage for java.security.cert X509CRLEntry getCertificateIssuer

List of usage examples for java.security.cert X509CRLEntry getCertificateIssuer

Introduction

In this page you can find the example usage for java.security.cert X509CRLEntry getCertificateIssuer.

Prototype

public X500Principal getCertificateIssuer() 

Source Link

Document

Get the issuer of the X509Certificate described by this entry.

Usage

From source file:be.fedict.trust.service.dao.bean.CertificateAuthorityDAOBean.java

public void updateRevokedCertificates(Set<X509CRLEntry> revokedCertificates, BigInteger crlNumber,
        X500Principal crlIssuer, Map<String, RevokedCertificateEntity> revokedCertificatesMap) {
    LOG.debug("Update " + revokedCertificates.size() + " revoked certificates (crlNumber=" + crlNumber + ")");
    for (X509CRLEntry revokedCertificate : revokedCertificates) {
        X500Principal certificateIssuer = revokedCertificate.getCertificateIssuer();
        String issuerName;//from  w ww.  ja  v a 2 s. com
        if (null == certificateIssuer) {
            issuerName = crlIssuer.toString();
        } else {
            issuerName = certificateIssuer.toString();
        }
        BigInteger serialNumber = revokedCertificate.getSerialNumber();
        Date revocationDate = revokedCertificate.getRevocationDate();

        // lookup
        RevokedCertificateEntity revokedCertificateEntity = revokedCertificatesMap.get(serialNumber.toString());

        if (null != revokedCertificateEntity) {
            // already exists, update revocationDate and crl number
            revokedCertificateEntity.setRevocationDate(revocationDate);
            revokedCertificateEntity.setCrlNumber(crlNumber);
        } else {
            // don't exist yet, add
            this.entityManager
                    .persist(new RevokedCertificateEntity(issuerName, serialNumber, revocationDate, crlNumber));
        }
    }
}

From source file:be.fedict.trust.service.dao.bean.CertificateAuthorityDAOBean.java

@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void updateRevokedCertificates(Set<X509CRLEntry> revokedCertificates, BigInteger crlNumber,
        X500Principal crlIssuer) {
    LOG.debug("Update " + revokedCertificates.size() + " revoked certificates (crlNumber=" + crlNumber + ")");
    for (X509CRLEntry revokedCertificate : revokedCertificates) {
        X500Principal certificateIssuer = revokedCertificate.getCertificateIssuer();
        String issuerName;/*from   w  w w.j a  v  a  2  s . co  m*/
        if (null == certificateIssuer) {
            issuerName = crlIssuer.toString();
        } else {
            issuerName = certificateIssuer.toString();
        }
        BigInteger serialNumber = revokedCertificate.getSerialNumber();
        Date revocationDate = revokedCertificate.getRevocationDate();

        // lookup
        RevokedCertificateEntity revokedCertificateEntity = this.entityManager.find(
                RevokedCertificateEntity.class, new RevokedCertificatePK(issuerName, serialNumber.toString()));

        if (null != revokedCertificateEntity) {
            // already exists, update revocationDate and crl number
            revokedCertificateEntity.setRevocationDate(revocationDate);
            revokedCertificateEntity.setCrlNumber(crlNumber);
        } else {
            // don't exist yet, add
            this.entityManager
                    .persist(new RevokedCertificateEntity(issuerName, serialNumber, revocationDate, crlNumber));
        }
    }
}