AEM使用公钥/私钥对与Adobe I/O和其他web服务进行安全通信。 本简短教程说明了如何使用openssl命令行工具生成兼容的键值和密钥库,该工具可同时用于AEM和Adobe I/O。
本指南创建自签名密钥,这些自签名密钥对于在较低环境中开发和使用非常有用。 在生产方案中,密钥通常由组织的IT安全团队生成和管理。
openssl命令行工具的req 命令可用于生成与Adobe I/O和Adobe Experience Manager兼容的键对。
$ openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout private.key -out certificate.crt
要完成openssl generate命令,请在请求时提供证书信息。 Adobe I/O和AEM不关心这些值是什么,但它们应该与保持一致,并描述您的键值。
Generating a 2048 bit RSA private key
...........................................................+++
...+++
writing new private key to 'private.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) []:US
State or Province Name (full name) []:CA
Locality Name (eg, city) []:San Jose
Organization Name (eg, company) []:Example Co
Organizational Unit Name (eg, section) []:Digital Marketing
Common Name (eg, fully qualified host name) []:com.example
Email Address []:me@example.com
密钥对可以添加到新的PKCS12密钥库。 在openssl’s pcks12 命令中,密钥库的名称(通过- caname
)、密钥的名称(通过-name
)和密钥库的密码(通过- passout
)。
将密钥库和密钥加载到AEM中时需要这些值。
$ openssl pkcs12 -export -caname my-keystore -in certificate.crt -name my-key -inkey private.key -out keystore.p12 -passout pass:my-password
此命令的输出是keystore.p12
文件。
my-keystore、my-key和my-password的参数值将替换为您自己的值。
Java keytool 命令行工具提供对密钥库的可见性,以确保密钥已成功加载到密钥库文件(keystore.p12)中。
$ keytool -keystore keystore.p12 -list
Enter keystore password: my-password
Keystore type: jks
Keystore provider: SUN
Your keystore contains 1 entry
my-key, Feb 5, 2019, PrivateKeyEntry,
Certificate fingerprint (SHA1): 7C:6C:25:BD:52:D3:3B:29:83:FD:A2:93:A8:53:91:6A:25:1F:2D:52
AEM使用生成的私钥与Adobe I/O和其他web服务进行安全通信。 要使AEM能够访问私钥,必须将其安装到AEM用户的密钥库中。
导航至AEM > 工具 > 安全 > 用户和编辑用户,私钥将与其关联。
具 > 安全 > 用户 >编辑用户中创建KeyStore
如果提示创建密钥库,请执行此操作。 此密钥库将仅存在于AEM中,并且不是通过openssl创建的密钥库。 密码可以是任何内容,并且不必与openssl命令中使用的密码相同。
> Keystore > 从keystore添加私钥
在用户的密钥库控制台中,单击从KeyStore文件添加私钥并添加以下信息:
-passout
密码。-name
令中为参数提供的值(即 my-key
)。-passout
密码。对于这两个输入,KeyStore文件密码和私钥密码是相同的。 输入不匹配的密码将导致无法导入密钥。
> Keystore中的私 钥
将私钥从提供的密钥库成功加载到AEM密钥库中后,私钥的元数据将显示在用户的密钥库控制台中。
必须将匹配的公钥上传到Adobe I/O,以允许AEM服务用户安全通信,该用户具有公钥的相应私钥。
创建Adobe I/O集成 >新 集成
在Adobe I/O中创建新集成需要上传公共证书。 上传由openssl req
命令生成的certificate.crt。
已安装的公钥及其过期日期列在Adobe I/O的Integrations控制台中。可通过Add a public key按钮添加多个公钥。
现在,AEM保留私钥,Adobe I/O集成保留相应的公钥,从而允许AEM与Adobe I/O安全通信。