Class: CryptoToolchain::BlackBoxes::RSAPaddingOracle

Inherits:
Object
  • Object
show all
Defined in:
lib/crypto_toolchain/black_boxes/rsa_padding_oracle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keypair: CryptoToolchain::BlackBoxes::RSAKeypair.new(bits: 256)) ⇒ RSAPaddingOracle

Returns a new instance of RSAPaddingOracle.



4
5
6
# File 'lib/crypto_toolchain/black_boxes/rsa_padding_oracle.rb', line 4

def initialize(keypair: CryptoToolchain::BlackBoxes::RSAKeypair.new(bits: 256))
  @keypair = keypair
end

Instance Attribute Details

#keypairObject (readonly)

Returns the value of attribute keypair.



8
9
10
# File 'lib/crypto_toolchain/black_boxes/rsa_padding_oracle.rb', line 8

def keypair
  @keypair
end

Instance Method Details

#execute(str) ⇒ Object



10
11
12
13
14
# File 'lib/crypto_toolchain/black_boxes/rsa_padding_oracle.rb', line 10

def execute(str)
  keypair.
    decrypt(str, pad: true).
    is_pkcs1_5_padded?(keypair.bits)
end