class Sodium::Kdf
 
  - Sodium::Kdf
 - Reference
 - Object
 
Overview
  Included Modules
- Sodium::Wipe
 
Defined in:
sodium/kdf.crConstant Summary
- 
        CONTEXT_SIZE = 
LibSodium.crypto_kdf_contextbytes - 
        KEY_SIZE = 
LibSodium.crypto_kdf_keybytes.to_i 
Constructors
- 
        .new(bytes : Bytes, erase = false)
        
          
DEPRECATED use .copy_key_from or .move_key_from
 - 
        .new(key : Crypto::Secret)
        
          
Use an existing KDF Crypto::Secret key.
 - 
        .new
        
          
DEPRECATED use .random
 
Class Method Summary
- 
        .copy_key_from(bytes : Bytes)
        
          
Use an existing KDF key.
 - 
        .move_key_from(bytes : Bytes)
        
          
Use an existing KDF key.
 - .random
 
Instance Method Summary
- 
        #derive(context, subkey_id, subkey_size) : SecureBuffer
        
          
Derive a consistent subkey based on
contextandsubkey_id. - 
        #derive_aead_xchacha20poly1305_ietf(context, subkey_id) : Cipher::Aead::XChaCha20Poly1305Ietf
        
          
Convenience method to create a new CryptoBox::Aead::XChaCha20Poly1305Ietf without handling the key.
 - 
        #derive_cryptobox(context, subkey_id) : CryptoBox::SecretKey
        
          
Convenience method to create a new CryptoBox::Secret without handling the key.
 - 
        #derive_secretbox(context, subkey_id) : SecretBox
        
          
Convenience method to create a new SecretBox without handling the key.
 - 
        #derive_sign(context, subkey_id) : Sign::SecretKey
        
          
Convenience method to create a new Sign::Secret without handling the key.
 - #key : Crypto::Secret
 - 
        #to_slice : Bytes
        
          
Returns key
DEPRECATED Use .key instead
 
Constructor Detail
Class Method Detail
Use an existing KDF key.
- Copies key to a new SecureBuffer
 - Erases bytes after copying
 
Instance Method Detail
Derive a consistent subkey based on context and subkey_id.
context and subkey don't need to be secret
- context must be 8 bytes
 - subkey_size must be 16..64 bytes as of libsodium 1.0.17
 
Returns a SecureBuffer. May transfer ownership to SecretBox or SecretKey without copying.
Convenience method to create a new CryptoBox::Aead::XChaCha20Poly1305Ietf without handling the key.
See derive() for further information on context and subkey_id.
Convenience method to create a new CryptoBox::Secret without handling the key.
See derive() for further information on context and subkey_id.
Convenience method to create a new SecretBox without handling the key.
See derive() for further information on context and subkey_id.
Convenience method to create a new Sign::Secret without handling the key.
See derive() for further information on context and subkey_id.