在 Convert::PEM 中使用 ASN1 序列来读取 pkcs8 DER 私钥?珀尔
我正在尝试将私钥转换为 PEM,该私钥使用 pkcs8 在 DER 中进行编码和加密,模块 Convert::PEM 它要求 ASN 序列(我相信用于加密的算法是 EDE_EDE3)
我发现了这个文档: 公钥加密标准 (PKCS) #8: 描述了所使用的语法,但我无法在我的 PERL 代码中成功应用,我尝试过:
my $pem = Convert::PEM->new(
Name => "RSA PRIVATE KEY",
ASN => qq(
PrivateKeyInfo ::= SEQUENCE {
version Version,
privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
privateKey PrivateKey,
attributes [0] IMPLICIT Attributes OPTIONAL }
Version ::= INTEGER
PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
PrivateKey ::= OCTET STRING
Attributes ::= SET OF Attribute
}
))or die "New failed: ", Convert::PEM->errstr;
我做错了什么?
I'm trying to convert to PEM a private key which is encoded and encrypted in DER using pkcs8, with module Convert::PEM and it ask for an ASN Sequence (I believe the algorithm used to encrypt is EDE_EDE3)
I've found this documentation: Public-Key Cryptography Standards (PKCS) #8: which describes the syntax used, but I haven't been able to applied successfully in my PERL code, I've tried:
my $pem = Convert::PEM->new(
Name => "RSA PRIVATE KEY",
ASN => qq(
PrivateKeyInfo ::= SEQUENCE {
version Version,
privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
privateKey PrivateKey,
attributes [0] IMPLICIT Attributes OPTIONAL }
Version ::= INTEGER
PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
PrivateKey ::= OCTET STRING
Attributes ::= SET OF Attribute
}
))or die "New failed: ", Convert::PEM->errstr;
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论