I want to encode p7b file with certificate chain to pem I can do it in console with openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer
I want to do it with erlang ssl library - looks like otp should already do this without asn.1 test in erlang otp But
1> application:ensure_all_started(ssl).
{ok,[crypto,asn1,public_key,ssl]}
But PKCS7
module undefined - asn.1 was not compiled
2> 'PKCS7':decode('SignedData', Der1).
** exception error: undefined function 'PKCS7':decode/2
If I download PKCS7.asn manually and try to compile, I'll get error
3> asn1ct:compile('PKCS7.asn')
PKCS7:13: 'Attribute' is not exported from InformationFramework
...
{error,[{structured_error,{'PKCS7',13},
asn1ct_check,
{undefined_import,'Attribute','InformationFramework'}},
{structured_error,{'PKCS7',13},
Question 1: Is there any way to compile 'PKCS7' without manual downloading asn.1 modules? I am sure I missed something important, and this file should works automatically as otp lib
Question 2: Maybe there are some simplest way to encode p7b to pem chain?
Is there any documentation for using otp/lib/asn.1?
1条答案
按热度按时间ttcibm8c1#
无需编译ANS.1模块PKCS7。Erlang(Elixir)函数
public_key:der_decode/2
将'ContentInfo'
原子作为第一个参数ASN1Type。( Elixir 代码)
但问题为什么
'PKCS7':decode
不工作仍然开放