public final class SignatureAndHashAlgorithm extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SignatureAndHashAlgorithm.HashAlgorithm
Hash algorithms as defined by
RFC 5246.
|
static class |
SignatureAndHashAlgorithm.SignatureAlgorithm
Signature algorithms as defined by
RFC 5246.
|
| Modifier and Type | Field and Description |
|---|---|
static List<SignatureAndHashAlgorithm> |
DEFAULT
Default list of supported signature and hash algorithms.
|
static SignatureAndHashAlgorithm |
INTRINSIC_WITH_ED25519
INTRINSIC_WITH_ED25519.
|
static SignatureAndHashAlgorithm |
INTRINSIC_WITH_ED448
INTRINSIC_WITH_ED448.
|
static SignatureAndHashAlgorithm |
SHA1_WITH_ECDSA
SHA1_with_Ecdsa.
|
static SignatureAndHashAlgorithm |
SHA256_WITH_ECDSA
SHA256_with_Ecdsa.
|
static SignatureAndHashAlgorithm |
SHA256_WITH_RSA
SHA256_with_Rsa.
|
static SignatureAndHashAlgorithm |
SHA384_WITH_ECDSA
SHA384_with_Ecdsa.
|
| Constructor and Description |
|---|
SignatureAndHashAlgorithm(int hashAlgorithmCode,
int signatureAlgorithmCode)
Creates an instance for corresponding algorithm codes.
|
SignatureAndHashAlgorithm(SignatureAndHashAlgorithm.HashAlgorithm hashAlgorithm,
SignatureAndHashAlgorithm.SignatureAlgorithm signatureAlgorithm)
Creates an instance for a hash and signature algorithm.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
static List<SignatureAndHashAlgorithm> |
getCommonSignatureAlgorithms(List<SignatureAndHashAlgorithm> proposedSignatureAndHashAlgorithms,
List<SignatureAndHashAlgorithm> supportedSignatureAndHashAlgorithms)
Get the common signature and hash algorithms in the order of the proposed
list.
|
static List<SignatureAndHashAlgorithm> |
getDefaultSignatureAlgorithms(List<X509Certificate> certificateChain)
Get list of default signature and hash algorithms including the
algorithms used by the certificate chain.
|
static List<SignatureAndHashAlgorithm> |
getDefaultSignatureAlgorithms(PublicKey publicKey)
Get list of default signature and hash algorithms including the
algorithms usable by the public key.
|
static List<SignatureAndHashAlgorithm> |
getEcdsaCompatibleSignatureAlgorithms(List<SignatureAndHashAlgorithm> signatureAndHashAlgorithms)
Get ECDSA compatible signature and hash algorithms.
|
SignatureAndHashAlgorithm.HashAlgorithm |
getHash()
Gets the hash algorithm in use.
|
String |
getJcaName()
Gets the
JCA standard name corresponding to this combination of hash and signature algorithm.
|
SignatureAndHashAlgorithm.SignatureAlgorithm |
getSignature()
Gets the signature algorithm in use.
|
static SignatureAndHashAlgorithm |
getSupportedSignatureAlgorithm(List<SignatureAndHashAlgorithm> supportedSignatureAlgorithms,
PublicKey key)
Gets a signature and hash algorithm that is compatible with a given
public key.
|
ThreadLocalSignature |
getThreadLocalSignature()
Get thread local signature for this signature and hash algorithm.
|
static ThreadLocalSignature |
getThreadLocalSignature(String algorithm)
Get thread local signature.
|
int |
hashCode() |
static boolean |
isSignedWithSupportedAlgorithms(List<SignatureAndHashAlgorithm> supportedSignatureAlgorithms,
List<X509Certificate> certificateChain)
Checks if all of a given certificates in the chain have been signed using
a algorithm supported by the server.
|
boolean |
isSupported()
Check, if signature and hash algorithm is supported by JRE.
|
String |
jcaName()
Deprecated.
use
getJcaName(). |
String |
toString()
Returns literal name, if signature or hash algortihm is unknown.
|
static SignatureAndHashAlgorithm |
valueOf(String jcaName)
Get signature and hash algorithm from JCA name.
|
public static SignatureAndHashAlgorithm SHA1_WITH_ECDSA
public static SignatureAndHashAlgorithm SHA256_WITH_ECDSA
public static SignatureAndHashAlgorithm SHA384_WITH_ECDSA
public static SignatureAndHashAlgorithm SHA256_WITH_RSA
public static SignatureAndHashAlgorithm INTRINSIC_WITH_ED25519
public static SignatureAndHashAlgorithm INTRINSIC_WITH_ED448
public static List<SignatureAndHashAlgorithm> DEFAULT
public SignatureAndHashAlgorithm(SignatureAndHashAlgorithm.HashAlgorithm hashAlgorithm, SignatureAndHashAlgorithm.SignatureAlgorithm signatureAlgorithm)
hashAlgorithm - The hash algorithm.signatureAlgorithm - The signature algorithm.NullPointerException - if one of the provided arguments was
nullpublic SignatureAndHashAlgorithm(int hashAlgorithmCode,
int signatureAlgorithmCode)
hashAlgorithmCode - the hash algorithm's code.signatureAlgorithmCode - the signature algorithm's code.public static ThreadLocalSignature getThreadLocalSignature(String algorithm)
algorithm - name of signature algorithmpublic static SignatureAndHashAlgorithm valueOf(String jcaName)
jcaName - name of signature and hash algorithm. e.g.
"SHA256withECDSA".null, if signature or
hash is unknown.public static List<SignatureAndHashAlgorithm> getDefaultSignatureAlgorithms(List<X509Certificate> certificateChain)
certificateChain - certificate chain. May be null.public static List<SignatureAndHashAlgorithm> getDefaultSignatureAlgorithms(PublicKey publicKey)
publicKey - publicKey. May be null.public static List<SignatureAndHashAlgorithm> getCommonSignatureAlgorithms(List<SignatureAndHashAlgorithm> proposedSignatureAndHashAlgorithms, List<SignatureAndHashAlgorithm> supportedSignatureAndHashAlgorithms)
proposedSignatureAndHashAlgorithms - proposed signature and hash
algorithms, orderedsupportedSignatureAndHashAlgorithms - supported signature and hash
algorithmspublic static SignatureAndHashAlgorithm getSupportedSignatureAlgorithm(List<SignatureAndHashAlgorithm> supportedSignatureAlgorithms, PublicKey key)
supportedSignatureAlgorithms - list of supported signature and hash
algorithms.key - public keynull, if the public key is not compatible
with any of the supported signature and hash algorithms.NullPointerException - if any parameter is null.public static List<SignatureAndHashAlgorithm> getEcdsaCompatibleSignatureAlgorithms(List<SignatureAndHashAlgorithm> signatureAndHashAlgorithms)
signatureAndHashAlgorithms - list of signature and hash algorithmsSignatureAndHashAlgorithm.SignatureAlgorithm.isEcdsaCompatible()public static boolean isSignedWithSupportedAlgorithms(List<SignatureAndHashAlgorithm> supportedSignatureAlgorithms, List<X509Certificate> certificateChain)
supportedSignatureAlgorithms - list of supported signature and hash
algorithms.certificateChain - The certificate chain to test.true if all certificates have been signed using a
supported algorithm.public SignatureAndHashAlgorithm.SignatureAlgorithm getSignature()
public SignatureAndHashAlgorithm.HashAlgorithm getHash()
public String getJcaName()
The name returned by this method can be used to instantiate a java.security.Signature object like this:
Signature signature = Signature.newInstance(signatureAndHash.jcaName());
null, if name is not available/not known by this implementation.@Deprecated public String jcaName()
getJcaName().
The name returned by this method can be used to instantiate a java.security.Signature object like this:
Signature signature = Signature.newInstance(signatureAndHash.jcaName());
null, if name is not available/not known by this implementation.public boolean isSupported()
true, if supported by JRE, false, otherwise.public String toString()
public ThreadLocalSignature getThreadLocalSignature()
Copyright © 2023 Eclipse Foundation. All rights reserved.