keytool

Java's keytool command with IP addresses

我只是一个虾纸丫 提交于 2019-12-01 10:54:18
I'm trying to get an image via an https URL, and am having some problems. I generate a keystore with Java's keytool command. If I specify the common name (CN) equal to my hostname, such as CN=JONMORRA, and then try to query via my hostname, such as https://JONMORRA:8443/ then it works fine. However, if I specify the common name as my ip address, such that CN=192.168.56.1, and try to query via my ip address, such as https://192.168.56.1:8443/ then I get an error HTTPS hostname wrong: should be <192.168.56.1> Which is stating that my hostname is wrong, even though that's what I specified in the

Mismatch in keytool and openssl certificate fingerprint

时光毁灭记忆、已成空白 提交于 2019-12-01 09:07:30
I was trying to fingerprint android developer certificates, inside META-INF/, for research purposes. I'm finding certain scenarios in which output from keytool and openssl would give me different SHA1 fingerprints for the same certificate: Using keytool: keytool -princert -file META-INF/CERT.RSA ... SHA1: 9D:17:FB:AB:67:BB:D0:7B:12:FE:E8:33:7D:66:F1:C4:2B:03:BD:F7 ... Using openssl: openssl pkcs7 -inform DER -in META-INF/CERT.RSA -print_certs -out CERT.cert openssl x509 -in CERT.cert -fingerprint -noout SHA1 Fingerprint=80:D5:CD:66:6E:44:75:62:A8:B3:7E:5D:AC:00:DE:1D:FF:6B:E6:CA Is this normal

Java's keytool command with IP addresses

允我心安 提交于 2019-12-01 08:56:14
问题 I'm trying to get an image via an https URL, and am having some problems. I generate a keystore with Java's keytool command. If I specify the common name (CN) equal to my hostname, such as CN=JONMORRA, and then try to query via my hostname, such as https://JONMORRA:8443/ then it works fine. However, if I specify the common name as my ip address, such that CN=192.168.56.1, and try to query via my ip address, such as https://192.168.56.1:8443/ then I get an error HTTPS hostname wrong: should be

java keytool证书工具使用小结

眉间皱痕 提交于 2019-12-01 06:53:27
Keytool 是一个Java数据证书的管理工具 ,Keytool将密钥(key)和证书(certificates)存在一个称为keystore的文件中在keystore里,包含两种数据:密钥实体(Key entity)-密钥(secret key)或者是私钥和配对公钥(采用非对称加密)可信任的证书实体(trusted certificate entries)-只包含公钥. JDK中keytool常用参数说明( 不同版本有差异,详细可参见【附录】中的官方文档链接 ): -genkey 在用户主目录中创建一个默认文件”.keystore”,还会产生一个mykey的别名,mykey中包含用户的公钥、私钥和证书(在没有指定生成位置的情况下,keystore会存在用户系统默认目录) -alias 产生别名 每个keystore都关联这一个独一无二的alias,这个alias通常不区分大小写 -keystore 指定密钥库的名称(产生的各类信息将不在.keystore文件中) -keyalg 指定密钥的算法 (如 RSA DSA,默认值为:DSA) -validity 指定创建的证书有效期多少天(默认 90) -keysize 指定密钥长度 (默认 1024) -storepass 指定密钥库的密码(获取keystore信息所需的密码) -keypass 指定别名条目的密码(私钥的密码)

Android版Https客户端与服务端的双向证书实现

爷,独闯天下 提交于 2019-12-01 06:53:15
最近开发的时候遇到Https协议的问题 因为项目用的是Volley来进行http请求,但是使用Volley之后,发现他并不支持Https请求。 查看源码: if(VERSION.SDK_INT >= 9) { stack = new HurlStack(); } else { stack = new HttpClientStack(AndroidHttpClient.newInstance(userAgent)); } 从源码中我们可以看出来执行网络请求的关键类Httpstack初始化在主流版本API大于9的时候是以new HurlStack()的方式初始化 而当我们进入HurlStack.class HurlStack() { ((HurlStack.UrlRewriter))} HurlStack(HurlStack.UrlRewriter urlRewriter) { (urlRewriter(SSLSocketFactory))} HurlStack(HurlStack.UrlRewriter urlRewriterSSLSocketFactory sslSocketFactory) { .mUrlRewriter = urlRewriter.mSslSocketFactory = sslSocketFactory }

Mismatch in keytool and openssl certificate fingerprint

故事扮演 提交于 2019-12-01 06:12:16
问题 I was trying to fingerprint android developer certificates, inside META-INF/, for research purposes. I'm finding certain scenarios in which output from keytool and openssl would give me different SHA1 fingerprints for the same certificate: Using keytool: keytool -princert -file META-INF/CERT.RSA ... SHA1: 9D:17:FB:AB:67:BB:D0:7B:12:FE:E8:33:7D:66:F1:C4:2B:03:BD:F7 ... Using openssl: openssl pkcs7 -inform DER -in META-INF/CERT.RSA -print_certs -out CERT.cert openssl x509 -in CERT.cert

Java keyTool - append primary/secondary intermediate certificates to key store [closed]

这一生的挚爱 提交于 2019-12-01 05:35:42
I have already created a keystore (server.jks in the image) having imported the relevant key-pair. keytool -importkeystore -srckeystore server.p12 -destkeystore server.jks -srcstoretype pkcs12 I need to append intermediate certificates to it using the java keytool. Using KeyStore explorer tool on windows, I can append certificates following the right click context menu, just like in the attached image. After adding the primary/intermediate certificates following the Append Certificate option, I can see it on the KeyStore explorer like a tree. ---primary intermediate certificate |---secondary

keytool can't find alias

大憨熊 提交于 2019-12-01 03:47:42
I've got a pfx certificate that I need to reference by alias. The problem is that keytool can't find that alias, even though it shows on the list. keytool -list -keystore temp.pfx -storetype pkcs12 gives me this: ... 0c5fc7cef279ca390acd2d6bac9ffcf8_ba0cbbb3-323d-4394-8e76-47838adb2a9c, 08/03/2013, PrivateKeyEntry, ... But whenever I try to use keytool to do anything with that alias (i.e., export, rename), it gives me an error: keytool error: java.lang.Exception: Alias <0c5fc7cef279ca390acd2d6bac9ffcf8_ba0cbbb3-323d-4394-8e76-47838adb2a9c> does not exist Any ideas? It turns out that after

javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present

左心房为你撑大大i 提交于 2019-12-01 00:58:31
Basically, I have a Test server (Linux based) with a public IP bot no public hostname. So I am trying to create ssl certificates for it using IP address. So that my Java application can access another application using the IP address: For example like: https://210.10.10.10:8443/abc I followed below post: How are SSL certificate server names resolved/Can I add alternative names using keytool? I did try both the ways as suggested to avoid this exception but non is working. I am getting the same error. I tried Editing the "openssl.cnf" and adding the : [req] req_extensions = v3_req [ v3_req ] #

Keystore does not work on Java 9

倖福魔咒の 提交于 2019-11-30 22:30:32
I've converted a JKS keystore to the P12 format using portecle, but it probably didn't go well. The keystore works with Java 8 (various versions), but with Java 9 (OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode), I'm getting java.io.IOException: Invalid keystore format at sun.security.provider.JavaKeyStore.engineLoad(java.base@9-internal/JavaKeyStore.java:659) at sun.security.util.KeyStoreDelegator.engineLoad(java.base@9-internal/KeyStoreDelegator.java:219) at java.security.KeyStore.load(java.base@9-internal/KeyStore.java:1466) at org.eclipse.jetty.util