Search in sources :

Example 11 with Certificate

use of com.intel.mtwilson.datatypes.Certificate in project OpenAttestation by OpenAttestation.

the class CertificateResultMapper method map.

@Override
public Certificate map(int i, ResultSet rs, StatementContext sc) throws SQLException {
    //        UUID uuid = UUID.valueOf(rs.getBytes("uuid")); // use this when uuid is a binary type in database
    byte[] content = rs.getBytes("certificate");
    Sha1Digest sha1 = Sha1Digest.valueOfHex(rs.getString("sha1"));
    Sha256Digest sha256 = Sha256Digest.valueOfHex(rs.getString("sha256"));
    //        Sha1Digest pcrEvent = Sha1Digest.valueOfHex(rs.getString("pcrEvent"));
    Certificate certificate = new Certificate();
    certificate.setId(UUID.valueOf(rs.getString("id")));
    certificate.setCertificate(content);
    certificate.setSha1(sha1);
    certificate.setSha256(sha256);
    //        certificate.setPcrEvent(pcrEvent);
    certificate.setSubject(rs.getString("subject"));
    certificate.setIssuer(rs.getString("issuer"));
    certificate.setNotBefore(rs.getTimestamp("notBefore"));
    certificate.setNotAfter(rs.getTimestamp("notAfter"));
    certificate.setRevoked(rs.getBoolean("revoked"));
    return certificate;
}
Also used : Sha1Digest(com.intel.mtwilson.util.crypto.Sha1Digest) Sha256Digest(com.intel.mtwilson.util.crypto.Sha256Digest) Certificate(com.intel.mtwilson.datatypes.Certificate)

Aggregations

Certificate (com.intel.mtwilson.datatypes.Certificate)11 X509AttributeCertificate (com.intel.mtwilson.datatypes.X509AttributeCertificate)8 RepositoryException (com.intel.mtwilson.tag.repository.RepositoryException)8 CertificateDAO (com.intel.mtwilson.tag.dao.jdbi.CertificateDAO)6 RepositoryCreateConflictException (com.intel.mtwilson.tag.repository.RepositoryCreateConflictException)6 RepositoryCreateException (com.intel.mtwilson.tag.repository.RepositoryCreateException)6 RepositoryDeleteException (com.intel.mtwilson.tag.repository.RepositoryDeleteException)6 RepositoryRetrieveException (com.intel.mtwilson.tag.repository.RepositoryRetrieveException)6 RepositorySearchException (com.intel.mtwilson.tag.repository.RepositorySearchException)6 RepositoryStoreConflictException (com.intel.mtwilson.tag.repository.RepositoryStoreConflictException)6 RepositoryStoreException (com.intel.mtwilson.tag.repository.RepositoryStoreException)6 CertificateLocator (com.intel.mtwilson.datatypes.CertificateLocator)5 CertificateCollection (com.intel.mtwilson.datatypes.CertificateCollection)3 RepositoryInvalidInputException (com.intel.mtwilson.tag.repository.RepositoryInvalidInputException)2 UUID (com.intel.mtwilson.util.io.UUID)2 ApiClient (com.intel.mtwilson.ApiClient)1 AssetTagCertBO (com.intel.mtwilson.as.business.AssetTagCertBO)1 CryptographyException (com.intel.mtwilson.crypto.CryptographyException)1 AssetTagCertAssociateRequest (com.intel.mtwilson.datatypes.AssetTagCertAssociateRequest)1 AssetTagCertCreateRequest (com.intel.mtwilson.datatypes.AssetTagCertCreateRequest)1