SSL connection support

Helix Server at release 2012.1 or higher supports 256-bit SSL connections and trust establishment by accepting the fingerprint of the SSL certificate’s public key.

Due to current US export control restrictions for some countries, the standard JDK package only comes with 128 bit encryption level cyphers. In order to use P4Java to connect to an SSL-enabled Helix Server, those living in eligible countries may download the unlimited strength JCE (Java Cryptography Extension) package and replace the current default cryptography jar files with the unlimited strength files. For more information about using P4Java with an SSL enable Helix Server, see https://community.perforce.com/s/article/2620.

To make a secure connection using P4Java, append ssl to the end of the P4Java protocol (for example, p4javassl://localhost:1667). For a new connection or a key change, you must also (re)establish trust using the IOptionsServer's addTrust method. For example:

// Create a P4Java SSL connection to a secure Perforce server
try {
  String serverUri = "p4javassl://localhost:1667";
  Properties props = null;
  IOptionsServer server = ServerFactory.getOptionsServer(serverUri,
                          props);

  // assume a new first time connection
  server.addTrust(new TrustOptions().setAutoAccept(true));

  // if all goes well...

  IOptionServerInfo serverInfo = server.getServerInfo();
} catch (P4JavaException e) {
  // process P4Java exception
} catch (Exception e) {
  // process other exception
}