如何创建keystore.jks以及创建private.der和public.der证书文件- [英] How to create keystore.jks and create private.der and public.der cert file -

查看:504
本文介绍了如何创建keystore.jks以及创建private.der和public.der证书文件-的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在我的Angular Spring MVC应用程序中实现基于令牌的身份验证 (Nimbus JOSE+JWT).我还想实现基于RSA的密钥库工具,并具有基于私有"和公共"密钥的身份验证来标识客户端.我该怎么办?

I am looking to implement token based authentication (Nimbus JOSE+JWT) in my Angular Spring MVC Application. I also wanted to implement the RSA based keystore tool and to have a 'Private' and 'public' key based authentication to identify the client. How can I do that ?

我只需要执行以下步骤:

I simply need to do the following steps:

1) Create a .keystore
2) Generate private.der cert file
3) Generate public.der cert file. 

我知道如何从以下链接加载私钥和公钥:加载RSA公有文件中的密钥(来自JavaHelper的答案),但是我可以继续吗?

I know how to load the private and public key from the link : Load RSA public key from file (answer from JavaHelper), But can I proceed for this ?

推荐答案

如果需要从以下链接下载 openssl :

If need to download the openssl from the link: https://code.google.com/archive/p/openssl-for-windows/downloads. Download .zip file and extract into the any location. Go to that location till in my case its C:\openssl-0.9.8k_X64\bin.

根据每个链接: https: //rietta.com/blog/2012/01/27/openssl-generating-rsa-key-from-command/,您需要执行以下命令:

As per link : https://rietta.com/blog/2012/01/27/openssl-generating-rsa-key-from-command/, you need to execute the following command:

您可以像这样生成公用和专用RSA密钥对:

openssl genrsa -des3 -out private.pem 2048

这将生成2048位RSA密钥对,并使用您提供的密码对其进行加密,然后将其写入文件.接下来,您需要提取公钥文件.例如,您将在Web服务器上使用它来加密内容,以便只能使用私钥对其进行读取.

根据每个链接: https://www.openssl.org/docs /manmaster/apps/pkcs8.html https://superuser.com/questions/606215/openssl-pkcs8-default-format-gives-rsa-private-key

读取DER未加密的PKCS#8格式私钥:

openssl pkcs8 -topk8 -inform pem -in file.key -outform pem -nocrypt -out file.pem

并按如下所示创建公钥

openssl rsa -in key.pem -pubout -out pubkey.pem

完成了!

这篇关于如何创建keystore.jks以及创建private.der和public.der证书文件-的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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