Search in sources :

Example 1 with HKDFParameters

use of com.github.zhenwei.core.crypto.params.HKDFParameters in project LinLong-Java by zhenwei1108.

the class HKDFBytesGenerator method init.

public void init(DerivationParameters param) {
    if (!(param instanceof 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];
}
Also used : KeyParameter(com.github.zhenwei.core.crypto.params.KeyParameter) HKDFParameters(com.github.zhenwei.core.crypto.params.HKDFParameters)

Aggregations

HKDFParameters (com.github.zhenwei.core.crypto.params.HKDFParameters)1 KeyParameter (com.github.zhenwei.core.crypto.params.KeyParameter)1