Method: OpenSSL::Netscape::SPKI#sign

Defined in:
ossl_ns_spki.c

#sign(key, digest) ⇒ Object

Parameters

  • key - the private key to be used for signing this instance

  • digest - the digest to be used for signing this instance

To sign an SPKI, the private key corresponding to the public key set for this instance should be used, in addition to a digest algorithm in the form of an OpenSSL::Digest. The private key should be an instance of OpenSSL::PKey.



280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'ossl_ns_spki.c', line 280

static VALUE
ossl_spki_sign(VALUE self, VALUE key, VALUE digest)
{
    NETSCAPE_SPKI *spki;
    EVP_PKEY *pkey;
    const EVP_MD *md;

    pkey = GetPrivPKeyPtr(key); /* NO NEED TO DUP */
    md = ossl_evp_get_digestbyname(digest);
    GetSPKI(self, spki);
    if (!NETSCAPE_SPKI_sign(spki, pkey, md)) {
  ossl_raise(eSPKIError, NULL);
    }

    return self;
}