5.6.3.3. 为用户获取仅限加密的证书


本节论述了获取只使用加密的证书(使用现有用户签名证书签名的证书)的工作流:
注意
如果用户拥有多个用于不同使用情况的证书(在签名的情况下),用户必须首先获取签名证书。用户拥有签名证书后,就可以使用它进行 概念验证,而无需设置并依赖 CMC 共享 Secret 机制。
有关获取用户的第一个签名证书的详情,请参考 第 5.6.3.2 节 “获取用户的第一个签名证书”
作为用户:
  1. 使用存储在网络安全服务(NSS)数据库中或包含用户签名证书和密钥的智能卡中的加密令牌。
  2. 以 PKCS #10 或 CRMF 格式生成 CSR。
    注意
    如果需要密钥归档,请使用 CRMF 格式。
  3. 生成 CMC 请求。
    由于这是仅加密的证书,因此私钥无法签名。因此,不包括概念验证(POP)。因此,注册需要两个步骤:如果初始请求成功,则以 EncryptedPOP 控制形式生成 CMC 状态。然后,用户使用响应并生成包含 DecryptedPOP 控制的 CMC 请求,并在第二步提交它。
    1. 对于第一步,除了默认参数外,用户还必须在传递到 CMCRequest 工具的配置文件中设置以下参数:
      • identification.enable
      • witness.sharedSecret
      • identityProofV2.enable
      • identityProofV2.hashAlg
      • identityProofV2.macAlg
      • popLinkWitnessV2.enable (CA 需要)
      • popLinkWitnessV2.keyGenAlg (CA 需要)
      • popLinkWitnessV2.macAlg (如果需要)
      • request.privKeyId
      详情请查看 CMCRequest(1) man page。
      响应包含:
      • CMC 加密 POP 控制
      • 使用 POP 所需 错误进行 CMCStatusInfoV2 控制
      • 请求 ID
    2. 对于第二个步骤,除了默认参数外,用户还必须在传递到 CMCRequest 工具的配置文件中设置以下参数:
      • decryptedPop.enable
      • encryptedPopResponseFile
      • decryptedPopRequestFile
      • request.privKeyId
      详情请查看 CMCRequest(1) man page。
5.6.3.3.1. 使用密钥 Archival 的只加密证书示例
要执行密钥存档的注册,生成 CMC 请求,该请求包含在 CRMF 请求中包含该用户的加密私钥。以下流程假设该用户已经拥有了签名证书。此签名证书的 nickname 在流程中的配置文件中设置。
注意
以下步骤描述了两个条带的提示与加密密钥一起使用,该密钥无法用于签名。如果您使用可签署证书的密钥,请将 -q POP_SUCCESS 选项而不是 -q POP_NONE 传递给 single-trip 的 CRMFPopClient 实用程序。
  1. 搜索 KRA 传输证书。例如:
    $ pki cert-find --name KRA_transport_certificate_subject_CN
  2. 使用您在上一步中检索的 KRA 传输证书的序列号,将证书存储在文件中。例如,要在 /home/user_name/kra.cert 文件中存储带有 12345 序列号的证书:
    $ pki cert-show 12345 --output /home/user_name/kra.cert
  3. 使用 CRMFPopClient 实用程序:
    • 使用密钥归档创建 CSR:
      1. 进入请求证书的用户或实体的证书数据库目录,例如:
        $ cd /home/user_name/
      2. 使用 CRMFPopClient 实用程序创建 CRMF 请求,其中 RSA 私钥由 KRA 传输证书包装。例如,将请求存储在 /home/user_name/crmf.req 文件中:
        $ CRMFPopClient -d . -p token_password -n subject_DN -q POP_NONE \
        		 -b /home/user_name/kra.cert -w "AES/CBC/PKCS5Padding" \
        		 -v -o /home/user_name/crmf.req
        记录命令显示的私钥的 ID。在第二个行的配置文件中,需要后续步骤中的 request.privKeyId 参数作为值。
  4. CRMRequest 实用程序创建一个配置文件,如 /home/user_name/cmc.cfg,其中包含以下内容:
    #numRequests: Total number of PKCS10 requests or CRMF requests.
    numRequests=1
    
    #input: full path for the PKCS10 request or CRMF request,
    #the content must be in Base-64 encoded format
    input=/home/user_name/crmf.req
    
    #output: full path for the CMC request in binary format
    output=/home/user_name/cmc.req
    
    #tokenname: name of token where agent signing cert can be found
    #(default is internal)
    tokenname=internal
    
    #nickname: nickname for user certificate which will be used
    #to sign the CMC full request.
    nickname=signing_certificate
    
    #dbdir: directory for cert8.db, key3.db and secmod.db
    dbdir=/home/user_name/.dogtag/nssdb/
    
    #password: password for cert8.db which stores the agent certificate
    password=password
    
    #format: request format, either pkcs10 or crmf
    format=crmf
  5. 创建 CMC 请求:
    $ CMCRequest /home/user_name/cmc.cfg
    如果命令成功,则 CMCRequest 程序会在请求配置文件的 output 参数中指定的文件中存储 CMC 请求。
  6. HttpClient 创建配置文件,如 /home/user_name/cmc-submit.cfg,您要在以后的步骤中使用该文件来向 CA 提交 CMC 请求。在创建的文件中添加以下内容:
    #host: host name for the http server
    host=server.example.com
    
    #port: port number
    port=8443
    
    #secure: true for secure connection, false for nonsecure connection
    secure=true
    
    #input: full path for the enrollment request, the content must be in
    #binary format
    input=/home/user_name/cmc.req
    
    #output: full path for the response in binary format
    output=/home/user_name/cmc-response_round_1.bin
    
    #tokenname: name of token where TLS client authentication cert can be found
    #(default is internal)
    #This parameter will be ignored if secure=false
    tokenname=internal
    
    #dbdir: directory for cert8.db, key3.db and secmod.db
    #This parameter will be ignored if secure=false
    dbdir=/home/user_name/.dogtag/nssdb/
    
    #clientmode: true for client authentication, false for no client authentication
    #This parameter will be ignored if secure=false
    clientmode=true
    
    #password: password for cert8.db
    #This parameter will be ignored if secure=false and clientauth=false
    password=password
    
    #nickname: nickname for client certificate
    #This parameter will be ignored if clientmode=false
    nickname=signing_certificate
    
    #servlet: servlet name
    servlet=/ca/ee/ca/profileSubmitUserSignedCMCFull?profileId=caFullCMCUserSignedCert
  7. 将 CMC 请求提交到 CA:
    $ HttpClient /home/user_name/cmc-submit.cfg
    如果命令成功,HTTPClient 程序会在配置文件的 output 参数中指定的文件中存储 CMC 响应。
  8. 通过将响应文件传递给 CMCResponse 实用程序来验证响应。例如:
    $ CMCResponse -d /home/user_name/.dogtag/nssdb/ -i /home/user_name/cmc-response_round_1.bin
    如果第一个条带成功,CMCResponse 会显示类似如下的输出:
    Certificates:
    		Certificate:
    				Data:
    						Version:  v3
    						Serial Number: 0x1
    						Signature Algorithm: SHA256withRSA - 1.2.840.113549.1.1.11
    						Issuer: CN=CA Signing Certificate,OU=pki-tomcat,O=unknown00262DFC6A5E Security Domain
    						Validity:
    								Not Before: Wednesday, May 17, 2017 6:06:50 PM PDT America/Los_Angeles
    								Not  After: Sunday, May 17, 2037 6:06:50 PM PDT America/Los_Angeles
    						Subject: CN=CA Signing Certificate,OU=pki-tomcat,O=unknown00262DFC6A5E Security Domain
    ...
    Number of controls is 3
    Control #0: CMC encrypted POP
    	 OID: {1 3 6 1 5 5 7 7 9}
    		 encryptedPOP decoded
    Control #1: CMCStatusInfoV2
    	 OID: {1 3 6 1 5 5 7 7 25}
    	 BodyList: 1
    	 OtherInfo type: FAIL
    		 failInfo=POP required
    Control #2: CMC ResponseInfo
    	 requestID: 15
  9. 对于第二个条带,为 Decrypt edPOP 创建配置文件,如 /home/user_name/cmc_DecryptedPOP.cfg,您要在以后的步骤中使用。在创建的文件中添加以下内容:
    #numRequests: Total number of PKCS10 requests or CRMF requests.
    numRequests=1
    
    #input: full path for the PKCS10 request or CRMF request,
    #the content must be in Base-64 encoded format
    #this field is actually unused in 2nd trip
    input=/home/user_name/crmf.req
    
    #output: full path for the CMC request in binary format
    #this field is actually unused in 2nd trip
    output=/home/user_name/cmc2.req
    
    #tokenname: name of token where agent signing cert can be found
    #(default is internal)
    tokenname=internal
    
    #nickname: nickname for agent certificate which will be used
    #to sign the CMC full request.
    nickname=signing_certificate
    
    #dbdir: directory for cert8.db, key3.db and secmod.db
    dbdir=/home/user_name/.dogtag/nssdb/
    
    #password: password for cert8.db which stores the agent
    #certificate
    password=password
    
    #format: request format, either pkcs10 or crmf
    format=crmf
    
    decryptedPop.enable=true
    encryptedPopResponseFile=/home/user_name/cmc-response_round_1.bin
    request.privKeyId=-25aa0a8aad395ebac7e6a19c364f0dcb5350cfef
    decryptedPopRequestFile=/home/user_name/cmc.DecryptedPOP.req
  10. 创建 DecryptPOP CMC 请求:
    $ CMCRequest /home/user_name/cmc.DecryptedPOP.cfg
    如果命令成功,CM CRequest 程序会在请求配置文件的 decryptedPopRequestFile 参数中指定的文件中存储 CMC 请求。
  11. HttpClient 创建配置文件,如 /home/user_name/decrypted_POP_cmc-submit.cfg,您可以使用该文件来向 CA 提交 DecryptedPOP CMC 请求。在创建的文件中添加以下内容:
    #host: host name for the http server
    host=server.example.com
    
    #port: port number
    port=8443
    
    #secure: true for secure connection, false for nonsecure connection
    secure=true
    
    #input: full path for the enrollment request, the content must be in binary format
    input=/home/user_name/cmc.DecryptedPOP.req
    
    #output: full path for the response in binary format
    output=/home/user_name/cmc-response_round_2.bin
    
    #tokenname: name of token where TLS client authentication cert can be found (default is internal)
    #This parameter will be ignored if secure=false
    tokenname=internal
    
    #dbdir: directory for cert8.db, key3.db and secmod.db
    #This parameter will be ignored if secure=false
    dbdir=/home/user_name/.dogtag/nssdb/
    
    #clientmode: true for client authentication, false for no client authentication
    #This parameter will be ignored if secure=false
    clientmode=true
    
    #password: password for cert8.db
    #This parameter will be ignored if secure=false and clientauth=false
    password=password
    
    #nickname: nickname for client certificate
    #This parameter will be ignored if clientmode=false
    nickname=singing_certificate
    
    #servlet: servlet name
    servlet=/ca/ee/ca/profileSubmitUserSignedCMCFull?profileId=caFullCMCUserCert
  12. DecryptedPOP CMC 请求提交到 CA:
    $ HttpClient /home/user_name/decrypted_POP_cmc-submit.cfg
    如果命令成功,HTTPClient 程序会在配置文件的 output 参数中指定的文件中存储 CMC 响应。
  13. 要将 CMC 响应转换为 PKCS #7 证书链,将 CMC 响应文件传递给 CMCResponse 工具的 -i 参数。例如:
    $ CMCResponse -i /home/user_name/cmc-response_round_2.bin -o /home/user_name/certs.p7
    另外,要以 PEM 格式显示各个证书,请将 -v 传递给 实用程序。
    如果第二个条带成功,则 CMCResponse 会显示类似如下的输出:
    Certificates:
    		Certificate:
    				Data:
    						Version:  v3
    						Serial Number: 0x2D
    						Signature Algorithm: SHA256withRSA - 1.2.840.113549.1.1.11
    						Issuer: CN=CA Signing Certificate,OU=pki-tomcat,O=unknown00262DFC6A5E Security Domain
    						Validity:
    								Not Before: Thursday, June 15, 2017 3:43:45 PM PDT America/Los_Angeles
    								Not  After: Tuesday, December 12, 2017 3:43:45 PM PST America/Los_Angeles
    						Subject: CN=user_name,UID=example,OU=keyArchivalExample
    ...
    Number of controls is 1
    Control #0: CMCStatusInfo
    	 OID: {1 3 6 1 5 5 7 7 1}
    	 BodyList: 1
    	 Status: SUCCESS
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.