Package org.pgpainless.algorithm
Enum Class PublicKeyAlgorithm
- All Implemented Interfaces:
Serializable
,Comparable<PublicKeyAlgorithm>
,Constable
Enumeration of public key algorithms as defined in RFC4880.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDiffie-Hellman key exchange algorithm.Digital Signature Algorithm.Deprecated.Elliptic Curve Diffie-Hellman.Elliptic Curve Digital Signature Algorithm.Digital Signature Algorithm based on twisted Edwards Curves.ElGamal with usage encryption.Deprecated.see https://tools.ietf.org/html/rfc4880#section-13.8Deprecated.see https://tools.ietf.org/html/rfc4880#section-13.5RSA capable of encryption and signatures.Deprecated.see https://tools.ietf.org/html/rfc4880#section-13.5 -
Method Summary
Modifier and TypeMethodDescriptionstatic PublicKeyAlgorithm
fromId
(int id) Return thePublicKeyAlgorithm
that corresponds to the provided algorithm id.int
Return the numeric identifier of the public key algorithm.boolean
Return true if this public key algorithm can be used as an encryption algorithm.boolean
Return true if this public key algorithm is able to create signatures.static PublicKeyAlgorithm
requireFromId
(int id) Return thePublicKeyAlgorithm
that corresponds to the provided algorithm id.static PublicKeyAlgorithm
Returns the enum constant of this class with the specified name.static PublicKeyAlgorithm[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
RSA_GENERAL
RSA capable of encryption and signatures. -
RSA_ENCRYPT
Deprecated.see https://tools.ietf.org/html/rfc4880#section-13.5RSA with usage encryption. -
RSA_SIGN
Deprecated.see https://tools.ietf.org/html/rfc4880#section-13.5RSA with usage of creating signatures. -
ELGAMAL_ENCRYPT
ElGamal with usage encryption. -
DSA
Digital Signature Algorithm. -
EC
Deprecated.useECDH
instead.EC is deprecated. -
ECDH
Elliptic Curve Diffie-Hellman. -
ECDSA
Elliptic Curve Digital Signature Algorithm. -
ELGAMAL_GENERAL
Deprecated.see https://tools.ietf.org/html/rfc4880#section-13.8ElGamal General. -
DIFFIE_HELLMAN
Diffie-Hellman key exchange algorithm. -
EDDSA
Digital Signature Algorithm based on twisted Edwards Curves.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
fromId
Return thePublicKeyAlgorithm
that corresponds to the provided algorithm id. If an invalid id is provided, null is returned.- Parameters:
id
- numeric algorithm id- Returns:
- algorithm or null
-
requireFromId
Return thePublicKeyAlgorithm
that corresponds to the provided algorithm id. If an invalid id is provided, throw aNoSuchElementException
.- Parameters:
id
- numeric algorithm id- Returns:
- algorithm
- Throws:
NoSuchElementException
- in case of an unmatched algorithm id
-
getAlgorithmId
public int getAlgorithmId()Return the numeric identifier of the public key algorithm.- Returns:
- id
-
isSigningCapable
public boolean isSigningCapable()Return true if this public key algorithm is able to create signatures.- Returns:
- true if the algorithm can sign
-
isEncryptionCapable
public boolean isEncryptionCapable()Return true if this public key algorithm can be used as an encryption algorithm.- Returns:
- true if the algorithm can encrypt
-
ECDH
instead.