Examples of HKDFBytesGenerator


Examples of org.bouncycastle.crypto.generators.HKDFBytesGenerator

   * @see <a href="http://tools.ietf.org/html/rfc5869">RFC 5869</a>
   */
  public static SaltedSecretKey createDerivedKey(byte[] inputKeyMaterial, byte[] inputSalt, String outputKeyAlgorithm, int outputKeySize)
      throws InvalidKeySpecException, NoSuchAlgorithmException, NoSuchProviderException {
   
    HKDFBytesGenerator hkdf = new HKDFBytesGenerator(KEY_DERIVATION_DIGEST);
    hkdf.init(new HKDFParameters(inputKeyMaterial, inputSalt, KEY_DERIVATION_INFO));

    byte[] derivedKey = new byte[outputKeySize / 8];
    hkdf.generateBytes(derivedKey, 0, derivedKey.length);

    return toSaltedSecretKey(derivedKey, inputSalt, outputKeyAlgorithm);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.