How to get AES secret key from DH secret key
问题 I have the following code that converts a DH secret key to AES secret key. This used to work until Oracle JRE 8u161 when they started restricting creation of DH keys < 1024 in java.security file. Now, I will get NoSuchAlgorithmException: Unsupported secret key algorithm AES at the last line. PrivateKey privKey = null; PublicKey pubKey = null; PublicKey agreement = null; KeyAgreement keyAgreement = KeyAgreement.getInstance("DH"); keyAgreement.init(privKey); keyAgreement.doPhase(pubKey, false);