![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-jdk14 Show documentation
Show all versions of bcpg-jdk14 Show documentation
The Bouncy Castle Java API for handling the OpenPGP protocol. This jar contains the OpenPGP API for JDK 1.4. The APIs can be used in conjunction with a JCE/JCA provider such as the one provided with the Bouncy Castle Cryptography APIs.
The newest version!
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