Flowdock
method

sign_pss

Importance_2
v2_5_5 - Show latest stable - 0 notes - Class: RSA
sign_pss(p1, p2, p3 = {}) public

Signs data using the Probabilistic Signature Scheme (RSA-PSS) and returns the calculated signature.

RSAError will be raised if an error occurs.

See #verify_pss for the verification operation.

Parameters

digest

A String containing the message digest algorithm name.

data

A String. The data to be signed.

salt_length

The length in octets of the salt. Two special values are reserved: :digest means the digest length, and :max means the maximum possible length for the combination of the private key and the selected message digest algorithm.

mgf1_hash

The hash algorithm used in MGF1 (the currently supported mask generation function (MGF)).

Example

data = "Sign me!"
pkey = OpenSSL::PKey::RSA.new(2048)
signature = pkey.sign_pss("SHA256", data, salt_length: :max, mgf1_hash: "SHA256")
pub_key = pkey.public_key
puts pub_key.verify_pss("SHA256", signature, data,
                        salt_length: :auto, mgf1_hash: "SHA256") # => true
Show source
Register or log in to add new notes.