protected static byte[] hkdfExpand(byte[] ikm,byte[] salt,byte[] info,int length) throws InvalidKeyException, NoSuchAlgorithmException {
  HKDFBytesGenerator hkdf=new HKDFBytesGenerator(new SHA256Digest());
  hkdf.init(new HKDFParameters(ikm,salt,info));
  byte[] okm=new byte[length];
  hkdf.generateBytes(okm,0,length);
  return okm;
}

protected static byte [ ] hkdfExpand ( byte [ ] ikm , byte [ ] salt , byte [ ] info , int length ) throws InvalidKeyException , NoSuchAlgorithmException { HKDFBytesGenerator hkdf = new HKDFBytesGenerator ( new SHA256Digest ( ) ) ; hkdf . init ( new HKDFParameters ( ikm , salt , info ) ) ; byte [ ] okm = new byte [ length ] ; hkdf . generateBytes ( okm , 0 , length ) ; return okm ; }
convenience method for computing the hmac key derivation function . the real work is offloaded to bouncycastle .
