Class DecryptionOracleImplementation
java.lang.Object
net.finmath.decryptionoracle.decryption.DecryptionOracleImplementation
- All Implemented Interfaces:
DecryptionOracle
Implementation of a
DecryptionOracle using RSA.- Author:
- Christian Fries
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSpcifies the desired key format. -
Constructor Summary
ConstructorsConstructorDescriptionDecryptionOracleImplementation(PublicKey publicKey) Constructor for DecryptionOracleImplementation.DecryptionOracleImplementation(PublicKey publicKey, PrivateKey privateKey) Constructor for DecryptionOracleImplementation.DecryptionOracleImplementation(PublicPrivateEncryptionDecryption method, PublicKey publicKey, PrivateKey privateKey) Constructor for DecryptionOracleImplementation.DecryptionOracleImplementation(PublicPrivateEncryptionDecryption method, PublicKey publicKey, PrivateKey privateKey, UnaryOperator<byte[]> hashingMethod) Construct the DecryptionOracleImplementation.DecryptionOracleImplementation(PublicPrivateEncryptionDecryption method, PublicKey publicKey, PrivateKey privateKey, DecryptionOracleImplementation.KeyFormat keyFormat, UnaryOperator<byte[]> hashingMethod) Construct the DecryptionOracleImplementation. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]decrypt(byte[] encryptedKey) Decrypt an encrypted key E(K).byte[]decrypt(PrivateKey key, byte[] ciphertext) decrypt.byte[]encrypt.generateEncryptedHashedKey(String contract, byte[] transaction) Generate a key for a given contract and transaction.byte[]generateKey(String contract, byte[] transaction) Generate a key K for a given contract and transaction.verify(byte[] encryptedKey) From an encrypted key E(K) generated theKeyVerification.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.finmath.decryptionoracle.decryption.DecryptionOracle
decryptIfVerified
-
Constructor Details
-
DecryptionOracleImplementation
public DecryptionOracleImplementation(PublicPrivateEncryptionDecryption method, PublicKey publicKey, PrivateKey privateKey, DecryptionOracleImplementation.KeyFormat keyFormat, UnaryOperator<byte[]> hashingMethod) Construct the DecryptionOracleImplementation.- Parameters:
method- aPublicPrivateEncryptionDecryptionobjectpublicKey- aPublicKeyobjectprivateKey- aPrivateKeyobjectkeyFormat- the format of the generated key K (i.e. what the byte sequence represents: XML UTF-8 string, or hex string)hashingMethod- the hashing algorithm as aUnaryOperator
-
DecryptionOracleImplementation
public DecryptionOracleImplementation(PublicPrivateEncryptionDecryption method, PublicKey publicKey, PrivateKey privateKey, UnaryOperator<byte[]> hashingMethod) Construct the DecryptionOracleImplementation.- Parameters:
method- aPublicPrivateEncryptionDecryptionobjectpublicKey- aPublicKeyobjectprivateKey- aPrivateKeyobjecthashingMethod- aUnaryOperatorobject
-
DecryptionOracleImplementation
public DecryptionOracleImplementation(PublicPrivateEncryptionDecryption method, PublicKey publicKey, PrivateKey privateKey) Constructor for DecryptionOracleImplementation.
- Parameters:
method- aPublicPrivateEncryptionDecryptionobjectpublicKey- aPublicKeyobjectprivateKey- aPrivateKeyobject
-
DecryptionOracleImplementation
Constructor for DecryptionOracleImplementation.
- Parameters:
publicKey- aPublicKeyobjectprivateKey- aPrivateKeyobject
-
DecryptionOracleImplementation
Constructor for DecryptionOracleImplementation.
- Parameters:
publicKey- aPublicKeyobject
-
-
Method Details
-
decrypt
public byte[] decrypt(byte[] encryptedKey) Decrypt an encrypted key E(K).- Specified by:
decryptin interfaceDecryptionOracle- Parameters:
encryptedKey- The encrypted key.- Returns:
- The decrypted key K.
-
verify
From an encrypted key E(K) generated theKeyVerification. Take and encrypted key E(K) and generate the verification information, including H(K).- Specified by:
verifyin interfaceDecryptionOracle- Parameters:
encryptedKey- The encrypted key E(K).- Returns:
- The key verification consisting of the hash H(K), the contract and the transaction.
-
generateKey
Generate a key K for a given contract and transaction. Encryption should be performed client side and it is recommended to call verify on the encrypted key K. The advantage of this procedure is that the caller obtains ownership to the key K in case of a failure of the decryption oracle to allow for a legally secured fall back method.- Specified by:
generateKeyin interfaceDecryptionOracle- Parameters:
contract- A string identifying the contract.transaction- A string identifying the transaction.- Returns:
- The key K.
-
generateEncryptedHashedKey
Generate a key for a given contract and transaction.- Specified by:
generateEncryptedHashedKeyin interfaceDecryptionOracle- Parameters:
contract- A string identifying the contract.transaction- A string identifying the transaction.- Returns:
- The pair of encrypted key E(K) and hashed key H(K) for the generated key K.
-
encrypt
encrypt.
- Parameters:
key- aPublicKeyobjecttext- an array of bytes objects- Returns:
- an array of bytes objects
-
decrypt
decrypt.
- Parameters:
key- aPrivateKeyobjectciphertext- an array of bytes objects- Returns:
- an array of bytes objects
-