RSA_set_method.3 revision 100946
Automatically generated by Pod::Man version 1.15
Tue Jul 30 09:21:54 2002

Standard preamble:
======================================================================

\\$1

.. ..

"\\$1" \\$2
..
..

.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. | will give a
real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
to do unbreakable dashes and therefore won't be available. \*(C` and
\*(C' expand to `' in nroff, nothing in troff, for use with C<>
.tr \(*W-|\(bv\*(Tr . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\}
If the F register is turned on, we'll generate index entries on stderr
for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
index entries marked with X<> in POD. Of course, you'll have to process
the output yourself in some meaningful fashion.
. de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\}
For nroff, turn off justification. Always turn off hyphenation; it
makes way too many mistakes in technical documents.

Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
.bd B 3 . \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ======================================================================

Title "RSA_set_method 3"
RSA_set_method 3 "0.9.6e" "2000-11-12" "OpenSSL"
C
"NAME"
RSA_set_default_method, RSA_get_default_method, RSA_set_method, RSA_get_method, RSA_PKCS1_SSLeay, RSA_PKCS1_RSAref, RSA_null_method, RSA_flags, RSA_new_method - select \s-1RSA\s0 method
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/rsa.h> .Ve .Vb 1 void RSA_set_default_method(RSA_METHOD *meth); .Ve .Vb 1 RSA_METHOD *RSA_get_default_method(void); .Ve .Vb 1 RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth); .Ve .Vb 1 RSA_METHOD *RSA_get_method(RSA *rsa); .Ve .Vb 1 RSA_METHOD *RSA_PKCS1_SSLeay(void); .Ve .Vb 1 RSA_METHOD *RSA_PKCS1_RSAref(void); .Ve .Vb 1 RSA_METHOD *RSA_null_method(void); .Ve .Vb 1 int RSA_flags(RSA *rsa); .Ve .Vb 1 RSA *RSA_new_method(RSA_METHOD *method); .Ve
"DESCRIPTION"
Header "DESCRIPTION" An \s-1RSA_METHOD\s0 specifies the functions that OpenSSL uses for \s-1RSA\s0 operations. By modifying the method, alternative implementations such as hardware accelerators may be used.

Initially, the default is to use the OpenSSL internal implementation, unless OpenSSL was configured with the \*(C`rsaref\*(C' or \*(C`-DRSA_NULL\*(C' options. RSA_PKCS1_SSLeay() returns a pointer to that method.

\fIRSA_PKCS1_RSAref() returns a pointer to a method that uses the RSAref library. This is the default method in the \*(C`rsaref\*(C' configuration; the function is not available in other configurations. \fIRSA_null_method() returns a pointer to a method that does not support the \s-1RSA\s0 transformation. It is the default if OpenSSL is compiled with \f(CW\*(C`-DRSA_NULL\*(C'. These methods may be useful in the \s-1USA\s0 because of a patent on the \s-1RSA\s0 cryptosystem.

\fIRSA_set_default_method() makes meth the default method for all \s-1RSA\s0 structures created later.

\fIRSA_get_default_method() returns a pointer to the current default method.

\fIRSA_set_method() selects meth for all operations using the key \fBrsa.

\fIRSA_get_method() returns a pointer to the method currently selected for rsa.

\fIRSA_flags() returns the flags that are set for rsa's current method.

\fIRSA_new_method() allocates and initializes an \s-1RSA\s0 structure so that \fBmethod will be used for the \s-1RSA\s0 operations. If method is \s-1NULL\s0, the default method is used.

"THE RSA_METHOD STRUCTURE"
Header "THE RSA_METHOD STRUCTURE" .Vb 4 typedef struct rsa_meth_st { /* name of the implementation */ const char *name; .Ve .Vb 3 /* encrypt */ int (*rsa_pub_enc)(int flen, unsigned char *from, unsigned char *to, RSA *rsa, int padding); .Ve .Vb 3 /* verify arbitrary data */ int (*rsa_pub_dec)(int flen, unsigned char *from, unsigned char *to, RSA *rsa, int padding); .Ve .Vb 3 /* sign arbitrary data */ int (*rsa_priv_enc)(int flen, unsigned char *from, unsigned char *to, RSA *rsa, int padding); .Ve .Vb 3 /* decrypt */ int (*rsa_priv_dec)(int flen, unsigned char *from, unsigned char *to, RSA *rsa, int padding); .Ve .Vb 3 /* compute r0 = r0 ^ I mod rsa->n (May be NULL for some implementations) */ int (*rsa_mod_exp)(BIGNUM *r0, BIGNUM *I, RSA *rsa); .Ve .Vb 3 /* compute r = a ^ p mod m (May be NULL for some implementations) */ int (*bn_mod_exp)(BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); .Ve .Vb 2 /* called at RSA_new */ int (*init)(RSA *rsa); .Ve .Vb 2 /* called at RSA_free */ int (*finish)(RSA *rsa); .Ve .Vb 7 /* RSA_FLAG_EXT_PKEY - rsa_mod_exp is called for private key * operations, even if p,q,dmp1,dmq1,iqmp * are NULL * RSA_FLAG_SIGN_VER - enable rsa_sign and rsa_verify * RSA_METHOD_FLAG_NO_CHECK - don't check pub/private match */ int flags; .Ve .Vb 1 char *app_data; /* ?? */ .Ve .Vb 5 /* sign. For backward compatibility, this is used only * if (flags & RSA_FLAG_SIGN_VER) */ int (*rsa_sign)(int type, unsigned char *m, unsigned int m_len, unsigned char *sigret, unsigned int *siglen, RSA *rsa); .Ve .Vb 5 /* verify. For backward compatibility, this is used only * if (flags & RSA_FLAG_SIGN_VER) */ int (*rsa_verify)(int type, unsigned char *m, unsigned int m_len, unsigned char *sigbuf, unsigned int siglen, RSA *rsa); .Ve .Vb 1 } RSA_METHOD; .Ve
"RETURN VALUES"
Header "RETURN VALUES" \fIRSA_PKCS1_SSLeay(), RSA_PKCS1_RSAref(), RSA_PKCS1_null_method(), \fIRSA_get_default_method() and RSA_get_method() return pointers to the respective \s-1RSA_METHOD\s0s.

\fIRSA_set_default_method() returns no value.

\fIRSA_set_method() returns a pointer to the \s-1RSA_METHOD\s0 previously associated with rsa.

\fIRSA_new_method() returns \s-1NULL\s0 and sets an error code that can be obtained by ERR_get_error(3) if the allocation fails. Otherwise it returns a pointer to the newly allocated structure.

"SEE ALSO"
Header "SEE ALSO" rsa(3), RSA_new(3)
"HISTORY"
Header "HISTORY" \fIRSA_new_method() and RSA_set_default_method() appeared in SSLeay 0.8. \fIRSA_get_default_method(), RSA_set_method() and RSA_get_method() as well as the rsa_sign and rsa_verify components of \s-1RSA_METHOD\s0 were added in OpenSSL 0.9.4.