1

opensslを使用してPKCS#7署名付きメッセージの追加の認証済み属性を渡す方法はありますか?私はコマンドラインで立ち往生しています。

私は現在使用しています:

openssl smime -sign -outform DER -md sha1 -binary -signer my.crt -inkey my.key

opensslcliヘルプに関連するオプションが見つかりませんでした。


より詳しい情報 :

現在、NodeJSでSCEP(http://tools.ietf.org/pdf/draft-nourse-scep-23.pdf)サーバーを構築しようとしています。

SCEP仕様では、PKCS#7署名付きをビルドする必要がありますpkiMessages

The SignerInfo MUST contain a set of authenticatedAttributes (see PKCS#7 [RFC2315] Section 9.2 as well as Section 3.1.1 in this document). All messages MUST contain
* an SCEP transactionID attribute
* an SCEP messageType attribute
* an SCEP senderNonce attribute
* any attributes required by PKCS#7 [RFC2315] Section 9.2 If the message is a response, it MUST also include

openssl現在、私の唯一のオプションは、機能をラップすることchild_process.spawnです。

4

1 に答える 1

6

残念ながら、OpenSSL コマンド ラインから署名付きメッセージにカスタム属性を追加することはできません (smime も cms コマンドも使用できません)。カスタム属性を追加したい場合は、OpenSSL API を使用する必要があります。

主な手順は次のとおりです。

  • CMS_sign作成するために呼び出すCMS_ContentInfo
  • で SignerInfo を作成しますCMS_add1_signer
  • この署名者に属性を追加しますCMS_signed_add1_attr_by_OBJ
  • 署名するCMS_final()

詳細はこちら: http://www.openssl.org/docs/crypto/CMS_sign.html

于 2012-10-29T22:14:50.450 に答える