Examples of HKDFParameters


Examples of org.bouncycastle.crypto.params.HKDFParameters

        {
            throw new IllegalArgumentException(
                "HKDF parameters required for HKDFBytesGenerator");
        }

        HKDFParameters params = (HKDFParameters)param;
        if (params.skipExtract())
        {
            // use IKM directly as PRK
            hMacHash.init(new KeyParameter(params.getIKM()));
        }
        else
        {
            hMacHash.init(extract(params.getSalt(), params.getIKM()));
        }

        info = params.getInfo();

        generatedBytes = 0;
        currentT = new byte[hashLen];
    }
View Full Code Here

Examples of org.bouncycastle.crypto.params.HKDFParameters

   */
  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.