Class DecryptionOracleImplementation

java.lang.Object
net.finmath.decryptionoracle.decryption.DecryptionOracleImplementation
All Implemented Interfaces:
DecryptionOracle

public class DecryptionOracleImplementation extends Object implements DecryptionOracle
Implementation of a DecryptionOracle using RSA.
Author:
Christian Fries
  • Constructor Details

  • Method Details

    • decrypt

      public byte[] decrypt(byte[] encryptedKey)
      Decrypt an encrypted key E(K).
      Specified by:
      decrypt in interface DecryptionOracle
      Parameters:
      encryptedKey - The encrypted key.
      Returns:
      The decrypted key K.
    • verify

      public KeyVerification verify(byte[] encryptedKey)
      From an encrypted key E(K) generated the KeyVerification. Take and encrypted key E(K) and generate the verification information, including H(K).
      Specified by:
      verify in interface DecryptionOracle
      Parameters:
      encryptedKey - The encrypted key E(K).
      Returns:
      The key verification consisting of the hash H(K), the contract and the transaction.
    • generateKey

      public byte[] generateKey(String contract, byte[] transaction)
      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:
      generateKey in interface DecryptionOracle
      Parameters:
      contract - A string identifying the contract.
      transaction - A string identifying the transaction.
      Returns:
      The key K.
    • generateEncryptedHashedKey

      public EncryptedHashedKey generateEncryptedHashedKey(String contract, byte[] transaction)
      Generate a key for a given contract and transaction.
      Specified by:
      generateEncryptedHashedKey in interface DecryptionOracle
      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

      public byte[] encrypt(PublicKey key, byte[] text)

      encrypt.

      Parameters:
      key - a PublicKey object
      text - an array of bytes objects
      Returns:
      an array of bytes objects
    • decrypt

      public byte[] decrypt(PrivateKey key, byte[] ciphertext)

      decrypt.

      Parameters:
      key - a PrivateKey object
      ciphertext - an array of bytes objects
      Returns:
      an array of bytes objects