com.perforce.p4java.impl.mapbased.rpc.func.client
Class ClientTrust

java.lang.Object
  extended by com.perforce.p4java.impl.mapbased.rpc.func.client.ClientTrust

public class ClientTrust
extends Object

Handle the client trust and fingerprint for Perforce SSL connections.


Field Summary
static String CLIENT_TRUST_ADD_EXCEPTION_NEW_CONNECTION
           
static String CLIENT_TRUST_ADD_EXCEPTION_NEW_KEY
           
static String CLIENT_TRUST_ADDED
           
static String CLIENT_TRUST_ALREADY_ESTABLISHED
           
static String CLIENT_TRUST_EXCEPTION_NEW_CONNECTION
           
static String CLIENT_TRUST_EXCEPTION_NEW_KEY
           
static String CLIENT_TRUST_INSTALL_EXCEPTION
           
static String CLIENT_TRUST_MESSAGES
           
static String CLIENT_TRUST_REMOVED
           
static String CLIENT_TRUST_UNINSTALL_EXCEPTION
           
static String CLIENT_TRUST_WARNING_NEW_CONNECTION
           
static String CLIENT_TRUST_WARNING_NEW_KEY
           
static String CLIENT_TRUST_WARNING_NOT_ESTABLISHED
           
static String DIGEST_TYPE
           
static String FINGERPRINT_REPLACEMENT_USER_NAME
           
static String FINGERPRINT_USER_NAME
           
static char[] HEX_CHARS
           
 
Constructor Summary
ClientTrust(RpcServer rpcServer)
          Instantiates a new client trust.
 
Method Summary
static String convert2Hex(byte[] data)
          Convert a byte array to a hexadecimal string
 boolean fingerprintExists(String serverIpPort, String fingerprintUser)
          Check if the fingerprint exists for the specified server IP and port
 boolean fingerprintMatches(String serverIpPort, String fingerprintUser, String fingerprint)
          Check if the fingerprint for the specified server IP and port matches the one in trust file.
static String generateFingerprint(PublicKey publicKey)
          Generate fingerprint from public key using MessageDigest.
static String generateFingerprint(X509Certificate certificate)
          Generate fingerprint from a certificate using MessageDigest.
 PerforceMessages getMessages()
          Gets the messages.
 void installFingerprint(String serverIpPort, String fingerprintUser, String fingerprint)
          Install the fingerprint for the specified server IP and port
 void removeFingerprint(String serverIpPort, String fingerprintUser)
          Removes the fingerprint for the specified server IP and port
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIGEST_TYPE

public static final String DIGEST_TYPE
See Also:
Constant Field Values

HEX_CHARS

public static final char[] HEX_CHARS

FINGERPRINT_USER_NAME

public static final String FINGERPRINT_USER_NAME
See Also:
Constant Field Values

FINGERPRINT_REPLACEMENT_USER_NAME

public static final String FINGERPRINT_REPLACEMENT_USER_NAME
See Also:
Constant Field Values

CLIENT_TRUST_MESSAGES

public static final String CLIENT_TRUST_MESSAGES
See Also:
Constant Field Values

CLIENT_TRUST_WARNING_NOT_ESTABLISHED

public static final String CLIENT_TRUST_WARNING_NOT_ESTABLISHED
See Also:
Constant Field Values

CLIENT_TRUST_WARNING_NEW_CONNECTION

public static final String CLIENT_TRUST_WARNING_NEW_CONNECTION
See Also:
Constant Field Values

CLIENT_TRUST_WARNING_NEW_KEY

public static final String CLIENT_TRUST_WARNING_NEW_KEY
See Also:
Constant Field Values

CLIENT_TRUST_EXCEPTION_NEW_CONNECTION

public static final String CLIENT_TRUST_EXCEPTION_NEW_CONNECTION
See Also:
Constant Field Values

CLIENT_TRUST_EXCEPTION_NEW_KEY

public static final String CLIENT_TRUST_EXCEPTION_NEW_KEY
See Also:
Constant Field Values

CLIENT_TRUST_ADD_EXCEPTION_NEW_CONNECTION

public static final String CLIENT_TRUST_ADD_EXCEPTION_NEW_CONNECTION
See Also:
Constant Field Values

CLIENT_TRUST_ADD_EXCEPTION_NEW_KEY

public static final String CLIENT_TRUST_ADD_EXCEPTION_NEW_KEY
See Also:
Constant Field Values

CLIENT_TRUST_ADDED

public static final String CLIENT_TRUST_ADDED
See Also:
Constant Field Values

CLIENT_TRUST_REMOVED

public static final String CLIENT_TRUST_REMOVED
See Also:
Constant Field Values

CLIENT_TRUST_ALREADY_ESTABLISHED

public static final String CLIENT_TRUST_ALREADY_ESTABLISHED
See Also:
Constant Field Values

CLIENT_TRUST_INSTALL_EXCEPTION

public static final String CLIENT_TRUST_INSTALL_EXCEPTION
See Also:
Constant Field Values

CLIENT_TRUST_UNINSTALL_EXCEPTION

public static final String CLIENT_TRUST_UNINSTALL_EXCEPTION
See Also:
Constant Field Values
Constructor Detail

ClientTrust

public ClientTrust(RpcServer rpcServer)
Instantiates a new client trust.

Parameters:
rpcServer - the rpc server
Method Detail

installFingerprint

public void installFingerprint(String serverIpPort,
                               String fingerprintUser,
                               String fingerprint)
                        throws TrustException
Install the fingerprint for the specified server IP and port

Parameters:
serverIpPort - the serverIpPort
fingerprintUser - the fingerprintUser
fingerprint - the fingerprint
Throws:
TrustException - the trust exception

removeFingerprint

public void removeFingerprint(String serverIpPort,
                              String fingerprintUser)
                       throws TrustException
Removes the fingerprint for the specified server IP and port

Parameters:
serverIpPort - the serverIpPort
fingerprintUser - the fingerprintUser
Throws:
TrustException - the trust exception

fingerprintExists

public boolean fingerprintExists(String serverIpPort,
                                 String fingerprintUser)
Check if the fingerprint exists for the specified server IP and port

Parameters:
serverIpPort - the serverIpPort
fingerprintUser - the fingerprintUser
Returns:
true, if successful

fingerprintMatches

public boolean fingerprintMatches(String serverIpPort,
                                  String fingerprintUser,
                                  String fingerprint)
Check if the fingerprint for the specified server IP and port matches the one in trust file.

Parameters:
serverIpPort - the serverIpPort
fingerprintUser - the fingerprintUser
fingerprint - the fingerprint
Returns:
true, if successful

generateFingerprint

public static String generateFingerprint(PublicKey publicKey)
                                  throws NoSuchAlgorithmException
Generate fingerprint from public key using MessageDigest.

Parameters:
publicKey - the public key
Returns:
the string
Throws:
NoSuchAlgorithmException - the no such algorithm exception

generateFingerprint

public static String generateFingerprint(X509Certificate certificate)
                                  throws NoSuchAlgorithmException,
                                         CertificateEncodingException
Generate fingerprint from a certificate using MessageDigest.

Parameters:
certificate - the certificate
Returns:
the string
Throws:
NoSuchAlgorithmException - the no such algorithm exception
CertificateEncodingException - the certificate encoding exception

convert2Hex

public static String convert2Hex(byte[] data)
Convert a byte array to a hexadecimal string

Parameters:
data - the data
Returns:
the string

getMessages

public PerforceMessages getMessages()
Gets the messages.

Returns:
the messages


Copyright © 2015 Perforce Software. All Rights Reserved.