REST API

JSON Web Token Authentication

For instructions to generate a JSON web token for a POST request, see Generating a JSON Web Token for a POST Request.
For instructions to generate a JSON web token for a GET request, see Generating a JSON Web Token for a GET Request.
For code that you can use to authenticate REST API requests, see the SDK for your language:

Convert P12 or PKCS12 to Another Keystore Type

Use the Java API to convert the PKCS12 file into another keystore type. Use the Bouncy Castle JCE cryptography provider to do the conversion. Bouncy Castle JCE understands the multi certificate PKCS12 format.
The following code snippet uses the Bouncy Castle JCE API to access and convert the PKCS12.
 private static X509Certificate initializeCertificate(MerchantConfig merchantConfig) throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException, UnrecoverableEntryException, ConfigException {         if(merchantConfig != null && merchantConfig.getKeyAlias() != null && merchantConfig.getKeyFile() != null) {             KeyStore merchantKeyStore = KeyStore.getInstance("PKCS12", new BouncyCastleProvider());             merchantKeyStore.load(new FileInputStream(merchantConfig.getKeyFile()), merchantConfig.getKeyPassword().toCharArray());             String merchantKeyAlias = null;             Enumeration enumKeyStore = merchantKeyStore.aliases();             while(enumKeyStore.hasMoreElements()) {                 merchantKeyAlias = (String)enumKeyStore.nextElement();                 if(merchantKeyAlias.contains(merchantConfig.getKeyAlias())) {                     break;                 }             }             PrivateKeyEntry keyEntry = (PrivateKeyEntry)merchantKeyStore.getEntry(merchantKeyAlias, new PasswordProtection(merchantConfig.getKeyPassword().toCharArray()));             return (X509Certificate)keyEntry.getCertificate();         } else {             throw new ConfigException("merchant config fields missing: key alias, key file");         }     }     private static RSAPrivateKey initializePrivateKey(MerchantConfig merchantConfig) throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException, UnrecoverableEntryException, ConfigException {         if(merchantConfig != null && merchantConfig.getKeyAlias() != null && merchantConfig.getKeyFile() != null) {             KeyStore merchantKeyStore = KeyStore.getInstance("PKCS12", new BouncyCastleProvider());             merchantKeyStore.load(new FileInputStream(merchantConfig.getKeyFile()), merchantConfig.getKeyPassword().toCharArray());             String merchantKeyAlias = null;             Enumeration enumKeyStore = merchantKeyStore.aliases();             while(enumKeyStore.hasMoreElements()) {                 merchantKeyAlias = (String)enumKeyStore.nextElement();                 if(merchantKeyAlias.contains(merchantConfig.getKeyAlias())) {                     break;                 }             }             PrivateKeyEntry keyEntry = (PrivateKeyEntry)merchantKeyStore.getEntry(merchantKeyAlias, new PasswordProtection(merchantConfig.getKeyPassword().toCharArray()));             return (RSAPrivateKey)keyEntry.getPrivateKey();         } else {             throw new ConfigException("merchant config fields missing: key alias, key file");         }     }