Class: CryptoToolchain::Tools::RSAUnpaddedMessageRecoveryAttack

Inherits:
Object
  • Object
show all
Defined in:
lib/crypto_toolchain/tools/rsa_unpadded_message_recovery_attack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(oracle:, s: 2) ⇒ RSAUnpaddedMessageRecoveryAttack

Returns a new instance of RSAUnpaddedMessageRecoveryAttack.



7
8
9
10
# File 'lib/crypto_toolchain/tools/rsa_unpadded_message_recovery_attack.rb', line 7

def initialize(oracle: , s: 2)
  @oracle = oracle
  @s = s
end

Instance Attribute Details

#oracleObject (readonly)

Returns the value of attribute oracle.



5
6
7
# File 'lib/crypto_toolchain/tools/rsa_unpadded_message_recovery_attack.rb', line 5

def oracle
  @oracle
end

#sObject (readonly)

Returns the value of attribute s.



5
6
7
# File 'lib/crypto_toolchain/tools/rsa_unpadded_message_recovery_attack.rb', line 5

def s
  @s
end

Instance Method Details

#execute(ciphertext) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/crypto_toolchain/tools/rsa_unpadded_message_recovery_attack.rb', line 12

def execute(ciphertext)
  plaintext(
    p_prime(
      c_prime(
        ciphertext.to_number
      )
    )
  )
end