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 "";
}
Aggregations