Example usage for org.bouncycastle.asn1.pkcs PKCSObjectIdentifiers md2

List of usage examples for org.bouncycastle.asn1.pkcs PKCSObjectIdentifiers md2

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.pkcs PKCSObjectIdentifiers md2.

Prototype

ASN1ObjectIdentifier md2

To view the source code for org.bouncycastle.asn1.pkcs PKCSObjectIdentifiers md2.

Click Source Link

Document

1.2.840.113549.2.2

Usage

From source file:TSAClient.java

License:Apache License

private ASN1ObjectIdentifier getHashObjectIdentifier(String algorithm) {
    if (algorithm.equals("MD2")) {
        return new ASN1ObjectIdentifier(PKCSObjectIdentifiers.md2.getId());
    } else if (algorithm.equals("MD5")) {
        return new ASN1ObjectIdentifier(PKCSObjectIdentifiers.md5.getId());
    } else if (algorithm.equals("SHA-1")) {
        return new ASN1ObjectIdentifier(OIWObjectIdentifiers.idSHA1.getId());
    } else if (algorithm.equals("SHA-224")) {
        return new ASN1ObjectIdentifier(NISTObjectIdentifiers.id_sha224.getId());
    } else if (algorithm.equals("SHA-256")) {
        return new ASN1ObjectIdentifier(NISTObjectIdentifiers.id_sha256.getId());
    } else if (algorithm.equals("SHA-384")) {
        return new ASN1ObjectIdentifier(NISTObjectIdentifiers.id_sha384.getId());
    } else if (algorithm.equals("SHA-512")) {
        return new ASN1ObjectIdentifier(NISTObjectIdentifiers.id_sha512.getId());
    } else {/*from  w  w w.  j a  v a  2  s. com*/
        return new ASN1ObjectIdentifier(algorithm);
    }
}

From source file:com.modemo.javase.signature.TSAClient.java

License:Apache License

private ASN1ObjectIdentifier getHashObjectIdentifier(String algorithm) {
    switch (algorithm) {
    case "MD2":
        return new ASN1ObjectIdentifier(PKCSObjectIdentifiers.md2.getId());
    case "MD5":
        return new ASN1ObjectIdentifier(PKCSObjectIdentifiers.md5.getId());
    case "SHA-1":
        return new ASN1ObjectIdentifier(OIWObjectIdentifiers.idSHA1.getId());
    case "SHA-224":
        return new ASN1ObjectIdentifier(NISTObjectIdentifiers.id_sha224.getId());
    case "SHA-256":
        return new ASN1ObjectIdentifier(NISTObjectIdentifiers.id_sha256.getId());
    case "SHA-384":
        return new ASN1ObjectIdentifier(NISTObjectIdentifiers.id_sha384.getId());
    case "SHA-512":
        return new ASN1ObjectIdentifier(NISTObjectIdentifiers.id_sha512.getId());
    default:/*from  w ww  .ja  va  2  s .c  om*/
        return new ASN1ObjectIdentifier(algorithm);
    }
}