We have implemented the Diffie-Hellman key exchange algorithm:
KeyAgreement aKeyAgree = KeyAgreement.getInstance("DH");
keyAgreement.init(myPrivateKey);
keyAgreement.doPhase(otherPublicKey)
Now we need to generate a secret for AES encryption. There is a method generateSecret(String algorithm). I think I should call this an argument 'AES'.
But for DH, I use 512-bit public keys, so the secret must also be 512-bit long. But AES allows the use of 256-bit keys at maximum. A simple generateSecret()parameterless method returns a 512-bit DH secret. But what does generateSecret(String)? How does it convert a 512-bit secret to a 256/128-bit AES key?
source
share