jks

How do I import an existing Java keystore (.jks) file into a Java installation?

≡放荡痞女 提交于 2020-06-22 04:56:28
问题 So, I am having trouble with LDAP. I have an integration test case that hopefully will work out, but it is currently running into LDAPS security issues with the SSL handshake. I am able to connect to the LDAPS with Apache Directory Studio, and it has downloaded the keystore into a file "permanent.jks". That's ok, but I want my integration test, which resides in Eclipse using a JRE, to be able to connect to the LDAP server using this keystore. How can I take this keystore and import it into

Convert jks to p12 in Java

蹲街弑〆低调 提交于 2020-04-30 11:08:28
问题 Instead of using keytool in cmd or openssl, I want to convert a jks file to a p12 file in Java. My code so far is this: KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); char[] password = "lol".toCharArray(); ks.load(null, password); FileOutputStream fos = new FileOutputStream("C:\\Users\\Antonio\\Desktop\\jkstest\\test.jks"); ks.store(fos, password); fos.close(); Thats how I create a jks file. But I did not find any information about how to convert it to anything. Who does know

Convert jks to p12 in Java

风格不统一 提交于 2020-04-30 11:07:30
问题 Instead of using keytool in cmd or openssl, I want to convert a jks file to a p12 file in Java. My code so far is this: KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); char[] password = "lol".toCharArray(); ks.load(null, password); FileOutputStream fos = new FileOutputStream("C:\\Users\\Antonio\\Desktop\\jkstest\\test.jks"); ks.store(fos, password); fos.close(); Thats how I create a jks file. But I did not find any information about how to convert it to anything. Who does know

Tomcat9配置https链接

谁都会走 提交于 2020-03-23 14:51:56
Tomcat版本:apache-tomcat-9.0.27 jdk版本:1.8.0_212 浏览器:火狐 1. 生成证书 https协议需要证书,开发时我们可以使用jdk自带的keytool工具生成一个证书来进行测试; 首先确保本地有jdk的环境,可以使用java -version来查看,然后运行以下代码,姓氏名称什么的随便填写即可. keytool -genkeypair -alias testKey -keyalg RSA -storepass 123456 -keyalg RSA -keysize 2048 -validity 3650 -keystore ./testKey.jks <!-- -alias testKey:证书项的名字,必填项 -keyalg RSA:证书签名算法,tomcat建议RSA -storepass 123456:密钥库密码,也就是等下要生成的test.keystore的访问密码,妥善保管 -validity 3650:证书有效期,3650天,即10年 -keystore ./testKey.jks:要生成的文件的位置,./test.keystore表示存储在当前目录下 --> 然后我们可以看到有提示信息,运行提示信息里面的代码 keytool -importkeystore -srckeystore ./testKey.jks

https客户端遇到过的问题

不羁岁月 提交于 2020-03-14 14:34:56
  1、用.p12格式的证书,在windows上调试完全没问题,在Linux服务器上,提示无效证书格式。   解决方法:将.p12格式的证书转换为.jks格式的证书。   将.p12格式的证书转换为.jks格式的证书命令如下:   keytool -importkeystore -srckeystore Vfuchong_Tester.p12 -srcstoretype PKCS12 -destkeystore keystore2.jks -deststoretype JKS   参考:1、 http://blog.csdn.net/android_caishengyan/article/details/48267289      2、 https://www.cnblogs.com/got-my-way/p/6256306.html 来源: https://www.cnblogs.com/alsodzy/p/8512373.html

Spring Boot 如何同时支持 http 与 https 访问?

