Package com.goterl.lazysodium.interfaces
Interface KeyDerivation.Lazy
-
- All Known Implementing Classes:
LazySodium,LazySodiumJava
- Enclosing interface:
- KeyDerivation
public static interface KeyDerivation.Lazy
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description KeycryptoKdfDeriveFromKey(int lengthOfSubKey, long subKeyId, java.lang.String context, Key masterKey)Derive a subkey from a master key.KeycryptoKdfKeygen()Auto generates a master key and returns it in string format.
-
-
-
Method Detail
-
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, java.lang.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.
-
-