Appendix A. Managing certificates
Appendix A. Managing certificates A.1. Installing certificate authority certificates SSL/TLS authentication relies on digital certificates issued by trusted Certificate Authorities (CAs). When an SSL/TLS connection is established by a client, the AMQP peer sends a server certificate to the client. This server certificate must be signed by one of the CAs in the client's Trusted Root Certification Authorities certificate store. If the user is creating self-signed certificates for use by Red Hat AMQ Broker, then the user must create a CA to sign the certificates. Then the user can enable the client SSL/TLS handshake by installing the self-signed CA file ca.crt . From an administrator command prompt, run the MMC Certificate Manager plugin, certmgr.msc . Expand the Trusted Root Certification Authorities folder on the left to expose Certificates . Right-click Certificates and select All Tasks and then Import . Click . Browse to select file ca.crt . Click . Select Place all certificates in the following store . Select certificate store Trusted Root Certification Authorities . Click . Click Finish . For more information about installing certificates, see Managing Microsoft Certificate Services and SSL . A.2. Installing client certificates In order to use SSL/TLS and client certficates, the certificates with the client's private keys must be imported into the proper certificate store on the client system. From an administrator command prompt, run the MMC Certificate Manager plugin, certmgr.msc . Expand the Personal folder on the left to expose Certificates . Right-click Certificates and select All Tasks and then Import . Click . Click Browse . In the file type pulldown, select Personal Information Exchange (\.pfx;*.p12) . Select file client.p12 and click Open . Click . Enter the password for the private key password field. Accept the default import options. Click . Select Place all certificates in the following store . Select certificate store Personal . Click . Click Finish . A.3. Hello World using client certificates Before a client will return a certificate to the broker, the AMQ .NET library must be told which certificates to use. The client certificate file client.crt is added to the list of certificates to be used during SChannel connection startup. In this example, certfile is the full path to the client.p12 certificate installed in the Personal certificate store. A complete example is found in HelloWorld-client-certs.cs . This source file and the supporting project files are available in the SDK.
factory.SSL.ClientCertificates.Add( X509Certificate.CreateFromCertFile(certfile) );