3

我查看了Ruby OpenSSL 文档,但我无法完全弄清楚我需要将哪些部分放在一起以制作 .p12 文件。

还有这个教程,但评论掩盖了对其正确性的矛盾心理。

4

1 回答 1

2

来自 ossl_pkcs12.c:

/*
* call-seq:
*    PKCS12.create(pass, name, key, cert [, ca, [, key_pbe [, cert_pbe [, key_iter [, mac_iter [, keytype]]]]]])
*
* === Parameters
* * +pass+ - string
* * +name+ - A string describing the key.
* * +key+ - Any PKey.
* * +cert+ - A X509::Certificate.
* * * The public_key portion of the certificate must contain a valid public key.
* * * The not_before and not_after fields must be filled in.
* * +ca+ - An optional array of X509::Certificate's.
* * +key_pbe+ - string
* * +cert_pbe+ - string
* * +key_iter+ - integer
* * +mac_iter+ - integer
* * +keytype+ - An integer representing an MSIE specific extension.
*
* Any optional arguments may be supplied as nil to preserve the OpenSSL defaults.
*
* See the OpenSSL documentation for PKCS12_create().

*/

所以(未经测试并且可能不正确 - 我对 Ruby 不是很熟悉):

p12 = OpenSSL::PKCS12.create("password", "key", pkey, cert)
p12_bytes = p12.to_der
于 2009-04-30T19:28:32.557 回答