spacewander / lua-resty-rsa

RSA encrypt/decrypt & sign/verify for OpenResty/LuaJIT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get a nil from new()

FelizQ opened this issue · comments

commented

I use a multiline string to init a new pubkey and got 'bad end line ' ERR .
example:

pubkey = [[-----BEGIN PUBLIC KEY-----
asdfasdfasdfasdfasdfasdfasdfasdfas
gafasdfasdfasdfasdfasdfasdf
dfasdfasdfasdfas
fasdfasdfasdfasdfas
-----END PUBLIC KEY-----]]

pub , err = rsa:new({public_key = pubkey})

then pub is nil , err is 'bad end line'

does the opt value require specific format ?
thanks a lot

commented

I had tried both of the key types and the result is the same

@FelizQ
Interesting. The bad end line error means the ending of the public key input is not correct. Have you verified the public key with OpenSSL commandline tool? Could you provide a reproduce case so that I could test by myself?

commented

@spacewander
I had found the cause : the pub key string had been quoted by an interface :(
thanks for your help