Class: Net::HTTP::MessageSignatures::RSAPSSSHA512

Inherits:
SignatureAlgorithm show all
Defined in:
lib/net/http/message_signatures/rsa_pss_sha512.rb

Overview

Implementation of the signature algorithm, RSASSA-PSS using SHA-512.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key: nil) ⇒ RSAPSSSHA512

Returns a new instance of RSAPSSSHA512.

Parameters:

  • key (OpenSSL::PKey::RSA) (defaults to: nil)

    key material



19
20
21
22
# File 'lib/net/http/message_signatures/rsa_pss_sha512.rb', line 19

def initialize(key: nil)
  super()
  @key = key
end

Instance Attribute Details

#key=(value) ⇒ OpenSSL::PKey::RSA

Returns key material.

Returns:

  • (OpenSSL::PKey::RSA)

    key material



16
17
18
# File 'lib/net/http/message_signatures/rsa_pss_sha512.rb', line 16

def key=(value)
  @key = value
end

Instance Method Details

#sign(message) ⇒ Object



24
25
26
27
# File 'lib/net/http/message_signatures/rsa_pss_sha512.rb', line 24

def sign(message)
  ensure_key!
  key.sign_pss('SHA512', message, salt_length: 64, mgf1_hash: 'SHA512')
end

#verify(message, signature) ⇒ Object



29
30
31
32
# File 'lib/net/http/message_signatures/rsa_pss_sha512.rb', line 29

def verify(message, signature)
  ensure_key!
  key.verify_pss('SHA512', signature, message, salt_length: 64, mgf1_hash: 'SHA512')
end