fffonion / fffonion/lua-resty-openssl
sm2加密报错
Open
- Dominant language
- Lua
- Stars
- 170
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Description
使用type = "EC" 生成的公钥,在加密时报错,报错信息如下:
`pkey:asymmetric_routine EVP_PKEY_encrypt_init: code: -2 evp/pmeth_fn.c:141:error:0608B096:digital envelope routines: EVP_PKEY_encrypt_init: operation not supported for this keytype`
代码如下:
```lua
local pkey = require "resty.openssl.pkey"
local priv_key, err = pkey.new({
type = "EC"
})
local pub_pem = priv_key:to_PEM("public")
local pub_key, err = pkey.new(pub_pem)
local plaintext = "测试消息"
local ciphertext, err = pub_key:encrypt(plaintext)
if not ciphertext then
ngx.say(err)
end
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.