method
private_encrypt
v1_9_2_180 -
Show latest stable
-
0 notes -
Class: RSA
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (0)
- 1_9_3_125 (38)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
private_encrypt(p1, p2 = v2)
public
Hide source
static VALUE ossl_rsa_private_encrypt(int argc, VALUE *argv, VALUE self) { EVP_PKEY *pkey; int buf_len, pad; VALUE str, buffer, padding; GetPKeyRSA(self, pkey); if (!RSA_PRIVATE(self, pkey->pkey.rsa)) { ossl_raise(eRSAError, "private key needed."); } rb_scan_args(argc, argv, "11", &buffer, &padding); pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding); StringValue(buffer); str = rb_str_new(0, ossl_rsa_buf_size(pkey)); buf_len = RSA_private_encrypt(RSTRING_LEN(buffer), (unsigned char *)RSTRING_PTR(buffer), (unsigned char *)RSTRING_PTR(str), pkey->pkey.rsa, pad); if (buf_len < 0) ossl_raise(eRSAError, NULL); rb_str_set_len(str, buf_len); return str; }