情到浓时终转凉″ 提交于 2020-03-01 16:47:27
原文链接: Spring Boot 如何同时支持 http 与 https 访问? ___ 大多数项目要么要求 https 协议来访问要么直接用 http 协议,但有些项目就是这么奇怪要求同时支持两种协议。 此示例中使用Spring Boot 内置的 tomcat 服务器,我拿到的 SSL 证书是 crt 类型的。所有首先需要将证书转成 jks 类型的。 crt 转 jks # 转p12 openssl pkcs12 -export -out keystore.pkcs12 -inkey nexus.key -in nexus.crt # 这里需要设置密码 # 再将p12格式文件转为.jks格式: keytool -v -importkeystore -srckeystore keystore.pkcs12 -srcstoretype PKCS12 -destkeystore keystore.jks -deststoretype JKS # 输入上步设置的密码并设置新密码 可以和上一步一样的密码 Windows 系统需要安装 openssl 后才可以执行上述命令。 安装 将生成的 jks 文件放到项目的 resource 目录下,开始配置 application.yml 文件。 server: port: 8888 custom: # http 端口 httpPort: 9999

SpringBoot配置ssl证书,配置HTTPS,并实现HTTP访问自动转HTTPS访问

独自空忆成欢 提交于 2020-02-14 00:30:38
Spring Boot配置ssl证书 两种创建证书方式, 一种是权威证书,一种是jdk自带的keytools创建证书 一、申请有权威的SSL证书 在各大云服务商都可以申请到SSL官方证书。 我这里是在阿里云上申请的,申请后下载,如图: 解压。如图: 二、用JDK中keytool是一个证书管理工具,压缩成tomcat所支持的.jks 2、打开dos命令框(命令提示符) 2.1、进入JDK所在的盘符,我的是D盘 2.2、进入JDK下的bin目录 2.3、输入这条命令(输入之前先修改:C:\Users\Administrator\Desktop\SpringBootDemo\gafdzs.pfx 部分是你下载的证书pfx所在路径,yjj2.jks 是自己命名的jks文件) keytool -importkeystore -srckeystore C:\Users\Administrator\Desktop\SpringBootDemo\gafdzs.pfx -destkeystore yjj2.jks -srcstoretype PKCS12 -deststoretype JKS 2.4、输入密码,三次输入的密码都要和解压的证书里密码一致,不一致有可能出错。 2.5、记下别名:alias 2.6、在bin目录下找到 jks文件(复制到项目的application

PFX to JKS keytool conversion: Alias <*> does not exist

馋奶兔 提交于 2020-02-13 08:36:08
问题 I'm trying to convert x.PFX file to x.JKS file using keytool but I am getting following error: keytool error: java.lang.Exception: Alias <2> does not exist Actions that preceded this error are: Listing x.PFX file content (just to read alias name): keytool -v -list -storetype pkcs12 -keystore x.pfx Enter keystore password: x Keystore type: PKCS12 Keystore provider: SunJSSE Your keystore contains 1 entry Alias name: 2 Creation date: 11-nov-2012 Entry type: PrivateKeyEntry Certificate chain

PFX to JKS keytool conversion: Alias <*> does not exist

倖福魔咒の 提交于 2020-02-13 08:36:01
问题 I'm trying to convert x.PFX file to x.JKS file using keytool but I am getting following error: keytool error: java.lang.Exception: Alias <2> does not exist Actions that preceded this error are: Listing x.PFX file content (just to read alias name): keytool -v -list -storetype pkcs12 -keystore x.pfx Enter keystore password: x Keystore type: PKCS12 Keystore provider: SunJSSE Your keystore contains 1 entry Alias name: 2 Creation date: 11-nov-2012 Entry type: PrivateKeyEntry Certificate chain

tls/ssl证书生成和格式转换

末鹿安然 提交于 2020-02-07 02:52:49
生成密钥: openssl genrsa -out privkey.pem 2048 生成csr申请文件: openssl req -sha256 -new -key privkey.pem -out pubkey.pem 生成自签名证书: openssl x509 -req -days 365 -in my.csr -signkey my.key -out my.crt 转换为pfx格式: openssl pkcs12 -export -out my.pfx -inkey my.key -in my.pem PKCS7 转 PEM: openssl pkcs7 -print_certs -in my.cer -out my.pem JKS 转 PKCS12: keytool -importkeystore -srckeystore my.jks -destkeystore my.p12 -srcstoretype JKS -deststoretype PKCS12 -srcstorepass passwordText -deststorepass passwordText -srcalias aliasText -destalias aliasText -srckeypass passwordText -destkeypass passwordText -noprompt