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 > 工具 > 安全性 > 用户 和 编辑用户 私钥将与关联。
AEM > 工具 > 安全性 > 用户 >编辑用户
提示创建密钥库时,请执行此操作。 此密钥库仅存在于AEM中,而不是通过openssl创建的密钥库。 密码可以是任何内容,并且不必与 openssl 命令。
用户 > 密钥库 > 从密钥库添加私钥
在用户的密钥库控制台中,单击 添加私钥表单KeyStore文件 并添加以下信息:
-passout
参数。-name
参数(例如, my-key
)。-passout
参数。对于这两个输入,KeyStore文件密码和私钥密码是相同的。 输入不匹配的密码会导致无法导入密钥。
用户 > 密钥库
将私钥从提供的密钥库成功加载到AEM密钥库中后,私钥的元数据将显示在用户的密钥库控制台中。
必须将匹配的公钥上传到Adobe I/O,以允许AEM服务用户安全通信,该用户具有公钥的相应私钥。
创建Adobe I/O集成 > 新集成
在Adobe I/O中创建集成需要上传公共证书。 上传 certificate.crt 生成者 openssl req
命令。
已安装的公钥及其过期日期列在 集成 控制台Adobe I/O。可以通过 添加公钥 按钮。
现在,AEM保留私钥,Adobe I/O集成保留相应的公钥,从而允许AEM与Adobe I/O安全通信。