getKeyPairFromKeystore

Loads a key pair from a Java keystore (JKS or PKCS12) and returns a java.security.KeyPair. Call getPrivate() or getPublic() on the result to pass a key to the JWT functions.

getKeyPairFromKeystore(config) → returns any

This function requires Adobe ColdFusion 2021 and up.  Not supported on Lucee, etc.

Argument Reference

config struct
Required

A struct with these keys: keystore (absolute path to the keystore file), keystorePassword, keypairPassword and keystoreAlias.

Compatibility

ColdFusion:

Version 2021+ No Adobe reference page exists. The config keys come from the examples on Adobe's createSignedJWT and verifySignedJWT pages and were confirmed on CF2021 and CF2025.

Examples
Sample code invoking the getKeyPairFromKeystore function

keys = getKeyPairFromKeystore({
	"keystore": expandPath("./jwt.p12"),
	"keystorePassword": "secret",
	"keypairPassword": "secret",
	"keystoreAlias": "contentKey"
});
writeOutput(keys.getPublic().getAlgorithm());

Expected Result: RSA

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub