public class PublicKeyUtils
extends java.lang.Object
| Constructor and Description |
|---|
PublicKeyUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isAlgorithmAllowedForKeyVersion(int publicKeyAlgorithm,
int keyVersion)
Return true, if RFC 9980 permits the public key algorithm in a key packet of the given version.
|
static boolean |
isEncryptionAlgorithm(int publicKeyAlgorithm)
Return true, if the public key algorithm that corresponds to the given ID is capable of encryption.
|
static boolean |
isMLDSACompositeAlgorithm(int publicKeyAlgorithm)
Return true, if the public key algorithm is one of the ML-DSA + EdDSA composite signature algorithms
of RFC 9980 sec. 5.
|
static boolean |
isMLKEMCompositeAlgorithm(int publicKeyAlgorithm)
Return true, if the public key algorithm is one of the ML-KEM + ECDH composite encryption algorithms
of RFC 9980 sec. 4.
|
static boolean |
isPQCAlgorithm(int publicKeyAlgorithm)
Return true, if the public key algorithm is one of the post-quantum (PQ) or post-quantum/traditional (PQ/T)
algorithms of RFC 9980: the ML-DSA + EdDSA and ML-KEM + ECDH composites and the SLH-DSA code points.
|
static boolean |
isSigningAlgorithm(int publicKeyAlgorithm)
Return true, if the public key algorithm that corresponds to the given ID is capable of signing.
|
static boolean |
isSLHDSAAlgorithm(int publicKeyAlgorithm)
Return true, if the public key algorithm is one of the SLH-DSA signature algorithms of RFC 9980 sec. 6.
|
static boolean |
isX25519Key(PublicKeyPacket publicKeyPacket)
Return true, if the passed in
PublicKeyPacket is based on X25519, either the legacy variant
via PublicKeyAlgorithmTags.ECDH over curve25519, or the modern
PublicKeyAlgorithmTags.X25519. |
public static boolean isSigningAlgorithm(int publicKeyAlgorithm)
publicKeyAlgorithm - public key algorithm idpublic static boolean isEncryptionAlgorithm(int publicKeyAlgorithm)
publicKeyAlgorithm - public key algorithm idpublic static boolean isPQCAlgorithm(int publicKeyAlgorithm)
publicKeyAlgorithm - public key algorithm idpublic static boolean isMLDSACompositeAlgorithm(int publicKeyAlgorithm)
publicKeyAlgorithm - public key algorithm idPublicKeyAlgorithmTags.MLDSA65_Ed25519 and PublicKeyAlgorithmTags.MLDSA87_Ed448public static boolean isSLHDSAAlgorithm(int publicKeyAlgorithm)
publicKeyAlgorithm - public key algorithm idPublicKeyAlgorithmTags.SLHDSA_SHAKE_128s, PublicKeyAlgorithmTags.SLHDSA_SHAKE_128f
and PublicKeyAlgorithmTags.SLHDSA_SHAKE_256spublic static boolean isMLKEMCompositeAlgorithm(int publicKeyAlgorithm)
publicKeyAlgorithm - public key algorithm idPublicKeyAlgorithmTags.MLKEM768_X25519 and PublicKeyAlgorithmTags.MLKEM1024_X448public static boolean isAlgorithmAllowedForKeyVersion(int publicKeyAlgorithm,
int keyVersion)
PublicKeyAlgorithmTags.MLKEM768_X25519, which is also allowed in v4 encryption-capable
subkeys (RFC 9980 sec. 3.5 and 4.3.2). The method has no opinion on algorithms outside RFC 9980 and
returns true for them.publicKeyAlgorithm - public key algorithm idkeyVersion - key packet versionpublic static boolean isX25519Key(PublicKeyPacket publicKeyPacket)
PublicKeyPacket is based on X25519, either the legacy variant
via PublicKeyAlgorithmTags.ECDH over curve25519, or the modern
PublicKeyAlgorithmTags.X25519.publicKeyPacket - public key packet