通过OpenSSL的我的Andr​​oid应用自签名证书在Windows中创建PKCS#12文件 [英] Create PKCS#12 file with self-signed certificate via OpenSSL in Windows for my Android App

查看:245
本文介绍了通过OpenSSL的我的Andr​​oid应用自签名证书在Windows中创建PKCS#12文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个Android应用程序,需要对某些Web请求的SSL认证。我需要建立一个PKCS12文件( .PFX )使用自签名的证书。

I am writing an Android App that requires SSL certification for certain web requests. I need to build a PKCS12 file (.pfx) with Self-Signed Certificate.

我决定使用OpenSSL库,但我不能在我的计算机(Windows x64平台),构建它。我想这样做没有的ActivePerl安装。谁知道简单的方法来构建它?

I decided to use OpenSSL library, but I could not build it on my computer (Windows x64 platform). I want to do it without ActivePerl installation. Who knows easy way to build it?

我试图建立与OpenSSL的朋友的电脑上的PKCS12文件(使用OpenSSL,Linux的),但我什么也得不到。谁能帮助我,并描述了行动的顺序,生成具有私钥和自签署PKCS12文件公证书?

I was trying to build a PKCS12 file with OpenSSL on my friends computer (with OpenSSL, Linux) but i get nothing. Can anyone help me, and to describe the sequence of actions to generate PKCS12 file with Private Key and Self-Signed Public Certificate?

推荐答案

Win32的OpenSSL的安装项目致力于提供一个简单的安装的OpenSSL。这是很容易建立和易于通过简单的,有效的安装使用。无需编译任何东西或跳跃通过任何箍,只需点击几次,它被安装,让你做真正的工作。你可以在这里。在你的情况,你需要 Win64的OpenSSL的v1.0.1e 安装。

The Win32 OpenSSL Installation Project is dedicated to providing a simple installation of OpenSSL. It is easy to set up and easy to use through the simple, effective installer. No need to compile anything or jump through any hoops, just click a few times and it is installed, leaving you to doing real work. You can get it here. In your case, you need Win64 OpenSSL v1.0.1e Installer.

这些说明介绍了如何生成PKCS#12私钥和公钥证书文件,是适用于使用HTTPS,FTPS。 这些说明假定您已经下载并安装的OpenSSL的Windows二进制分发。

These instructions show how to generate a PKCS#12 private key and public certificate file that is suitable for use with HTTPS, FTPS. These instructions assume you have downloaded and installed the Windows binary distribution of OpenSSL.

1.Generate RSA私钥:

> C:\ Openssl的\ BIN \ openssl.exe genrsa退房手续<密钥文件名> <关键尺寸和GT;

其中:

<密钥文件名> 是私钥文件所需的文件名

<Key Filename> is the desired filename for the private key file

&LT;关键尺寸和GT; 是所需的密钥长度为1024,2048,或4096

<Key Size> is the desired key length of either 1024, 2048, or 4096

例如,键入:

&GT; C:\ Openssl的\ BIN \ openssl.exe genrsa退房手续my_key.key 2048

2。生成证书签名请求:

在版本0.9.8h及更高版本:

In version 0.9.8h and later:

&GT; C:\ Openssl的\ BIN \ openssl.exe REQ -new -key&LT;密钥文件名&GT;退房手续&lt;请求的文件名和GT; -config C:\ Openssl的\ BIN \ openssl.cfg

其中:

&LT;密钥文件名&GT; 是$ P $的输入文件名pviously生成的私钥

<Key Filename> is the input filename of the previously generated private key

&lt;请求的文件名和GT; 是证书签名请求的输出文件名

<Request Filename> is the output filename of the certificate signing request

例如,键入:

&GT; C:\ Openssl的\ BIN \ openssl.exe REQ -new -key my_key.key退房手续my_request.csr -config C:\ Openssl的\ BIN \ openssl.cnf中

3。按照屏幕上的提示输入所需的证书请求信息。

4。生成基于请求自签名公共证书

&GT; C:\ Openssl的\ BIN \ openssl.exe X509 -req -days 3650 -in&lt;请求的文件名和GT; -signkey&LT;密钥文件名&GT;退房手续&LT;证书文件名&GT;

其中:

&lt;请求的文件名和GT; 是证书签名请求的输入文件名

<Request Filename> is the input filename of the certificate signing request

&LT;密钥文件名&GT; 是$ P $的输入文件名pviously生成的私钥

<Key Filename> is the input filename of the previously generated private key

&LT;证书文件名&GT; 是公证书的输出文件名

<Certificate Filename> is the output filename of the public certificate

例如,键入:

&GT; C:\ Openssl的\ BIN \ openssl.exe X509 -req -days 3650 -in my_request.csr -signkey my_key.key退房手续my_cert.crt

5。生成PKCS#12文件:

&GT; C:\ Openssl的\ BIN \ openssl.exe PKCS12 -keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-3DES -export -in&LT;公证书文件名和GT; -inkey&LT;私有密钥文件名&GT;退房手续&LT; PKCS#12名&GT; -name&lt;显示名称&gt;

其中:

&LT;公共证书文件名和GT; 是公证书的输入文件名,在PEM格式

<Public Certificate Filename> is the input filename of the public certificate, in PEM format

&LT;私有密钥文件名&GT; 是私有密钥的输入文件名

<Private Key Filename> is the input filename of the private key

&LT; PKCS#12名&GT; 是PKCS#12格式文件的输出文件名

<PKCS#12 Filename> is the output filename of the pkcs#12 format file

&lt;显示名称&gt; 的是,有时会显示在用户界面所需的名称

<Display Name> is the desired name that will sometimes be displayed in user interfaces.

例如,键入:

&GT; C:\ Openssl的\ BIN \ openssl.exe PKCS12 -keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-3DES -export -in my_cert.crt -inkey my_key.key退房手续my_pkcs12.pfx -name我的名

6。 (可选)删除不需要的文件。

在这一点上,你只需要PKCS#12格式文件,这样你就可以删除该证书签名请求( .csr文件)的文件,私钥( .KEY )的文件,以及公证书(<$ C C $> .CRT )的文件。

At this point, you only need the PKCS#12 format file, so you can delete the certificate signing request (.csr) file, the private key (.key) file, and the public certificate (.crt) file.

生成的PKCS#12格式的文件,现在可以安全的FTP服务器中使用 - FIPS

The resulting PKCS#12 format file may now be used within Secure FTP Server - FIPS.

生成的PKCS#12格式(.PFX)文件现在可以使用版本34.0.5 Firefox浏览器。

The resulting PKCS#12 format (.pfx) file may now be used with the Firefox browser ver 34.0.5.

这篇关于通过OpenSSL的我的Andr​​oid应用自签名证书在Windows中创建PKCS#12文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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