Search in sources :

Example 1 with BCRainbowPublicKey

use of org.bouncycastle.pqc.jcajce.provider.rainbow.BCRainbowPublicKey in project smoke by textbrowser.

the class Cryptography method publicKeyAlgorithm.

public static String publicKeyAlgorithm(PublicKey publicKey) {
    if (publicKey == null)
        return "";
    try {
        ASN1ObjectIdentifier asn1ObjectIdentifier = null;
        SubjectPublicKeyInfo subjectPublicKeyInfo = SubjectPublicKeyInfo.getInstance(publicKey.getEncoded());
        asn1ObjectIdentifier = subjectPublicKeyInfo.getAlgorithm().getAlgorithm();
        if (asn1ObjectIdentifier.equals(PQCObjectIdentifiers.mcElieceCca2))
            return "McEliece-CCA2";
        else if (asn1ObjectIdentifier.equals(PQCObjectIdentifiers.mcElieceFujisaki))
            return "McEliece-Fujisaki";
        else if (asn1ObjectIdentifier.equals(PQCObjectIdentifiers.mcEliecePointcheval))
            return "McEliece-Pointcheval";
        else if (publicKey instanceof BCRainbowPublicKey)
            return "Rainbow";
        else if (publicKey instanceof BCSphincs256PublicKey)
            return "SPHINCS";
        else if (publicKey.getAlgorithm().equals("EC"))
            return "ECDSA";
        else
            return "RSA";
    } catch (Exception exception) {
    }
    return "";
}
Also used : BCSphincs256PublicKey(org.bouncycastle.pqc.jcajce.provider.sphincs.BCSphincs256PublicKey) BCRainbowPublicKey(org.bouncycastle.pqc.jcajce.provider.rainbow.BCRainbowPublicKey) SubjectPublicKeyInfo(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Aggregations

ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)1 SubjectPublicKeyInfo (org.bouncycastle.asn1.x509.SubjectPublicKeyInfo)1 BCRainbowPublicKey (org.bouncycastle.pqc.jcajce.provider.rainbow.BCRainbowPublicKey)1 BCSphincs256PublicKey (org.bouncycastle.pqc.jcajce.provider.sphincs.BCSphincs256PublicKey)1