![JAR search and dependency download from the Maven repository](/logo.png)
org.bouncycastle.bcpg.PublicKeyUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcpg-fips Show documentation
Show all versions of bcpg-fips Show documentation
The Bouncy Castle Java APIs for the OpenPGP Protocol. The APIs are designed primarily to be used in conjunction with the BC FIPS provider. The APIs may also be used with other providers although if being used in a FIPS context it is the responsibility of the user to ensure that any other providers used are FIPS certified and used appropriately.
package org.bouncycastle.bcpg;
/**
* Utility methods related to OpenPGP public key algorithms.
*/
public class PublicKeyUtils
{
/**
* Return true, if the public key algorithm that corresponds to the given ID is capable of signing.
*
* @param publicKeyAlgorithm public key algorithm id
* @return true if algorithm can sign
*/
public static boolean isSigningAlgorithm(int publicKeyAlgorithm)
{
switch (publicKeyAlgorithm)
{
case PublicKeyAlgorithmTags.RSA_GENERAL:
case PublicKeyAlgorithmTags.RSA_SIGN:
case PublicKeyAlgorithmTags.DSA:
case PublicKeyAlgorithmTags.ECDSA:
case PublicKeyAlgorithmTags.ELGAMAL_GENERAL:
case PublicKeyAlgorithmTags.EDDSA_LEGACY:
case PublicKeyAlgorithmTags.Ed25519:
case PublicKeyAlgorithmTags.Ed448:
return true;
default:
return false;
}
}
// /**
// * Return true, if the public key algorithm that corresponds to the given ID is capable of encryption.
// *
// * @param publicKeyAlgorithm public key algorithm id
// * @return true if algorithm can encrypt
// */
// public static boolean isEncryptionAlgorithm(int publicKeyAlgorithm)
// {
// switch (publicKeyAlgorithm)
// {
// case PublicKeyAlgorithmTags.RSA_GENERAL:
// case PublicKeyAlgorithmTags.RSA_ENCRYPT:
// case PublicKeyAlgorithmTags.ELGAMAL_ENCRYPT:
// case PublicKeyAlgorithmTags.ECDH:
// case PublicKeyAlgorithmTags.ELGAMAL_GENERAL:
// case PublicKeyAlgorithmTags.DIFFIE_HELLMAN:
// case PublicKeyAlgorithmTags.X25519:
// case PublicKeyAlgorithmTags.X448:
// return true;
// default:
// return false;
// }
// }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy