Class: OpenSSL::PKey::RSA
- Inherits:
-
PKey
- Object
- PKey
- OpenSSL::PKey::RSA
- Defined in:
- ossl_pkey_rsa.c
Class Method Summary collapse
Instance Method Summary collapse
- #blinding_off! ⇒ Object
- #blinding_on! ⇒ Object
- #export ⇒ Object (also: #to_pem, #to_s)
- #initialize ⇒ Object constructor
-
#params ⇒ Object
Stores all parameters of key to the hash INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!! Don't use :-)) (I's up to you).
- #private? ⇒ Boolean
- #private_decrypt ⇒ Object
- #private_encrypt ⇒ Object
- #public? ⇒ Boolean
- #public_decrypt ⇒ Object
- #public_encrypt ⇒ Object
-
#public_key ⇒ Object
Makes new instance RSA PUBLIC_KEY from PRIVATE_KEY.
- #to_der ⇒ Object
-
#to_text ⇒ Object
Prints all parameters of key to buffer INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!! Don't use :-)) (It's up to you).
Constructor Details
#initialize ⇒ Object
Class Method Details
.generate ⇒ Object
Instance Method Details
#blinding_off! ⇒ Object
#blinding_on! ⇒ Object
#export ⇒ Object Also known as: to_pem, to_s
#params ⇒ Object
Stores all parameters of key to the hash INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!! Don't use :-)) (I's up to you)
|
# File 'ossl_pkey_rsa.c'
static VALUE
ossl_rsa_get_params(VALUE self)
{
EVP_PKEY *pkey;
VALUE hash;
GetPKeyRSA(self, pkey);
hash = rb_hash_new();
rb_hash_aset(hash, rb_str_new2("n"), ossl_bn_new(pkey->pkey.rsa->n));
rb_hash_aset(hash, rb_str_new2("e"), ossl_bn_new(pkey->pkey.rsa->e));
rb_hash_aset(hash, rb_str_new2("d"), ossl_bn_new(pkey->pkey.rsa->d));
rb_hash_aset(hash, rb_str_new2("p"), ossl_bn_new(pkey->pkey.rsa->p));
rb_hash_aset(hash, rb_str_new2("q"), ossl_bn_new(pkey->pkey.rsa->q));
rb_hash_aset(hash, rb_str_new2("dmp1"), ossl_bn_new(pkey->pkey.rsa->dmp1));
rb_hash_aset(hash, rb_str_new2("dmq1"), ossl_bn_new(pkey->pkey.rsa->dmq1));
rb_hash_aset(hash, rb_str_new2("iqmp"), ossl_bn_new(pkey->pkey.rsa->iqmp));
return hash;
}
|
#private? ⇒ Boolean
#private_decrypt ⇒ Object
#private_encrypt ⇒ Object
#public? ⇒ Boolean
#public_decrypt ⇒ Object
#public_encrypt ⇒ Object
#public_key ⇒ Object
Makes new instance RSA PUBLIC_KEY from PRIVATE_KEY
|
# File 'ossl_pkey_rsa.c'
static VALUE
ossl_rsa_to_public_key(VALUE self)
{
EVP_PKEY *pkey;
RSA *rsa;
VALUE obj;
GetPKeyRSA(self, pkey);
/* err check performed by rsa_instance */
rsa = RSAPublicKey_dup(pkey->pkey.rsa);
obj = rsa_instance(CLASS_OF(self), rsa);
if (obj == Qfalse) {
RSA_free(rsa);
ossl_raise(eRSAError, NULL);
}
|
#to_der ⇒ Object
#to_text ⇒ Object
Prints all parameters of key to buffer INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!! Don't use :-)) (It's up to you)
|
# File 'ossl_pkey_rsa.c'
static VALUE
ossl_rsa_to_text(VALUE self)
{
EVP_PKEY *pkey;
BIO *out;
VALUE str;
GetPKeyRSA(self, pkey);
if (!(out = BIO_new(BIO_s_mem()))) {
ossl_raise(eRSAError, NULL);
}
|