⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rsa_set_method.pod

📁 开源的ssl算法openssl,版本0.9.8H
💻 POD
字号:
=pod=head1 NAMERSA_set_default_method, RSA_get_default_method, RSA_set_method,RSA_get_method, RSA_PKCS1_SSLeay, RSA_null_method, RSA_flags,RSA_new_method - select RSA method=head1 SYNOPSIS #include <openssl/rsa.h> void RSA_set_default_method(const RSA_METHOD *meth); RSA_METHOD *RSA_get_default_method(void); int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); RSA_METHOD *RSA_get_method(const RSA *rsa); RSA_METHOD *RSA_PKCS1_SSLeay(void); RSA_METHOD *RSA_null_method(void); int RSA_flags(const RSA *rsa); RSA *RSA_new_method(RSA_METHOD *method);=head1 DESCRIPTIONAn B<RSA_METHOD> specifies the functions that OpenSSL uses for RSAoperations. By modifying the method, alternative implementations such ashardware accelerators may be used. IMPORTANT: See the NOTES section forimportant information about how these RSA API functions are affected by theuse of B<ENGINE> API calls.Initially, the default RSA_METHOD is the OpenSSL internal implementation,as returned by RSA_PKCS1_SSLeay().RSA_set_default_method() makes B<meth> the default method for all RSAstructures created later. B<NB>: This is true only whilst no ENGINE hasbeen set as a default for RSA, so this function is no longer recommended.RSA_get_default_method() returns a pointer to the current defaultRSA_METHOD. However, the meaningfulness of this result is dependant onwhether the ENGINE API is being used, so this function is no longer recommended.RSA_set_method() selects B<meth> to perform all operations using the keyB<rsa>. This will replace the RSA_METHOD used by the RSA key and if theprevious method was supplied by an ENGINE, the handle to that ENGINE willbe released during the change. It is possible to have RSA keys that onlywork with certain RSA_METHOD implementations (eg. from an ENGINE modulethat supports embedded hardware-protected keys), and in such casesattempting to change the RSA_METHOD for the key can have unexpectedresults.RSA_get_method() returns a pointer to the RSA_METHOD being used by B<rsa>.This method may or may not be supplied by an ENGINE implementation, but ifit is, the return value can only be guaranteed to be valid as long as theRSA key itself is valid and does not have its implementation changed byRSA_set_method().RSA_flags() returns the B<flags> that are set for B<rsa>'s currentRSA_METHOD. See the BUGS section.RSA_new_method() allocates and initializes an RSA structure so thatB<engine> will be used for the RSA operations. If B<engine> is NULL, thedefault ENGINE for RSA operations is used, and if no default ENGINE is set,the RSA_METHOD controlled by RSA_set_default_method() is used.RSA_flags() returns the B<flags> that are set for B<rsa>'s current method.RSA_new_method() allocates and initializes an B<RSA> structure so thatB<method> will be used for the RSA operations. If B<method> is B<NULL>,the default method is used.=head1 THE RSA_METHOD STRUCTURE typedef struct rsa_meth_st {     /* name of the implementation */	const char *name;     /* encrypt */	int (*rsa_pub_enc)(int flen, unsigned char *from,          unsigned char *to, RSA *rsa, int padding);     /* verify arbitrary data */	int (*rsa_pub_dec)(int flen, unsigned char *from,          unsigned char *to, RSA *rsa, int padding);     /* sign arbitrary data */	int (*rsa_priv_enc)(int flen, unsigned char *from,          unsigned char *to, RSA *rsa, int padding);     /* decrypt */	int (*rsa_priv_dec)(int flen, unsigned char *from,          unsigned char *to, RSA *rsa, int padding);     /* compute r0 = r0 ^ I mod rsa->n (May be NULL for some                                        implementations) */	int (*rsa_mod_exp)(BIGNUM *r0, BIGNUM *I, RSA *rsa);     /* 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);     /* called at RSA_new */	int (*init)(RSA *rsa);     /* called at RSA_free */	int (*finish)(RSA *rsa);     /* 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;	char *app_data; /* ?? */     /* 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);     /* 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); } RSA_METHOD;=head1 RETURN VALUESRSA_PKCS1_SSLeay(), RSA_PKCS1_null_method(), RSA_get_default_method()and RSA_get_method() return pointers to the respective RSA_METHODs.RSA_set_default_method() returns no value.RSA_set_method() returns a pointer to the old RSA_METHOD implementationthat was replaced. However, this return value should probably be ignoredbecause if it was supplied by an ENGINE, the pointer could be invalidatedat any time if the ENGINE is unloaded (in fact it could be unloaded as aresult of the RSA_set_method() function releasing its handle to theENGINE). For this reason, the return type may be replaced with a B<void>declaration in a future release.RSA_new_method() returns NULL and sets an error code that can be obtainedby L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwiseit returns a pointer to the newly allocated structure.=head1 NOTESAs of version 0.9.7, RSA_METHOD implementations are grouped together withother algorithmic APIs (eg. DSA_METHOD, EVP_CIPHER, etc) into B<ENGINE>modules. If a default ENGINE is specified for RSA functionality using anENGINE API function, that will override any RSA defaults set using the RSAAPI (ie.  RSA_set_default_method()). For this reason, the ENGINE API is therecommended way to control default implementations for use in RSA and othercryptographic algorithms.=head1 BUGSThe behaviour of RSA_flags() is a mis-feature that is left as-is for nowto avoid creating compatibility problems. RSA functionality, such as theencryption functions, are controlled by the B<flags> value in the RSA keyitself, not by the B<flags> value in the RSA_METHOD attached to the RSA key(which is what this function returns). If the flags element of an RSA keyis changed, the changes will be honoured by RSA functionality but will notbe reflected in the return value of the RSA_flags() function - in effectRSA_flags() behaves more like an RSA_default_flags() function (which doesnot currently exist).=head1 SEE ALSOL<rsa(3)|rsa(3)>, L<RSA_new(3)|RSA_new(3)>=head1 HISTORYRSA_new_method() and RSA_set_default_method() appeared in SSLeay 0.8.RSA_get_default_method(), RSA_set_method() and RSA_get_method() aswell as the rsa_sign and rsa_verify components of RSA_METHOD wereadded in OpenSSL 0.9.4.RSA_set_default_openssl_method() and RSA_get_default_openssl_method()replaced RSA_set_default_method() and RSA_get_default_method()respectively, and RSA_set_method() and RSA_new_method() were altered to useB<ENGINE>s rather than B<RSA_METHOD>s during development of the engineversion of OpenSSL 0.9.6. For 0.9.7, the handling of defaults in the ENGINEAPI was restructured so that this change was reversed, and behaviour of theother functions resembled more closely the previous behaviour. Thebehaviour of defaults in the ENGINE API now transparently overrides thebehaviour of defaults in the RSA API without requiring changing thesefunction prototypes.=cut

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -