我应该在rsa_pub_enc和rsa_pub_dec OpenSSL函数中使用什么?
我编写了一些OpenSSL引擎。 它使用帮助硬件实现其他RSA实现 OpenSSL具有函数我应该在rsa_pub_enc和rsa_pub_dec OpenSSL函数中使用什么?,openssl,rsa,Openssl,Rsa,我编写了一些OpenSSL引擎。 它使用帮助硬件实现其他RSA实现 OpenSSL具有函数ENGINE\u set\u RSA(ENGINE*e,const RSA\u METHOD*RSA\u meth)。有了HelpOne,我可以设置新的实现。 类型RSA\u方法包含实现的指针 struct rsa_meth_st { const char *name; int (*rsa_pub_enc) (int flen, const unsigned char *from,
ENGINE\u set\u RSA(ENGINE*e,const RSA\u METHOD*RSA\u meth)代码>。有了HelpOne,我可以设置新的实现。
类型RSA\u方法
包含实现的指针
struct rsa_meth_st {
const char *name;
int (*rsa_pub_enc) (int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
int (*rsa_pub_dec) (int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
int (*rsa_priv_enc) (int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
int (*rsa_priv_dec) (int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
/* Can be null */
int (*rsa_mod_exp) (BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx);
/* Can be null */
int (*bn_mod_exp) (BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
/* called at new */
int (*init) (RSA *rsa);
/* called at free */
int (*finish) (RSA *rsa);
/* RSA_METHOD_FLAG_* things */
int flags;
/* may be needed! */
char *app_data;
/*
* New sign and verify functions: some libraries don't allow arbitrary
* data to be signed/verified: this allows them to be used. Note: for
* this to work the RSA_public_decrypt() and RSA_private_encrypt() should
* *NOT* be used RSA_sign(), RSA_verify() should be used instead. Note:
* for backwards compatibility this functionality is only enabled if the
* RSA_FLAG_SIGN_VER option is set in 'flags'.
*/
int (*rsa_sign) (int type,
const unsigned char *m, unsigned int m_length,
unsigned char *sigret, unsigned int *siglen,
const RSA *rsa);
int (*rsa_verify) (int dtype, const unsigned char *m,
unsigned int m_length, const unsigned char *sigbuf,
unsigned int siglen, const RSA *rsa);
/*
* If this callback is NULL, the builtin software RSA key-gen will be
* used. This is for behavioural compatibility whilst the code gets
* rewired, but one day it would be nice to assume there are no such
* things as "builtin software" implementations.
*/
int (*rsa_keygen) (RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
};
我不明白应该怎么做rsa\u pub\u enc
和rsa\u pub\u dec
。
它应该只使用帮助公钥进行加密和解密吗
关于rsa\u priv\u enc/rsa\u priv\u dec
,我也有同样的问题。
它应该只使用帮助私钥进行加密和解密吗
我已经读过了,但是我不明白
谁能给我解释一下吗?加密/解密是这样进行的:
使用公钥加密-使用私钥解密(建议和标准方式)
或
使用私钥加密-使用公钥解密
设置1:您的rsa\u pub\u enc
可以指向实现rsa\u public\u encrypt
和rsa\u private\u dec
可以指向rsa\u private\u decrypt
Set 2:您的rsa\u private\u enc
可以指向实现rsa\u private\u encrypt
和rsa\u pub\u dec
可以指向rsa\u public\u decrypt
用户设置1,因为私钥总是安全的