public Key generateSecret() throws NoSuchAlgorithmException, InvalidKeyException {
KeyAgreement ka = KeyAgreement.getInstance("DH");
ka.init(keyPair.getPrivate());
ka.doPhase(publicKey, true);
return ka.generateSecret("DESede");
}
public EncryptionOptions getEncryptionOptions(Encryption enc) throws InvalidKeyException, NoSuchAlgorithmException {
EncryptionOptions options = enc.getDefaultEncryptionOptions();
options.setDataEncryptionKey(generateSecret());