Interface KeyDerivation.Native
- All Known Implementing Classes:
LazySodium,LazySodiumJava
- Enclosing interface:
- KeyDerivation
public static interface KeyDerivation.Native
-
Method Summary
Modifier and TypeMethodDescriptionintcryptoKdfDeriveFromKey(byte[] subKey, int subKeyLen, long subKeyId, byte[] context, byte[] masterKey) Derive a subkey from a master key.voidcryptoKdfKeygen(byte[] masterKey) Creates a master key.
-
Method Details
-
cryptoKdfKeygen
void cryptoKdfKeygen(byte[] masterKey) Creates a master key.- Parameters:
masterKey- The byte array to populate. Should beKeyDerivation.MASTER_KEY_BYTES.
-
cryptoKdfDeriveFromKey
int cryptoKdfDeriveFromKey(byte[] subKey, int subKeyLen, long subKeyId, byte[] context, byte[] masterKey) Derive a subkey from a master key.- Parameters:
subKey- The subkey.subKeyLen- The length of the subkey. Should be fromKeyDerivation.BYTES_MINtoKeyDerivation.BYTES_MAX.subKeyId- ID of subkey.context- The context of the subkey. Must beKeyDerivation.CONTEXT_BYTES.masterKey- The generated master key fromcryptoKdfKeygen(byte[]). Must beKeyDerivation.MASTER_KEY_BYTES.- Returns:
- 0 on success, -1 otherwise.
-