问题
· 四月 24, 2021

RSAEncrypt加密 只能用证书吗

最近尝试使用  Set Ciphertext=##class(%SYSTEM.Encryption).RSAEncrypt(Plaintext,PublicKeyStr)来加密数据,但是加密失败,参考了以下资料https://community.intersystems.com/post/format-public-key-when-using-rsa...

https://blog.ndpar.com/2017/04/17/p1-p8/

生成的公钥为

-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvl8YRMOJMUOyK5NzWo+8FD8dG
R3DuPwn7M13If+rwYp18TEL58NneFdCL+Jjytx4axq+uhPuup5HtmEm22+PQTzFl
XuAhXf3oUm4LQl4zgSb14D6gfqac9DqbVhm+aUjDfItFapM35/DH2cvc+rbBhu4Q
5Y6kJwcUK0UbRv3swQIDAQAB
-----END PUBLIC KEY-----

转换为pkcs1后的内容为

-----BEGIN RSA PUBLIC KEY-----
MIGJAoGBANHPwS9+rVB1TJZM1UGLCBan3CY8TIDPkDAftkI504l68vdUWdPlmcN1
YZzCGDK4+LvtzdqLXb/XSA3SxsUrA5toWSh45K7/jDzXRcb0AYiUTWGfpeMrHdcG
NL07gVT11FM8M+0Jc5Sw6dvMKVXE9wzAxwgaJo0d8zW8Crbx6iI3AgMBAAE=
-----END RSA PUBLIC KEY-----

文件保存为utf-8和ansi格式都不行。错误信息为

error:0906D06C:PEM routines:PEM_read_bio:no start line;

产品版本: Ensemble 2016.1
$ZV: Cache for Windows (x86-64) 2016.2.3 (Build 907_11_20446U) Thu Nov 12 2020 16:56:45 EST
讨论 (2)1
登录或注册以继续