Method: OpenSSL::PKey::RSA#to_text

Defined in:
ossl_pkey_rsa.c

#to_textString

THIS METHOD IS INSECURE, PRIVATE INFORMATION CAN LEAK OUT!!!

Dumps all parameters of a keypair to a String

Don't use :-)) (It's up to you)

Returns:

  • (String)


543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
# File 'ossl_pkey_rsa.c', line 543

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);
    }
    if (!RSA_print(out, pkey->pkey.rsa, 0)) { /* offset = 0 */
	BIO_free(out);
	ossl_raise(eRSAError, NULL);
    }
    str = ossl_membio2str(out);

    return str;
}