public enum CipherSuite extends Enum<CipherSuite>
| Modifier and Type | Class and Description |
|---|---|
static class |
CipherSuite.CertificateKeyAlgorithm
Known certificate key algorithm.
|
static class |
CipherSuite.CipherType
Known cipher types.
|
static class |
CipherSuite.KeyExchangeAlgorithm
Known key exchange algorithm names.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
CIPHER_SUITE_BITS |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsCipherSuiteRequiringCertExchange(List<CipherSuite> cipherSuites)
Checks if a list of cipher suite contains a cipher suite that requires
the exchange of certificates.
|
static boolean |
containsEccBasedCipherSuite(List<CipherSuite> cipherSuites)
Checks if a list of cipher suite contains an ECC based cipher.
|
static boolean |
containsPskBasedCipherSuite(List<CipherSuite> cipherSuites)
Checks if a list of cipher suite contains an PSK based cipher.
|
static List<CipherSuite> |
getCertificateCipherSuites(boolean recommendedCipherSuitesOnly,
String keyAlgorithm)
Get a list of all supported cipher suites with the provided key
algorithm.
|
CipherSuite.CertificateKeyAlgorithm |
getCertificateKeyAlgorithm()
Gets the certificate key algorithm of the cipher suite.
|
static List<CipherSuite> |
getCipherSuitesByKeyExchangeAlgorithm(boolean recommendedCipherSuitesOnly,
boolean orderedByKeyExchangeAlgorithm,
List<CipherSuite.KeyExchangeAlgorithm> keyExchangeAlgorithms)
Get a list of all cipher suites using the provided key exchange
algorithms.
|
static List<CipherSuite> |
getCipherSuitesByKeyExchangeAlgorithm(boolean recommendedCipherSuitesOnly,
CipherSuite.KeyExchangeAlgorithm... keyExchangeAlgorithms)
Get a list of all cipher suites using the provided key exchange
algorithms.
|
CipherSuite.CipherType |
getCipherType()
Gets the type of cipher used for encrypting data.
|
int |
getCode()
Gets the 16-bit IANA assigned identification code of the cipher suite.
|
static List<CipherSuite> |
getEcdsaCipherSuites(boolean recommendedCipherSuitesOnly)
Get a list of all supported ECDSA cipher suites.
|
int |
getEncKeyLength()
Gets the length of the bulk cipher algorithm's encoding key.
|
int |
getFixedIvLength()
Gets the length of the fixed initialization vector (IV) of
the cipher suite's bulk cipher algorithm.
|
CipherSuite.KeyExchangeAlgorithm |
getKeyExchange()
Gets the key exchange algorithm the cipher suite employs to
generate a pre-master secret.
|
int |
getMacKeyLength()
Gets the key length of the cipher suite's MAC algorithm.
|
int |
getMacLength()
Gets the output length of the cipher suite's MAC algorithm.
|
int |
getMacMessageBlockLength()
Get the message block length of hash function.
|
int |
getMacMessageLengthBytes()
Get the number of bytes used to encode the message length for hmac
function.
|
String |
getMacName()
Gets the name of the cipher suite's MAC algorithm.
|
int |
getMaxCiphertextExpansion()
Get maximum expansion of cipher text using this cipher suite.
|
String |
getMessageDigestName()
Gets the name of the message digest (hash) function used by the cipher
suite MAC.
|
static int |
getOverallMaxCiphertextExpansion()
Get the overall maximum ciphertext expansion for all cipher suite.
|
String |
getPseudoRandomFunctionMacName()
Gets the pseudo-random function used by the cipher suite
to create (pseudo-)random data from a seed.
|
String |
getPseudoRandomFunctionMessageDigestName()
Gets the name of the pseudo-random message digest (hash) function used by
the cipher suite to create the hash over the handshake messages.
|
static List<CipherSuite> |
getPskCipherSuites(boolean recommendedCipherSuitesOnly,
boolean ecdhePsk)
|
int |
getRecordIvLength()
Gets the amount of data needed to be generated for the cipher's
initialization vector.
|
Cipher |
getThreadLocalCipher()
Gets the thread local cipher used by this cipher suite.
|
Mac |
getThreadLocalMac()
Gets the thread local MAC used by this cipher suite.
|
MessageDigest |
getThreadLocalMacMessageDigest()
Gets the thread local message digest used by this cipher suite.
|
Mac |
getThreadLocalPseudoRandomFunctionMac()
Gets the thread local MAC used by the pseudo random function of this
cipher suite.
|
MessageDigest |
getThreadLocalPseudoRandomFunctionMessageDigest()
Gets the thread local message digest used by the pseudo random function
of this cipher suite.
|
String |
getTransformation()
Gets the Java Cryptography Architecture transformation corresponding
to the suite's underlying cipher algorithm.
|
static CipherSuite |
getTypeByCode(int code)
Gets a cipher suite by its numeric code.
|
static CipherSuite |
getTypeByName(String name)
Gets a cipher suite by its (official) name.
|
static List<CipherSuite> |
getTypesByNames(String... names)
Gets a list of cipher suites by their (official) names.
|
boolean |
isEccBased()
Checks whether this cipher suite uses elliptic curve cryptography (ECC).
|
boolean |
isPskBased()
Checks whether this cipher suite use PSK key exchange.
|
boolean |
isRecommended()
Check whether this cipher suite is recommended.
|
boolean |
isSupported()
Checks whether this cipher suite is supported by the jvm implementation.
|
static List<CipherSuite> |
listFromByteArray(byte[] byteArray,
int numElements)
Deprecated.
|
static List<CipherSuite> |
listFromReader(org.eclipse.californium.elements.util.DatagramReader reader)
Decode cipher suite list from reader.
|
static byte[] |
listToByteArray(List<CipherSuite> cipherSuites)
Transform a list of cipher suites into the appropriate bit-format.
|
boolean |
requiresServerCertificateMessage()
Checks whether this cipher suite requires the server
to send a CERTIFICATE message during the handshake.
|
static CipherSuite |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static CipherSuite[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final CipherSuite TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256
public static final CipherSuite TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA378
public static final CipherSuite TLS_ECDHE_PSK_WITH_AES_128_CCM_8_SHA256
public static final CipherSuite TLS_ECDHE_PSK_WITH_AES_128_CCM_SHA256
public static final CipherSuite TLS_PSK_WITH_AES_128_GCM_SHA256
public static final CipherSuite TLS_PSK_WITH_AES_256_GCM_SHA378
public static final CipherSuite TLS_PSK_WITH_AES_128_CCM_8
public static final CipherSuite TLS_PSK_WITH_AES_256_CCM_8
public static final CipherSuite TLS_PSK_WITH_AES_128_CCM
public static final CipherSuite TLS_PSK_WITH_AES_256_CCM
public static final CipherSuite TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256
public static final CipherSuite TLS_PSK_WITH_AES_128_CBC_SHA256
public static final CipherSuite TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
public static final CipherSuite TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
public static final CipherSuite TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8
public static final CipherSuite TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8
public static final CipherSuite TLS_ECDHE_ECDSA_WITH_AES_128_CCM
public static final CipherSuite TLS_ECDHE_ECDSA_WITH_AES_256_CCM
public static final CipherSuite TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
public static final CipherSuite TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
public static final CipherSuite TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
public static final CipherSuite TLS_NULL_WITH_NULL_NULL
public static final int CIPHER_SUITE_BITS
public static CipherSuite[] values()
for (CipherSuite c : CipherSuite.values()) System.out.println(c);
public static CipherSuite valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic int getMaxCiphertextExpansion()
getMacLength(),
getRecordIvLength()public String getTransformation()
javax.crypto.Cipher object
(if a security provider is available in the JVM supporting the transformation).
See
Java Security Documentation.public Cipher getThreadLocalCipher()
null, if the cipher is not supported by
the java-vm.public int getCode()
public CipherSuite.CertificateKeyAlgorithm getCertificateKeyAlgorithm()
public CipherSuite.KeyExchangeAlgorithm getKeyExchange()
public boolean requiresServerCertificateMessage()
true if the message is requiredpublic boolean isPskBased()
true if PSK key exchange is usedpublic boolean isEccBased()
true if ECC is usedpublic boolean isSupported()
true if cipher suite is supportedpublic boolean isRecommended()
true if cipher suite is recommendedpublic String getMacName()
javax.crypto.Mac
instance.
See
Java Security Documentation.null for the NULL MACpublic String getMessageDigestName()
java.security.MessageDigest instance.
See
Java Security Documentation.null for the NULL MACpublic Mac getThreadLocalMac()
null, if not supported by vm.public MessageDigest getThreadLocalMacMessageDigest()
null, if not supported by vm.public int getMacLength()
public int getMacKeyLength()
public int getMacMessageBlockLength()
public int getMacMessageLengthBytes()
public int getRecordIvLength()
public int getFixedIvLength()
public String getPseudoRandomFunctionMacName()
javax.crypto.Mac
instance.
See
Java Security Documentation.public String getPseudoRandomFunctionMessageDigestName()
java.security.MessageDigest instance.
See
Java Security Documentation.public Mac getThreadLocalPseudoRandomFunctionMac()
null, if not supported by vm.public MessageDigest getThreadLocalPseudoRandomFunctionMessageDigest()
null, if not supported by vm.public CipherSuite.CipherType getCipherType()
public int getEncKeyLength()
public static int getOverallMaxCiphertextExpansion()
@Deprecated public static List<CipherSuite> getPskCipherSuites(boolean recommendedCipherSuitesOnly, boolean ecdhePsk)
recommendedCipherSuitesOnly - true use only recommended
cipher suitesecdhePsk - true include ECDHE_PSK cipher suitespublic static List<CipherSuite> getCipherSuitesByKeyExchangeAlgorithm(boolean recommendedCipherSuitesOnly, CipherSuite.KeyExchangeAlgorithm... keyExchangeAlgorithms)
recommendedCipherSuitesOnly - true use only recommended
cipher suiteskeyExchangeAlgorithms - list of key exchange algorithms to select
cipher suitesNullPointerException - if keyExchangeAlgorithms is nullIllegalArgumentException - if keyExchangeAlgorithms is emptypublic static List<CipherSuite> getCipherSuitesByKeyExchangeAlgorithm(boolean recommendedCipherSuitesOnly, boolean orderedByKeyExchangeAlgorithm, List<CipherSuite.KeyExchangeAlgorithm> keyExchangeAlgorithms)
recommendedCipherSuitesOnly - true use only recommended
cipher suitesorderedByKeyExchangeAlgorithm - true to order the cipher
suites by order of key exchange algorithms, false to
use the order by their definition above.keyExchangeAlgorithms - list of key exchange algorithms to select
cipher suitesNullPointerException - if keyExchangeAlgorithms is nullIllegalArgumentException - if keyExchangeAlgorithms is emptypublic static List<CipherSuite> getEcdsaCipherSuites(boolean recommendedCipherSuitesOnly)
recommendedCipherSuitesOnly - true use only recommended cipher suitespublic static List<CipherSuite> getCertificateCipherSuites(boolean recommendedCipherSuitesOnly, String keyAlgorithm)
recommendedCipherSuitesOnly - true use only recommended cipher suiteskeyAlgorithm - name of key algorithm. e.g. "EC"public static CipherSuite getTypeByCode(int code)
code - the cipher's
IANA assigned codenull if the code is unknownpublic static CipherSuite getTypeByName(String name)
name - the cipher's
IANA assigned namenull if the name is unknownpublic static List<CipherSuite> getTypesByNames(String... names)
names - the cipher's
IANA assigned namesIllegalArgumentException - if at least one name is not available.public static boolean containsPskBasedCipherSuite(List<CipherSuite> cipherSuites)
cipherSuites - The cipher suites to check.true, if the list contains an PSK based cipher suite,
false, otherwise.public static boolean containsEccBasedCipherSuite(List<CipherSuite> cipherSuites)
cipherSuites - The cipher suites to check.true, if the list contains an ECC based cipher suite,
false, otherwise.public static boolean containsCipherSuiteRequiringCertExchange(List<CipherSuite> cipherSuites)
cipherSuites - The cipher suites to check.true if any of the cipher suites requires the exchange of certificates,
false otherwise.public static byte[] listToByteArray(List<CipherSuite> cipherSuites)
cipherSuites - the cipher suites@Deprecated public static List<CipherSuite> listFromByteArray(byte[] byteArray, int numElements)
listFromReader(DatagramReader)byteArray - byte array with encoded cipher suitesnumElements - number of encoded cipher suitesIllegalArgumentException - if provided number of cipher suites
doesn't macht the provided byte arraypublic static List<CipherSuite> listFromReader(org.eclipse.californium.elements.util.DatagramReader reader)
reader - reader with encoded cipher suitesIllegalArgumentException - if a decode error occursCopyright © 2023 Eclipse Foundation. All rights reserved.