public static Credential createCredential(char[] value) throws InvalidCredentialValueException {

    if (value == null) {
      return null;
    } else {
      String valueString = String.valueOf(value);

      if (PrincipalKeyCredential.isValidValue(valueString)) {
        return PrincipalKeyCredential.fromValue(valueString);
      } else {
        return GenericKeyCredential.fromValue(valueString);
      }
    }
  }
Give a credential value (assumed from a keystore), attempt to determine what type of Credential
is represented and create the appropriate Credential implementation.
<p/>
For example, if the raw value starts with "PrincipalKeyCredential" it is determined to be
a PrincipalKeyCredential.  A new PrincipalKeyCredential is created and then returned.

@param value the raw credential value
@return a Credential
@throws InvalidCredentialValueException if an error occurs while parsing the raw credential value
ambari-server/src/main/java/org/apache/ambari/server/security/credential/CredentialFactory.java