Interface KeyDerivation.Lazy
- All Known Implementing Classes:
LazySodium,LazySodiumJava
- Enclosing interface:
- KeyDerivation
public static interface KeyDerivation.Lazy
-
Method Summary
Modifier and TypeMethodDescriptioncryptoKdfDeriveFromKey(int lengthOfSubKey, long subKeyId, String context, Key masterKey) Derive a subkey from a master key.Auto generates a master key and returns it in string format.
-
Method Details
-
cryptoKdfKeygen
Key cryptoKdfKeygen()Auto generates a master key and returns it in string format. The reason why this does not return a string via the normal 'masterKey.getBytes()' is because the resulting string is mangled.- Returns:
- A master Key.
-
cryptoKdfDeriveFromKey
Key cryptoKdfDeriveFromKey(int lengthOfSubKey, long subKeyId, String context, Key masterKey) throws SodiumException Derive a subkey from a master key.- Parameters:
lengthOfSubKey- The length of the subkey. Should be fromKeyDerivation.BYTES_MINtoKeyDerivation.BYTES_MAX.subKeyId- The ID of the subkey.context- The context of the subkey. Must beKeyDerivation.CONTEXT_BYTES.masterKey- The generated master key fromcryptoKdfKeygen().- Returns:
- A subkey that's gone through
Helpers.Lazy.sodiumBin2Hex(byte[]). - Throws:
SodiumException- If any of the lengths were not correct.
-