Method: OpenSSL::PKey::EC#dsa_sign_asn1
- Defined in:
- ossl_pkey_ec.c
#dsa_sign_asn1(data) ⇒ String
See the OpenSSL documentation for ECDSA_sign()
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 |
# File 'ossl_pkey_ec.c', line 622 static VALUE ossl_ec_key_dsa_sign_asn1(VALUE self, VALUE data) { EC_KEY *ec; unsigned int buf_len; VALUE str; GetEC(self, ec); StringValue(data); if (EC_KEY_get0_private_key(ec) == NULL) ossl_raise(eECError, "Private EC key needed!"); str = rb_str_new(0, ECDSA_size(ec)); if (ECDSA_sign(0, (unsigned char *) RSTRING_PTR(data), RSTRING_LENINT(data), (unsigned char *) RSTRING_PTR(str), &buf_len, ec) != 1) ossl_raise(eECError, "ECDSA_sign"); rb_str_set_len(str, buf_len); return str; } |