| Modifier and Type | Class and Description |
|---|---|
| private static record |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static byte[] | Returns: the polished PreMasterSecret key in its "RAW" encoding formatthe version of the TLS protocol by which the
client wishes to communicate during this session clientVersion, int the negotiated version of the TLS protocol which
contains the lower of that suggested by the client in the client
hello and the highest supported by the server. serverVersion, SecureRandom random, byte[] the encoded key in its "RAW" encoding format encoded, boolean true if encoded is incorrect according to previous checks failure)Check the format of TLS PreMasterSecret. |
| public static void | |
| public static <T> T | |
| public static void | |
| public static String | getAlgorithm(Key key)
If the key is a sub-algorithm of a larger group of algorithms, this method will return that sub-algorithm. |
| public static String | Returns: AlgorithmID stored in the DER encoded bytes or null.DER encoded bytes encoded)With a given DER encoded bytes, read through and return the AlgorithmID stored if it can be found. |
| public static AlgorithmId | Returns: AlgorithmID stored in the DER encoded bytesDER encoded bytes encoded)With a given DER encoded bytes, read through and return the AlgorithmID stored if it can be found. |
| public static int | Returns: the key size of the given key object in bits, or -1 if the key size is not accessiblethe key object, cannot be null key)Returns the key size of the given key object in bits. |
| public static final int | Returns: the key size of the given cryptographic parameters in bits, or -1 if the key size is not accessiblethe cryptographic parameters, cannot be null parameters)Returns the key size of the given cryptographic parameters in bits. |
| public static ObjectIdentifier | Returns: the hash algorithmthe HSS/LMS public key publicKey)Finds the hash algorithm from an HSS/LMS public key. |
| public static final boolean | Returns: true if, and only if, the provider of the specifiedproviderName is Oracle providerthe provider name providerName)Returns whether the specified provider is Oracle provider or not. |
| public static boolean | |
| public static PublicKey | |
| public static PublicKey | |
| public static byte[] | |
| public static byte[] | |
| public static final void | |
| public static final void | |
| private static void | validateDHPublicKey(DHPublicKey publicKey)
Returns whether the Diffie-Hellman public key is valid or not. |
| private static void | |
| private static void | |
| public static byte[] |
| KeyUtil | back to summary |
|---|---|
| public KeyUtil() | |
| checkTlsPreMasterSecretKey | back to summary |
|---|---|
| public static byte[] checkTlsPreMasterSecretKey(int clientVersion, int serverVersion, SecureRandom random, byte[] encoded, boolean failure) Check the format of TLS PreMasterSecret. To avoid vulnerabilities described by section 7.4.7.1, RFC 5246, treating incorrectly formatted message blocks and/or mismatched version numbers in a manner indistinguishable from correctly formatted RSA blocks. RFC 5246 describes the approach as: 1. Generate a string R of 48 random bytes
2. Decrypt the message to recover the plaintext M
3. If the PKCS#1 padding is not correct, or the length of message
M is not exactly 48 bytes:
pre_master_secret = R
else If ClientHello.client_version <= TLS 1.0, and version
number check is explicitly disabled:
premaster secret = M
else If M[0..1] != ClientHello.client_version:
premaster secret = R
else:
premaster secret = M
Note that #2 should have completed before the call to this method.
| |
| clear | back to summary |
|---|---|
| public static void clear(Object... list) | |
| clear | back to summary |
|---|---|
| public static <T> T clear(byte[] encoding, Function<byte[], T> op) Executes | |
| destroySecretKeys | back to summary |
|---|---|
| public static void destroySecretKeys(SecretKey... keys) | |
| getAlgorithm | back to summary |
|---|---|
| public static String getAlgorithm(Key key) If the key is a sub-algorithm of a larger group of algorithms, this method will return that sub-algorithm. For example, key.getAlgorithm() returns "EdDSA", but the underlying key may be "Ed448". For DisabledAlgorithmConstraints (DAC), this distinction is important. "EdDSA" means all curves for DAC, but when using it with KeyPairGenerator, "EdDSA" means "Ed25519". | |
| getAlgorithm | back to summary |
|---|---|
| public static String getAlgorithm(byte[] encoded) throws IOException With a given DER encoded bytes, read through and return the AlgorithmID stored if it can be found. If none is found or there is an IOException, null is returned.
| |
| getAlgorithmId | back to summary |
|---|---|
| public static AlgorithmId getAlgorithmId(byte[] encoded) throws IOException With a given DER encoded bytes, read through and return the AlgorithmID stored if it can be found.
| |
| getKeySize | back to summary |
|---|---|
| public static int getKeySize(Key key) Returns the key size of the given key object in bits.
| |
| getKeySize | back to summary |
|---|---|
| public static final int getKeySize(AlgorithmParameters parameters) Returns the key size of the given cryptographic parameters in bits.
| |
| hashAlgFromHSS | back to summary |
|---|---|
| public static ObjectIdentifier hashAlgFromHSS(PublicKey publicKey) throws NoSuchAlgorithmException Finds the hash algorithm from an HSS/LMS public key.
| |
| isOracleJCEProvider | back to summary |
|---|---|
| public static final boolean isOracleJCEProvider(String providerName) Returns whether the specified provider is Oracle provider or not.
| |
| isSupportedKeyAgreementOutputAlgorithm | back to summary |
|---|---|
| public static boolean isSupportedKeyAgreementOutputAlgorithm(String alg) | |
| newRawPublicKey | back to summary |
|---|---|
| public static PublicKey newRawPublicKey(String algorithm, byte[] key) | |
| newRawPublicKey | back to summary |
|---|---|
| public static PublicKey newRawPublicKey(String algorithm, AlgorithmParameterSpec params, byte[] key) | |
| rawToX509 | back to summary |
|---|---|
| public static byte[] rawToX509(String pname, byte[] bytes) throws NoSuchAlgorithmException | |
| trimZeroes | back to summary |
|---|---|
| public static byte[] trimZeroes(byte[] b) Trim leading (most significant) zeroes from the result.
| |
| validate | back to summary |
|---|---|
| public static final void validate(Key key) throws InvalidKeyException Returns whether the key is valid or not. Note that this method is only apply to DHPublicKey at present.
| |
| validate | back to summary |
|---|---|
| public static final void validate(KeySpec keySpec) throws InvalidKeyException Returns whether the key spec is valid or not. Note that this method is only apply to DHPublicKeySpec at present.
| |
| validateDHPublicKey | back to summary |
|---|---|
| private static void validateDHPublicKey(DHPublicKey publicKey) throws InvalidKeyException Returns whether the Diffie-Hellman public key is valid or not. Per RFC 2631 and NIST SP800-56A, the following algorithm is used to validate Diffie-Hellman public keys: 1. Verify that y lies within the interval [2,p-1]. If it does not, the key is invalid. 2. Compute y^q mod p. If the result == 1, the key is valid. Otherwise, the key is invalid. | |
| validateDHPublicKey | back to summary |
|---|---|
| private static void validateDHPublicKey(DHPublicKeySpec publicKeySpec) throws InvalidKeyException | |
| validateDHPublicKey | back to summary |
|---|---|
| private static void validateDHPublicKey(BigInteger p, BigInteger g, BigInteger y) throws InvalidKeyException | |
| x509ToRaw | back to summary |
|---|---|
| public static byte[] x509ToRaw(byte[] bytes) throws IOException | |
| Modifier and Type | Field and Description |
|---|---|
| private final String | algorithm
Record Component accessed by algorithm(). |
| private final byte[] | |
| private final AlgorithmParameterSpec |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public byte[] | |
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public String | getAlgorithm()
Implements java. Returns the standard algorithm name for this key. |
| public byte[] | getEncoded()
Implements java. Returns the key in its primary encoding format, or |
| public String | getFormat()
Implements java. Returns the name of the primary encoding format of this key,
or |
| public AlgorithmParameterSpec | getParams()
Overrides default java. Returns the parameters associated with this key. |
| public final int | |
| public AlgorithmParameterSpec | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| algorithm | back to summary |
|---|---|
| private final String algorithm Record Component accessed by algorithm(). | |
| data | back to summary |
|---|---|
| private final byte[] data Record Component accessed by data(). | |
| params | back to summary |
|---|---|
| private final AlgorithmParameterSpec params Record Component accessed by params(). | |
| RawPublicKey | back to summary |
|---|---|
| pack-priv RawPublicKey(String algorithm, AlgorithmParameterSpec params, byte[] data) | |
| algorithm | back to summary |
|---|---|
| public String algorithm() Record Component getter of algorithm. | |
| data | back to summary |
|---|---|
| public byte[] data() Record Component getter of data. | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| getAlgorithm | back to summary |
|---|---|
| public String getAlgorithm() Implements java. Doc from java. Returns the standard algorithm name for this key. For example, "RSA" would indicate that this key is an RSA key. See the Key Algorithms section in the Java Security Standard Algorithm Names Specification for information about standard key algorithm names.
| |
| getEncoded | back to summary |
|---|---|
| public byte[] getEncoded() Implements java. Doc from java. Returns the key in its primary encoding format, or
| |
| getFormat | back to summary |
|---|---|
| public String getFormat() Implements java. Doc from java. Returns the name of the primary encoding format of this key,
or
| |
| getParams | back to summary |
|---|---|
| public AlgorithmParameterSpec getParams() Overrides default java. Doc from java. Returns the parameters associated with this key. The parameters are optional and may be either explicitly specified or implicitly created during key pair generation.
| |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| params | back to summary |
|---|---|
| public AlgorithmParameterSpec params() Record Component getter of params. | |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves. | |