-2
我试图从'.cer'格式解析数据到纯文本,我可以在网站上使用。为此,this library是适合的,但我不明白如何使用它,也许有人使用它,并可以提供建议?为网站解析“.cer”格式
File example file, you can load this。
我试图从'.cer'格式解析数据到纯文本,我可以在网站上使用。为此,this library是适合的,但我不明白如何使用它,也许有人使用它,并可以提供建议?为网站解析“.cer”格式
File example file, you can load this。
事情是这样的:
var encoded_string = /* your string */;
var input = ASN1.decode(Base64.unarmor(encoded_string));
访问属性,如typeName
和sub
:
function buildJSON(input, output){
Object.assign(output, {
type: input.typeName(),
content: input.content()
});
output.sub = [];
if(input.sub){
for(var sub of input.sub){
var obj = {};
buildJSON(sub, obj)
output.sub.push(obj);
}
}
return output;
}
记住加载所需的脚本,并依次是:
你应该在生产中使用它之前,结合脚本。
看到它在行动:https://jsfiddle.net/DerekL/bgz86cvp/
阅读文档:https://github.com/lapo-luchini/asn1js/blob/master/dom.js#L51
您好,欢迎StackOverflow上。请花一些时间阅读帮助页面,特别是名为“我可以问什么问题?”的部分。和“我应该避免问什么类型的问题?”。更重要的是,请阅读Stack Overflow问题清单:https://meta.stackoverflow.com/questions/260648/stack-overflow-question-checklist。您可能还想了解最小化,完整和可验证的示例。 – SherylHohman
请在问题中包含相关信息。模糊的链接可能会导致各种各样的东西。 – Gassa