Interface DecryptionOracle
- All Known Implementing Classes:
DecryptionOracleImplementation
public interface DecryptionOracle
Decryption Oracle Interface.
Specifies the core methods described in ERC-7573 for the decryption oracle.
- Author:
- Christian Fries
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbyte[]decrypt(byte[] encryptedKey) Decrypt an encrypted key E(K).default Optional<byte[]>decryptIfVerified(byte[] encryptedKey, String contract, byte[] transaction) Performs a verification of the given encrypted key E(K), extracting the contract and the transaction, returning the decryption K, if the given contract and transaction match the extracted values.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.
-
Field Details
-
logger
Constantlogger
-
-
Method Details
-
decrypt
byte[] decrypt(byte[] encryptedKey) Decrypt an encrypted key E(K).- Parameters:
encryptedKey- The encrypted key.- Returns:
- The decrypted key K.
-
verify
From an encrypted key E(K) generated theKeyVerification.- 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.- 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.- 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.
-
decryptIfVerified
default Optional<byte[]> decryptIfVerified(byte[] encryptedKey, String contract, byte[] transaction) Performs a verification of the given encrypted key E(K), extracting the contract and the transaction, returning the decryption K, if the given contract and transaction match the extracted values.- Parameters:
encryptedKey- The encrypted key E(K).contract- A string identifying the contract.transaction- A string identifying the transaction.- Returns:
- The optional containing the decrypted key K, if the given contract and transaction are verified, otherwise empty.
-