Class ChaCha20KeyGenerator

java.lang.Object
net.overburn.redfort.keygen.ChaCha20KeyGenerator
All Implemented Interfaces:
BasicKeyGenerator, SymmetricKeyGenerator

public class ChaCha20KeyGenerator extends Object implements SymmetricKeyGenerator
Derives a suitable key from a random seed. Uses ChaCha20 by default. Use only when there is an established protocol to exchange keys. For more info look:
See Also:
  • Constructor Details

    • ChaCha20KeyGenerator

      public ChaCha20KeyGenerator()
  • Method Details

    • generate

      public SecretKeySpec generate()
      Specified by:
      generate in interface SymmetricKeyGenerator
    • derive

      public byte[] derive(int keyLen)
      Description copied from interface: SymmetricKeyGenerator
      Derives a suitable key from a secret/password, salt, extra secret for keyed hashing. Additional info can be used to tag.
      Specified by:
      derive in interface SymmetricKeyGenerator
      Parameters:
      keyLen - length of key supplied scrambler. Take utmost care.
      Returns:
      key that can be wrapped and supplied to Scrambler
    • wrap

      public SecretKeySpec wrap(byte[] rawKey)
    • wrap

      public SecretKeySpec wrap(String rawKey)