Java Keytool 设置主机名
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2200088/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Keytool set hostname
提问by sixtyfootersdude
I am just attempting to use the java keytool but I cannot figure out how to set the hostname.
我只是尝试使用 java keytool,但我不知道如何设置主机名。
This is what is how I am attempting:
这就是我正在尝试的方式:
hostname[username:/this/is/a/path][640]% keytool -keystore server.keystore -genkeypair -alias hostname
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: hostname
What is the name of your organizational unit?
[Unknown]: hostname
What is the name of your organization?
[Unknown]: hostname
What is the name of your City or Locality?
[Unknown]: hostname
What is the name of your State or Province?
[Unknown]: hostname
What is the two-letter country code for this unit?
[Unknown]: CA
Is CN=hostname, OU=hostname, O=hostname, L=hostname, ST=hostname, C=CA correct?
[no]: yes
Enter key password for <hostname>
(RETURN if same as keystore password):
hostname[username:/this/is/a/path][641]%
Since I have set all fields to hostname can I assume that my hostname is set to hostname?
由于我已将所有字段设置为主机名,我可以假设我的主机名设置为主机名吗?
采纳答案by AJ.
CN=hostname - it's the first option you're being asked for here. It's confusing that keytool refers to it as "first and last name".
CN=hostname - 这是您在这里被要求的第一个选项。令人困惑的是,keytool 将其称为“名字和姓氏”。
回答by Pascal Thivent
According to the section 3.1 "Server Identity" of RFC 2818 "HTTP over TLS", a client is supposed to compare the CN (Common Name) portion of the subject DN (Distinguished Name) in the server certificate to the DNS host name in the URL.
根据RFC 2818“HTTP over TLS”的第 3.1 节“服务器身份” ,客户端应该将服务器证书中主题 DN(专有名称)的 CN(通用名称)部分与服务器证书中的 DNS 主机名进行比较。网址。
So use the Common Name (CN) for the hostname (the first question of the keytool).
所以使用通用名称 (CN) 作为主机名(keytool 的第一个问题)。