Sha256: 8852c46cbe61d7c82c074455b12d7593fb2082825e5fe4c5890ad129bba828ae

Contents?: true

Size: 712 Bytes

Versions: 5

Compression:

Stored size: 712 Bytes

Contents

# frozen_string_literal: true

require "openssl"
require "openssl/signature_algorithm/rsa"

module OpenSSL
  module SignatureAlgorithm
    class RSAPSS < RSA
      def sign(data)
        signing_key.sign_pss(hash_function, data, salt_length: :max, mgf1_hash: mgf1_hash_function)
      end

      def verify(signature, verification_data)
        verify_key.verify_pss(
          hash_function,
          signature,
          verification_data,
          salt_length: :auto,
          mgf1_hash: mgf1_hash_function
        ) || raise(OpenSSL::SignatureAlgorithm::SignatureVerificationError, "Signature verification failed")
      end

      def mgf1_hash_function
        hash_function
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
openssl-signature_algorithm-1.3.0 lib/openssl/signature_algorithm/rsapss.rb
openssl-signature_algorithm-1.2.1 lib/openssl/signature_algorithm/rsapss.rb
openssl-signature_algorithm-1.1.1 lib/openssl/signature_algorithm/rsapss.rb
openssl-signature_algorithm-1.1.0 lib/openssl/signature_algorithm/rsapss.rb
openssl-signature_algorithm-1.0.0 lib/openssl/signature_algorithm/rsapss.rb