Sha256: 1b77262733011017858d791c528bc1bf2762cd534e786b79952d1a1c4bcba748
Contents?: true
Size: 1005 Bytes
Versions: 1
Compression:
Stored size: 1005 Bytes
Contents
# frozen_string_literal: true require "openssl" require "openssl/signature_algorithm/base" module OpenSSL module SignatureAlgorithm class RSAPSS < Base class SigningKey < OpenSSL::PKey::RSA def verify_key public_key end end DEFAULT_KEY_SIZE = 2048 def generate_signing_key(size: DEFAULT_KEY_SIZE) @signing_key = SigningKey.new(size) end def sign(data) signing_key.sign_pss(hash_function, data, salt_length: salt_length, mgf1_hash: mgf1_hash_function) end def verify(signature, verification_data) verify_key.verify_pss( hash_function, signature, verification_data, salt_length: salt_length, mgf1_hash: mgf1_hash_function ) || raise(OpenSSL::SignatureAlgorithm::Error, "Signature verification failed") end def salt_length :auto end def mgf1_hash_function hash_function end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
openssl-signature_algorithm-0.1.0 | lib/openssl/signature_algorithm/rsapss.rb |