Example usage for org.bouncycastle.bcpg HashAlgorithmTags MD2

List of usage examples for org.bouncycastle.bcpg HashAlgorithmTags MD2

Introduction

In this page you can find the example usage for org.bouncycastle.bcpg HashAlgorithmTags MD2.

Prototype

int MD2

To view the source code for org.bouncycastle.bcpg HashAlgorithmTags MD2.

Click Source Link

Usage

From source file:divconq.pgp.PGPUtil.java

License:Open Source License

public static String getDigestName(int hashAlgorithm) throws PGPException {
    switch (hashAlgorithm) {
    case HashAlgorithmTags.SHA1:
        return "SHA1";
    case HashAlgorithmTags.MD2:
        return "MD2";
    case HashAlgorithmTags.MD5:
        return "MD5";
    case HashAlgorithmTags.RIPEMD160:
        return "RIPEMD160";
    case HashAlgorithmTags.SHA256:
        return "SHA256";
    case HashAlgorithmTags.SHA384:
        return "SHA384";
    case HashAlgorithmTags.SHA512:
        return "SHA512";
    case HashAlgorithmTags.SHA224:
        return "SHA224";
    case HashAlgorithmTags.TIGER_192:
        return "TIGER";
    default://www.  j av  a2  s  .c om
        throw new PGPException("unknown hash algorithm tag in getDigestName: " + hashAlgorithm);
    }
}

From source file:org.m1theo.apt.repo.builder.RepoBuilder.java

License:Open Source License

private static int getDigestCode(String digestName) throws AptRepoException {
    if ("SHA1".equals(digestName)) {
        return HashAlgorithmTags.SHA1;
    } else if ("MD2".equals(digestName)) {
        return HashAlgorithmTags.MD2;
    } else if ("MD5".equals(digestName)) {
        return HashAlgorithmTags.MD5;
    } else if ("RIPEMD160".equals(digestName)) {
        return HashAlgorithmTags.RIPEMD160;
    } else if ("SHA256".equals(digestName)) {
        return HashAlgorithmTags.SHA256;
    } else if ("SHA384".equals(digestName)) {
        return HashAlgorithmTags.SHA384;
    } else if ("SHA512".equals(digestName)) {
        return HashAlgorithmTags.SHA512;
    } else if ("SHA224".equals(digestName)) {
        return HashAlgorithmTags.SHA224;
    } else {//from   w w w .  j  a  v a 2  s.  c om
        throw new AptRepoException("unknown hash algorithm tag in digestName: " + digestName);
    }
}