Search in sources :

Example 1 with Sha256Digest

use of com.intel.mtwilson.util.crypto.Sha256Digest 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)1 Sha1Digest (com.intel.mtwilson.util.crypto.Sha1Digest)1 Sha256Digest (com.intel.mtwilson.util.crypto.Sha256Digest)1