public KemKey generateKey(
      String hmacAlgo,
      final byte[] hkdfSalt,
      final byte[] hkdfInfo,
      int keySizeInBytes,
      EllipticCurves.PointFormatType pointFormat)
      throws GeneralSecurityException {
    KeyPair ephemeralKeyPair = EllipticCurves.generateKeyPair(recipientPublicKey.getParams());
    ECPublicKey ephemeralPublicKey = (ECPublicKey) ephemeralKeyPair.getPublic();
    ECPrivateKey ephemeralPrivateKey = (ECPrivateKey) ephemeralKeyPair.getPrivate();
    byte[] sharedSecret = EllipticCurves.computeSharedSecret(
        ephemeralPrivateKey, recipientPublicKey);
    byte[] kemBytes =
        EllipticCurves.pointEncode(
            ephemeralPublicKey.getParams().getCurve(), pointFormat, ephemeralPublicKey.getW());
    byte[] symmetricKey =
        Hkdf.computeEciesHkdfSymmetricKey(
            kemBytes, sharedSecret, hmacAlgo, hkdfSalt, hkdfInfo, keySizeInBytes);
    return new KemKey(kemBytes, symmetricKey);
  }
A container for key parts generated by the KEM.
java_src/src/main/java/com/google/crypto/tink/subtle/EciesHkdfSenderKem.java