Example usage for org.bouncycastle.jcajce.provider.asymmetric.dsa DSAUtil isDsaOid

List of usage examples for org.bouncycastle.jcajce.provider.asymmetric.dsa DSAUtil isDsaOid

Introduction

In this page you can find the example usage for org.bouncycastle.jcajce.provider.asymmetric.dsa DSAUtil isDsaOid.

Prototype

public static boolean isDsaOid(ASN1ObjectIdentifier algOid) 

Source Link

Document

Return true if the passed in OID could be associated with a DSA key.

Usage

From source file:org.xwiki.crypto.internal.asymmetric.keyfactory.DefaultKeyFactory.java

License:Open Source License

private String getKeyFactoryHint(ASN1Object keyInfo) {
    ASN1ObjectIdentifier algId = getAlgorithmId(keyInfo);

    String hint = null;/*  ww  w. j  ava2s .c  om*/

    if (RSAUtil.isRsaOid(algId)) {
        hint = "RSA";
    } else if (DSAUtil.isDsaOid(algId)) {
        hint = "DSA";
    } else if (algId.equals(PKCSObjectIdentifiers.dhKeyAgreement)
            || algId.equals(X9ObjectIdentifiers.dhpublicnumber)) {
        hint = "DH";
    } else if (algId.equals(OIWObjectIdentifiers.elGamalAlgorithm)) {
        hint = "ElGamal";
    } else if (algId.equals(CryptoProObjectIdentifiers.gostR3410_94)) {
        hint = "GOST3410";
    }

    if (hint == null) {
        throw new UnsupportedOperationException("Asymmetric key algorithm not supported: " + algId.getId());
    }

    return hint;
}