Example usage for org.bouncycastle.asn1.x509 X509ObjectIdentifiers ripemd160

List of usage examples for org.bouncycastle.asn1.x509 X509ObjectIdentifiers ripemd160

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.x509 X509ObjectIdentifiers ripemd160.

Prototype

ASN1ObjectIdentifier ripemd160

To view the source code for org.bouncycastle.asn1.x509 X509ObjectIdentifiers ripemd160.

Click Source Link

Document

ripemd160 OBJECT IDENTIFIER ::= {iso(1) identified-organization(3) TeleTrust(36) algorithm(3) hashAlgorithm(2) RIPEMD-160(1)}

OID: 1.3.36.3.2.1

Usage

From source file:test.unit.be.fedict.eid.applet.DerTest.java

License:Open Source License

@Test
public void digestInfoRipemd160() throws Exception {
    byte[] message = "hello world".getBytes();
    MessageDigest messageDigest = MessageDigest.getInstance("RIPEMD160", new BouncyCastleProvider());
    byte[] digest = messageDigest.digest(message);
    LOG.debug("Digest: " + new String(Hex.encodeHex(digest)));
    DERObjectIdentifier hashAlgoId = X509ObjectIdentifiers.ripemd160;
    DigestInfo digestInfo = new DigestInfo(new AlgorithmIdentifier(hashAlgoId, DERNull.INSTANCE), digest);
    byte[] encodedDigestInfo = digestInfo.getEncoded();
    LOG.debug("Digest Info: " + new String(Hex.encodeHex(encodedDigestInfo)));
}