Example usage for org.bouncycastle.jcajce.provider.asymmetric.rsa RSAUtil isRsaOid

List of usage examples for org.bouncycastle.jcajce.provider.asymmetric.rsa RSAUtil isRsaOid

Introduction

In this page you can find the example usage for org.bouncycastle.jcajce.provider.asymmetric.rsa RSAUtil isRsaOid.

Prototype

public static boolean isRsaOid(ASN1ObjectIdentifier algOid) 

Source Link

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;//w ww . j a  v  a2s .  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;
}