3
我看過Ruby OpenSSL documentation,但我無法弄清楚我需要拼湊起來製作.p12文件。如何在Ruby中創建.p12文件?
還有this tutorial,但評論認爲它的正確性是矛盾的。
我看過Ruby OpenSSL documentation,但我無法弄清楚我需要拼湊起來製作.p12文件。如何在Ruby中創建.p12文件?
還有this tutorial,但評論認爲它的正確性是矛盾的。
從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().
*/
所以(未經測試,可能不正確 - 我不是很熟悉的紅寶石):
p12 = OpenSSL::PKCS12.create("password", "key", pkey, cert)
p12_bytes = p12.to_der