Flowdock
method

public_encrypt

Importance_0
v1_9_1_378 - Show latest stable - 0 notes - Class: RSA
public_encrypt(p1, p2 = v2) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
static VALUE
ossl_rsa_public_encrypt(int argc, VALUE *argv, VALUE self)
{
    EVP_PKEY *pkey;
    int buf_len, pad;
    VALUE str, buffer, padding;

    GetPKeyRSA(self, pkey);
    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_public_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;
}
Register or log in to add new notes.