Package io.deephaven.enterprise.auth
Class KeyAgreementKeyGenerator
java.lang.Object
io.deephaven.enterprise.auth.KeyAgreementKeyGenerator
A class that wraps a KeyAgreement object with some logic for generating keys of an appropriate length given for the
chosen algorithm parameters
-
Constructor Summary
ConstructorsConstructorDescriptionKeyAgreementKeyGenerator
(String agreeAlgorithm, String keyAlgorithm, String hashAlgorithm) -
Method Summary
Modifier and TypeMethodDescriptiongenerateKey
(int maximumKeyLength, PrivateKey pk, Key remoteKey) Generate a SecretKey from the underlying KeyAgreement, ensuring that the result key is no larger than the maximum key length, using the hashAlgorithm this object was created with if necessary.
-
Constructor Details
-
KeyAgreementKeyGenerator
public KeyAgreementKeyGenerator(String agreeAlgorithm, String keyAlgorithm, String hashAlgorithm) throws NoSuchAlgorithmException - Throws:
NoSuchAlgorithmException
-
-
Method Details
-
generateKey
public SecretKey generateKey(int maximumKeyLength, PrivateKey pk, Key remoteKey) throws NoSuchAlgorithmException, InvalidKeyException Generate a SecretKey from the underlying KeyAgreement, ensuring that the result key is no larger than the maximum key length, using the hashAlgorithm this object was created with if necessary.- Parameters:
maximumKeyLength
- The largest possible acceptable key length this method should generatepk
- The local private keyremoteKey
- The remote key to complete the agreement- Returns:
- A SecretKey no longer than maximumKeyLength
- Throws:
NoSuchAlgorithmException
InvalidKeyException
-