throw new NoSuchAlgorithmException("unknown algorithm encountered: " + algorithm);
}
int keySize = ((Integer)algorithms.get(algorithm)).intValue();
DHKDFParameters params = new DHKDFParameters(new DERObjectIdentifier(algorithm), keySize, secret);
byte[] keyBytes = new byte[keySize / 8];
kdf.init(params);
kdf.generateBytes(keyBytes, 0, keyBytes.length);
secret = keyBytes;