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)
[View source]

783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
# File 'ossl_pkey_rsa.c', line 783

static VALUE
ossl_rsa_to_text(VALUE self)
{
    RSA *rsa;
    BIO *out;
    VALUE str;

    GetRSA(self, rsa);
    if (!(out = BIO_new(BIO_s_mem()))) {
	ossl_raise(eRSAError, NULL);
    }
    if (!RSA_print(out, rsa, 0)) { /* offset = 0 */
	BIO_free(out);
	ossl_raise(eRSAError, NULL);
    }
    str = ossl_membio2str(out);

    return str;
}