use of com.github.zhenwei.core.asn1.pkcs.PKCS12PBEParams in project LinLong-Java by zhenwei1108.
the class MacDataGenerator method build.
public MacData build(char[] password, byte[] data) throws PKCSException {
MacCalculator macCalculator;
try {
macCalculator = builder.build(password);
OutputStream out = macCalculator.getOutputStream();
out.write(data);
out.close();
} catch (Exception e) {
throw new PKCSException("unable to process data: " + e.getMessage(), e);
}
AlgorithmIdentifier algId = macCalculator.getAlgorithmIdentifier();
DigestInfo dInfo = new DigestInfo(builder.getDigestAlgorithmIdentifier(), macCalculator.getMac());
PKCS12PBEParams params = PKCS12PBEParams.getInstance(algId.getParameters());
return new MacData(dInfo, params.getIV(), params.getIterations().intValue());
}
Aggregations