This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

sign

        # OpenSSL::PKey::PKey.sign

(from ruby core)
### Implementation from PKey
---
    pkey.sign(digest, data [, options]) -> string

---

Hashes and signs the `data` using a message digest algorithm `digest`
and a private key `pkey`.

See #verify for the verification operation.

See also the man page EVP_DigestSign(3).

`digest`
:   A String that represents the message digest algorithm name, or `nil`
    if the PKey type requires no digest algorithm. For backwards
    compatibility, this can be an instance of OpenSSL::Digest. Its state
    will not affect the signature.
`data`
:   A String. The data to be hashed and signed.
`options`
:   A Hash that contains algorithm specific control operations to
    OpenSSL. See OpenSSL's man page EVP_PKEY_CTX_ctrl_str(3) for
    details. `options` parameter was added in version 3.0.


Example:
    data = "Sign me!"
    pkey = OpenSSL::PKey.generate_key("RSA", rsa_keygen_bits: 2048)
    signopts = { rsa_padding_mode: "pss" }
    signature = pkey.sign("SHA256", data, signopts)

    # Creates a copy of the RSA key pkey, but without the private components
    pub_key = pkey.public_key
    puts pub_key.verify("SHA256", signature, data, signopts) # => true



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.