public class SignatureAndHashAlgorithmList
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
SignatureAlgorithms
extension
as specified by RFC 5246.
Note that TLS 1.3 (RFC 8446) replaces SignatureAndHashAlgorithmList
by
. For compatibility
reasons iSaSiLk can be used with both SignatureAndHashAlgorithmList and
SignatureSchemeList.
SignatureSchemeList
A TLS client/server may use the SignatureSchme structure to
announce the signature/hash algorithms it is able to support to the peer.
The client, for instance, may send a SignatureAlgorithms
extension with the ClientHello extension list to tell the server which
SignatureAndHashAlgorithms the client can process to, e.g., verify the
server certificates or, e.g., sign the CertificateVerify message.
The server, for instance, will specify a list of expected SignatureAndHashAlgorithms
when sending the CertificateRequest message.
Modifier and Type | Field and Description |
---|---|
static int |
L_ALL
Selection constant for a list with all supported signature algorithms.
|
static int |
L_DEFAULT
Selection constant for a list with the default signature algorithms.
|
static SignatureScheme[] |
L_DSA
Deprecated.
by TLS 1.3
|
static SignatureScheme[] |
L_ECDSA
An array containing all ECDSA signature algorithms.
|
static SignatureScheme[] |
L_EDDSA
An array containing all EDDSA signature algorithms.
|
static int |
L_NONE
Selection constant for an empty list.
|
static SignatureScheme[] |
L_RSA
An array containing all RSA signature algorithms.
|
static SignatureScheme[] |
L_RSA_PKCS15
An array containing all RSA PKCS#1v1.5 signature algorithms.
|
static SignatureScheme[] |
L_RSA_PSS
An array containing all RSASSA-PSS signature algorithms
public key OID RSASSA-PSS.
|
static SignatureScheme[] |
L_RSA_PSS_PSS
An array containing all RSASSA-PSS PSS signature algorithms
public key OID RSASSA-PSS.
|
static SignatureScheme[] |
L_RSA_PSS_RSAE
An array containing all RSASSA-PSS RSAE signature algorithms
public key OID rsaEncryption.
|
Constructor and Description |
---|
SignatureAndHashAlgorithmList()
Creates an empty signature algorithm list.
|
SignatureAndHashAlgorithmList(int which)
Creates a new signature algorithm list with the contents determined by the selection
value.
|
SignatureAndHashAlgorithmList(SignatureAndHashAlgorithm algorithm)
Creates a new signature algorithm list with the specified algorithm as its only element.
|
SignatureAndHashAlgorithmList(SignatureAndHashAlgorithm[] algorithms)
Creates a new signature algorithm list from the contents of the given array.
|
SignatureAndHashAlgorithmList(SignatureAndHashAlgorithmList algorithms)
Creates a copy of the given signature algorithm list.
|
SignatureAndHashAlgorithmList(java.lang.String[] algorithms)
Create a new signature algorithm list from an array of signature algorithm
names.
|
Modifier and Type | Method and Description |
---|---|
void |
add(SignatureAndHashAlgorithm algorithm)
Adds a signature algorithm to the end of this list.
|
void |
add(SignatureAndHashAlgorithm[] algorithms)
Adds all signature algorithms from an array to this list in order.
|
void |
clear()
Removes all elements from this list.
|
java.lang.Object |
clone()
Returns a clone of this signature algorithm list.
|
java.lang.Object |
clone(int version)
Returns a clone of this signature algorithm list for the given
protocol version.
|
boolean |
contains(SignatureAndHashAlgorithm algorithm)
Checks if the given signature algorithm is an element of this list.
|
void |
ensureAvailable()
Make sure this list only contains signature algorithms that can actually be
used.
|
boolean |
equals(java.lang.Object obj)
Checks if this signature algorithm list object is equal to the given object.
|
SignatureAndHashAlgorithm |
get(int i)
Returns the element at the given index.
|
static SignatureAndHashAlgorithmList |
getAll()
Gets a list containing all supported signature algorithms.
|
static SignatureAndHashAlgorithmList |
getDefault()
Gets a list containing the signature algorithms /schemes supported by default.
|
int |
hashCode()
Gets a hash code of this object.
|
void |
insertAt(int index,
SignatureAndHashAlgorithm algorithm)
Inserts the given algorithm at the given position i.
|
void |
intersectWith(SignatureAndHashAlgorithmList other)
Computes the intersection of this list and another list.
|
java.util.Iterator |
iterator()
Return an Iterator for the elements of this list.
|
void |
remove(SignatureAndHashAlgorithm algorithm)
Removes a signature algorithm from this list.
|
void |
remove(SignatureAndHashAlgorithm[] algorithms)
Removes all signature algorithms from an array from this list.
|
int |
size()
Returns the number of elements in this list.
|
SignatureAndHashAlgorithm[] |
toArray()
Converts this list to an array of signature algorithms.
|
java.lang.String |
toString()
Returns a string representation of this list.
|
public static final int L_NONE
public static final int L_DEFAULT
public static final int L_ALL
public static final SignatureScheme[] L_RSA_PKCS15
public static final SignatureScheme[] L_RSA_PSS_RSAE
public static final SignatureScheme[] L_RSA_PSS_PSS
public static final SignatureScheme[] L_RSA_PSS
public static final SignatureScheme[] L_RSA
public static final SignatureScheme[] L_DSA
public static final SignatureScheme[] L_ECDSA
public static final SignatureScheme[] L_EDDSA
public SignatureAndHashAlgorithmList()
public SignatureAndHashAlgorithmList(int which)
L_NONE (1)
creates an empty list
L_DEFAULT (2)
creates a list with the default signature algorithms.
L_ALL (3)
creates a list with all implemented signature algorithms.
Note that
is automatically called on the created list.ensureAvailable()
which
- the selection value deciding which type of list shall be
created (L_NONE, L_DEFAULT, or L_ALL)IllegalParameterException
- if the selection value is not one ofpublic SignatureAndHashAlgorithmList(SignatureAndHashAlgorithm algorithm)
algorithm
- the signature algorithmpublic SignatureAndHashAlgorithmList(SignatureAndHashAlgorithm[] algorithms)
algorithms
- the array of signature algorithmspublic SignatureAndHashAlgorithmList(SignatureAndHashAlgorithmList algorithms)
algorithms
- the algorithm list to be copiedpublic SignatureAndHashAlgorithmList(java.lang.String[] algorithms) throws java.lang.IllegalArgumentException
algorithms
- the signature algorithm namesjava.lang.IllegalArgumentException
- if the list of algorithm names refers a
signature algorithm that is not supportedpublic static final SignatureAndHashAlgorithmList getDefault()
SecurityProvider
):
ecdsa_secp256r1_sha256
(SHA256withECDSA
) (id:
0x0403)ed25519
(ED25519
) (id: 0x0807)rsa_pss_rsae_sha256
(SignatureAndHashAlgorithm.SHA256withRSAPSS_RSAE
) (id: 0x0804)rsa_pkcs1_sha256
(SHA256withRSA
) (id:
0x0401)ecdsa_secp384r1_sha384
(SHA384withECDSA
) (id:
0x0503)rsa_pss_rsae_sha384
(SignatureAndHashAlgorithm.SHA384withRSAPSS_RSAE
) (id: 0x0805)rsa_pkcs1_sha384
(SHA384withRSA
) (id:
0x0501)ecdsa_secp521r1_sha512
(SHA512withECDSA
) (id:
0x0603)rsa_pss_rsae_sha512
(SignatureAndHashAlgorithm.SHA512withRSAPSS_RSAE
) (id: 0x0806)rsa_pkcs1_sha512
(SHA512withRSA
) (id:
0x0601)rsa_pkcs1_sha1
(SHA1withRSA
) (id: 0x0201); legacyecdsa_sha1
(SHA1withECDSA
) (id: 0x0203); legacySecurityProvider
public static final SignatureAndHashAlgorithmList getAll()
SecurityProvider
):
ecdsa_secp256r1_sha256
(SHA256withECDSA
) (id:
0x0403)ed25519
(ED25519
) (id: 0x0807)rsa_pss_rsae_sha256
(SignatureAndHashAlgorithm.SHA256withRSAPSS_RSAE
) (id: 0x0804)rsa_pkcs1_sha256
(SHA256withRSA
) (id:
0x0401)ecdsa_secp384r1_sha384
(SHA384withECDSA
) (id:
0x0503)rsa_pss_rsae_sha384
(SignatureAndHashAlgorithm.SHA384withRSAPSS_RSAE
) (id: 0x0805)rsa_pkcs1_sha384
(SHA384withRSA
) (id:
0x0501)ecdsa_secp521r1_sha512
(SHA512withECDSA
) (id:
0x0603)rsa_pss_rsae_sha512
(SignatureAndHashAlgorithm.SHA512withRSAPSS_RSAE
) (id: 0x0806)rsa_pkcs1_sha512
(SHA512withRSA
) (id:
0x0601)ed448
(ED448
) (id: 0x0808)rsa_pss_pss_sha256
(SignatureAndHashAlgorithm.SHA256withRSAPSS_PSS
) (id: 0x0809)rsa_pss_pss_sha384
(SignatureAndHashAlgorithm.SHA384withRSAPSS_PSS
) (id: 0x080a)rsa_pss_pss_sha512
(SignatureAndHashAlgorithm.SHA512withRSAPSS_PSS
) (id: 0x080b)rsa_pkcs1_sha1
(SHA1withRSA
) (id: 0x0201), legacyecdsa_sha1
(SHA1withECDSA
) (id: 0x0203), legacyrsa_pkcs1_sha224
(SHA224withRSA
) (id:
0x0301); deprecated; not enabled for TLS 1.3ecdsa_sha224
(SHA224withECDSA
) (id:
0x0303); deprecated; not enabled for TLS 1.3dsa_sha256
(SHA256withDSA
) (id:
0x0402); deprecated; not enabled for TLS 1.3dsa_sha384
(SHA384withDSA
) (id:
0x0502); deprecated; not enabled for TLS 1.3dsa_sha512
(SHA512withDSA
) (id:
0x0602); deprecated; not enabled for TLS 1.3dsa_sha224
(SHA224withDSA
) (id:
0x0302); deprecated; not enabled for TLS 1.3dsa_sha1
(SHA1withDSA
) (id:
0x0202); deprecated; not enabled for TLS 1.3rsa_pkcs1_md5
(MD5withRSA
) (id:
0x0101); deprecated; not enabled for TLS 1.3SecurityProvider
public void add(SignatureAndHashAlgorithm algorithm)
algorithm
- the algorithm to be addedpublic void insertAt(int index, SignatureAndHashAlgorithm algorithm)
algorithm
- the algorithm to be addedpublic void remove(SignatureAndHashAlgorithm algorithm)
algorithm
- the algorithm to be removedpublic boolean contains(SignatureAndHashAlgorithm algorithm)
algorithm
- the algorithm to be checkedtrue
if the algorithm is included,
false
if it is not includedpublic void add(SignatureAndHashAlgorithm[] algorithms)
algorithms
- the signature algorithms to be addedpublic void remove(SignatureAndHashAlgorithm[] algorithms)
algorithms
- the algorithms to be removedpublic void clear()
public SignatureAndHashAlgorithm[] toArray()
public int size()
public SignatureAndHashAlgorithm get(int i) throws java.lang.IndexOutOfBoundsException
i
- the index of the requested elementjava.lang.IndexOutOfBoundsException
- if the indexpublic java.util.Iterator iterator()
public void ensureAvailable()
public void intersectWith(SignatureAndHashAlgorithmList other)
other
- the other listpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
Two signature algorithm lists are treated as equal if they contain the same signature algorithm objects (same number and same order).
equals
in class java.lang.Object
true
if this signature algorithm list object is equal to the
given list, false
if it is not equal to itpublic java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.Object clone(int version)
version
- the protocol versionpublic java.lang.String toString()
toString
in class java.lang.Object