Class DHLegacyKDF
java.lang.Object
org.opensaml.xmlsec.derivation.impl.DHLegacyKDF
Implementation of the key derivation function used with Diffie-Hellman Key Agreement With Legacy Key Derivation
Function as defined in XML Encryption 1.1.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDerrive secret key from inouts.protected byte[]deriveBytes(byte[] secret, String encryptionAlgorithm, Integer keyLength) Derive the key bytes from the specified inputs.protected byte[]digest(int counter, String digestAlgorithm, byte[] secret, String encryptionAlgorithm, Integer keyLength, byte[] nonceBytes) Produce the digest of the specified inputs according to XML Encryption section 1.1, section 5.6.2.2.Get the digest method algorithm URI.getNonce()Get the Base64-encoded nonce value.voidsetDigestMethod(String newDigestMethod) Set the digest method algorithm URI.voidSet the digest method algorithm URI.
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logLogger. -
digestMethod
Digest method. -
nonce
Nonce.
-
-
Constructor Details
-
DHLegacyKDF
public DHLegacyKDF()
-
-
Method Details
-
getDigestMethod
Get the digest method algorithm URI.- Returns:
- the algorithm URI
-
setDigestMethod
Set the digest method algorithm URI.- Parameters:
newDigestMethod- the algorithm URI
-
getNonce
Get the Base64-encoded nonce value.- Returns:
- the nonce value
-
setNonce
Set the digest method algorithm URI.- Parameters:
newNonce- the algorithm URI
-
derive
@Nonnull public SecretKey derive(@Nonnull byte[] secret, @Nonnull String keyAlgorithm, @Nullable Integer keyLength) throws KeyDerivationException Derrive secret key from inouts.- Parameters:
secret- underlying secretkeyAlgorithm- key algorithmkeyLength- key length- Returns:
- derived key
- Throws:
KeyDerivationException- on failure
-
deriveBytes
protected byte[] deriveBytes(@Nonnull byte[] secret, @Nonnull String encryptionAlgorithm, @Nonnull Integer keyLength) throws KeyDerivationException Derive the key bytes from the specified inputs.- Parameters:
secret- the input secretencryptionAlgorithm- the encryption algorithm URI to be used with the derived keykeyLength- the key length- Returns:
- derived bytes the derived key bytes
- Throws:
KeyDerivationException- if any of the inputs are invalid
-
digest
protected byte[] digest(int counter, @Nonnull String digestAlgorithm, @Nonnull byte[] secret, @Nonnull String encryptionAlgorithm, @Nonnull Integer keyLength, @Nonnull byte[] nonceBytes) throws KeyDerivationException Produce the digest of the specified inputs according to XML Encryption section 1.1, section 5.6.2.2.- Parameters:
counter- the counter valuedigestAlgorithm- the JCA digest algorithmsecret- the input secretencryptionAlgorithm- the encryption algorithm URI to be used with the derived keykeyLength- the key lengthnonceBytes- the nonce, which may be an empty byte[] array, but not null- Returns:
- digest output for the specified inputs
- Throws:
KeyDerivationException- if any of the inputs are invalid
-