5 java code example, Prerequisites – HP OneView User Manual

Page 191

Advertising
background image

NOTE:

.Net C# code example 2 (Microsoft Windows certificate store) is referencing the Trusted

Root Certificate Authorities

store, located under Local Computer.

StoreName.Root

= Trusted Root Certificate Authorities

StortLocation.LocalMachine

= Local Computer

26.5 Java code example

The Java code example shows how to connect and subscribe to the SCMB.

Prerequisites

1.

Download the client certificate and private key.

GET /rest/certificates/client/rabbitmq/keypair/default

2.

Save the contents of the client certificate in the response body into a text file named
default-client.crt

.

You must copy and paste everything from -----BEGIN CERTIFICATE----- to -----END
CERTIFICATE-----

, including the dashes, but not including the quotes.

3.

Save the contents of the private key in the response body into a text file named
default-client.key

.

You must copy and paste everything from -----BEGIN RSA PRIVATE KEY----- to
-----END RSA PRIVATE KEY-----

, including the dashes, but not including the quotes.

4.

Create a PKCS12 keystore from the private key and the public certificate.

openssl pkcs12 -export -name myclientcert -in default-client.crt -inkey default-client.key -out myclient.p12

5.

Convert the PKCS12 keystore into a JKS keystore.

keytool -importkeystore -destkeystore c:\\MyKeyStore -srckeystore myclient.p12 -srcstoretype pkcs12 -alias
myclient

26.5 Java code example

191

Advertising