Authentication and the Java Client
As of version 1.1.0, we have updated our Java SDK to support the Basic, Digest, HMAC, and RSA authentication methods. For more details on these new methods see our Authentication (Hmac/Rsa) Guide. If you specify your desired authentication method and credentials when instantiating the DecryptxApi
object, the SDK will automatically generate the auth headers needed.
final DecryptxApi api = new DecryptxApi( AuthenticationMethod.HMAC, "WATERFORD", "ef1ad938150fb15a1384b883a104ce70" );
You can change the authentication after the SDK has been initialized.
final DecryptxApi api = new DecryptxApi();
api.setAuthenticationMethod( AuthenticationMethod.BASIC, "WATERFORD", "ef1ad938150fb15a1384b883a104ce70");
If the DecryptxApi object is instantiated without specifying an Authentication method, then the credentials must be sent in the body of the API request.
RSA and the Java SDK
When using the RSA authentication method with the SDK you can specify the private key by either 1) passing it as a string literal or 2) specifying the path to a private key file.
Specifying the RSA private key as a string literal.
final String privateKey = "-----BEGIN PRIVATE KEY-----\n" +
"MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCxoL7m6zVtPAhu\n" +
"uM3cJwL2KRw/MayFUVDCMlZhXBoN1Li7w2GbYFOh3axYrX5yccyD+OyppHaBQgNN\n" +
"mJ+wQja7+bt+MWS5dZ28zauC0TSRaNTCS1KZuzvRBaay17zuWc5JMMLJpv7X33mM\n" +
"GFUhAtHxMmUBLaXgaK3ucIX8oYQ1l1THlOtcH1MrcaYh4gejzn15UAmQRpPumLRf\n" +
"jnOHEKec3IwExT6VTNxKsysAKLw17m5CtCPU1snqyftg8S4R+xOvSE+2UqcijMek\n" +
"+XKK0iYhiDZDQ5Rvn23odVv91PeWBBObEK1PoGO4r0KDhBaDE+R290YDN9o+GHEs\n" +
"dhwUT2hXAgMBAAECggEBAIDpg4K9k2G6nvgUYTr0iR6zyU9HsshysmSt+ajhGfuN\n" +
"taB3dQA50Zh489rL1ygh1Oa2orOfq221xgXrzYEzHNwhq2QzXsGGTbs3nNDtGfSq\n" +
"GzcDSWhOzWOucUP8dJ6bSK4vmD6XVv6+rkzxX978V/dvtoQ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"LMiTGzV5ap4TnSWNP0rDuET3UPF8Xp3J976LHYClWsktlluDR2PdVXt8DsHAEf/5\n" +
"ctzeDnX4eMGX5R3RkKpa6GTW9Q==\n" +
"-----END PRIVATE KEY-----";
final DecryptxApi api = new DecryptxApi();
api.setAuthenticationMethod( AuthenticationMethod.RSA, "WATERFORD", privateKey);
Specifying the RSA private key with a path to a private key file.
final String pkFilePath = "/var/config_files/private.pem";
final DecryptxApi api = new DecryptxApi();
api.setAuthenticationMethod( AuthenticationMethod.RSA, "WATERFORD", pkFilePath);