使用NodeJS打开PKCS#7数据有效负载? [英] PKCS#7 data payload unpacking with NodeJS?

查看:449
本文介绍了使用NodeJS打开PKCS#7数据有效负载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用iOS的MDM NodeJS服务器。在Apple文档中,给出了以下ruby代码:

I'm working on an MDM NodeJS server for iOS. On the Apple docs, the following ruby code is given :

  p7sign = OpenSSL::PKCS7::PKCS7.new(req.body)
  store = OpenSSL::X509::Store.new
  p7sign.verify(nil, store, nil, OpenSSL::PKCS7::NOVERIFY)
  signers = p7sign.signers

NodeJS中的等效项目是什么?
这个想法是访问包含xml plist的 p7sign.data

What would be the equivalent in NodeJS? The idea is to access p7sign.data that contains an xml plist.

crypto 或外部节点lib( ursa 等)?

Is this possible using either crypto or an external node lib (ursa, etc)?

推荐答案

一个好的选择是使用child_process直接调用openssl。我这样做以验证iOS .mobileprovision文件。

A good option would be to use child_process to invoke openssl directly. I do that to validate iOS .mobileprovision files.

$ openssl smime -verify -in FILE -inform der 

openssl命令需要由苹果提供(不是从ports或homebrew),以便它可以找到签名证书和CA在密钥链中。

The openssl command needs to be the apple-provided (not from ports or homebrew) so that it can find signing certificates and CA's in the keychain.

我没有自己尝试过,但是node-forge库包含许多密码算法的实现。

I haven't tried this myself, but the node-forge library contains an implementation of many cryptographic algorithms.

https://npmjs.org/package/node-forge#pkcs7

这篇关于使用NodeJS打开PKCS#7数据有效负载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