4.1.3 Certificate Management for Certificate-based Authentication Using SOAP

The Utilities API significantly includes a set of methods that allow you to manage certificate generation and registration within Oracle VM Manager. This is important as the WS-API also allows for certificate-based authentication, allowing you to further secure how custom-developed applications authenticate and interact with Oracle VM Manager. This section explores some of these methods briefly in the context of the SOAP API.

Certificate management within Oracle VM Manager is discussed in a variety of contexts throughout the documentation. For more information on authenticating using an SSL certificate using SOAP, please see Section 3.5.1, “Authenticating”. Please also refer to Setting up SSL on Oracle VM Manager in the Oracle VM Administrator's Guide for more information on SSL certificate management.

How to Obtain the CA Certificate Using SOAP

Once authenticated, either using an existing SSL certificate, or by using the API login method, it is possible to query the Utility API endpoint to obtain the internal Oracle VM Manager CA certificate. This is achieved using the certificateGetCaCertificate() method. This method simply returns the CA certificate as a string.

It is useful to obtain the CA certificate and to add it to your trusted certificates or to your keystore, so that it can be used to validate SSL interactions with Oracle VM Manager.

How to Sign and Register a Certificate Using SOAP

The API provides options to sign and register an SSL certificate using the internal Oracle VM Manager CA certificate. There are equally options to only sign a certificate, or to register an already signed certificate. This can be useful if you have added a trusted third-party CA certificate to Oracle VM Manager's own truststore, and wish to use a certificate issued by that third-party. These additional API methods are discussed in the API documentation. In this case, we assume that you need to sign and register a certificate with the internal CA.

The Utilities API provides a certificateSignAndRegister() method that can be used for this purpose. The method can either take a certificate that you have generated locally and sign and register it for use with Oracle VM Manager; or if called without any argument, can automatically generate the certificate with a passphraseless key before signing and registering it for use with Oracle VM Manager. For security reasons, it is usually more sensible to generate your certificate locally and set a passphrase for the key, before calling this method. If using Java, you can do this by setting up a keystore using the keytool:

$ keytool -genkey

Once you have set up a keystore and certificate, you can use the keytool to export your certificate in PEM format, so that you have it available for signing:

$ keytool -export -rfc

In your web services client, you must create a new LoginCertificate object and place your new certificate into the certificate field. For example:

LoginCertificate cert = new LoginCertificate();
cert.setCertificate("-----BEGIN CERTIFICATE-----" +
    "MIIDTzCCAw2gAwIBAgIEIIUUWjALBgcqhkjOOAQDBQAweTELMAkGA1U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44" +
    "BAMFAAMvADAsAhRTm5NW8HDcM8jG5a7QIowNLN+fEQIUZXMogTvKbcXu6NN6fh0KY09hokI=" +
    "-----END CERTIFICATE-----");

Now you can invoke the method to sign and register your certificate, this returns the signed version of the certificate:

LoginCertificate signed = ovmUtil.certificateSignAndRegister(cert);
System.out.println(signed.getCertificate());

The output returned contains the newly signed certificate. You can dump this output to file, so that you can use it to import the newly signed certificate into your keystore:

$ keytool -import -file newcert

Note that you should also import the CA certificate into your keystore, so that your certificates can be validated. Be sure to use a different alias when importing the CA certificate into your keystore, to avoid overwriting your newly signed certificate and key.