forked from bcgit/bc-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into pg-synchronize-bc_csharp
# Conflicts: # pg/src/main/java/org/bouncycastle/bcpg/PublicKeyPacket.java # pg/src/main/java/org/bouncycastle/bcpg/SignaturePacket.java # pg/src/main/java/org/bouncycastle/bcpg/StreamUtil.java # pg/src/main/java/org/bouncycastle/openpgp/PGPSignatureGenerator.java
- Loading branch information
Showing
63 changed files
with
3,452 additions
and
566 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.bouncycastle.crypto.hpke; | ||
|
||
import org.bouncycastle.crypto.AsymmetricCipherKeyPair; | ||
import org.bouncycastle.crypto.params.AsymmetricKeyParameter; | ||
|
||
|
||
/** | ||
* base class for HPKE KEM | ||
*/ | ||
public abstract class KEM | ||
{ | ||
// Key Generation | ||
abstract AsymmetricCipherKeyPair GeneratePrivateKey(); | ||
abstract AsymmetricCipherKeyPair DeriveKeyPair(byte[] ikm); | ||
|
||
// Encapsulates a shared secret for a given public key and returns the encapsulated key and shared secret. | ||
abstract byte[][] Encap(AsymmetricKeyParameter recipientPublicKey); | ||
abstract byte[][] Encap(AsymmetricKeyParameter pkR, AsymmetricCipherKeyPair kpE); | ||
abstract byte[][] AuthEncap(AsymmetricKeyParameter pkR, AsymmetricCipherKeyPair kpS); | ||
|
||
// Decapsulates the given encapsulated key using the recipient's key pair and returns the shared secret. | ||
abstract byte[] Decap(byte[] encapsulatedKey, AsymmetricCipherKeyPair recipientKeyPair); | ||
abstract byte[] AuthDecap(byte[] enc, AsymmetricCipherKeyPair kpR, AsymmetricKeyParameter pkS); | ||
|
||
// Serialization | ||
abstract byte[] SerializePublicKey(AsymmetricKeyParameter publicKey); | ||
abstract byte[] SerializePrivateKey(AsymmetricKeyParameter key); | ||
|
||
// Deserialization | ||
abstract AsymmetricKeyParameter DeserializePublicKey(byte[] encodedPublicKey); | ||
abstract AsymmetricCipherKeyPair DeserializePrivateKey(byte[] skEncoded, byte[] pkEncoded); | ||
|
||
abstract int getEncryptionSize(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.