A Java Keystore is a container for authorization certificates or public key certificates, and is often used by Java-based applications for encryption, authentication, and serving over HTTPS. Its entries are protected by a keystore password. A keystore entry is identified by an alias, and it consists of keys and certificates that form a trust chain.

1 KeyStore Object

Ax.ks.KeyStore is a class able to instantiate KeyStore Management for different KeyStore types:

The type can be specified when generating a KeyStore instance. If no keystore type is passed as parameter, default keystore type is automaticaly instanciated.

Type Description
jks The proprietary keystore implementation provided by the SUN provider.
pkcs12 The transfer syntax for personal identity information as defined in PKCS #12.
Copy
<script>
    var ksp12 = new Ax.ks.KeyStore('pkcs12');
    var ksjks = new Ax.ks.KeyStore('jks');
    var ksdef = new Ax.ks.KeyStore();
    console.log("ksp12: " + ksp12);
    console.log("ksjks: " + ksjks);
    console.log("ksdef: " + ksdef);
 </script>
ksp12: deister.axional.server.dbstudio.script.js.ax.keystore.JSKeyStore@568dd9a0
ksjks: deister.axional.server.dbstudio.script.js.ax.keystore.JSKeyStore@85c17e3
ksdef: deister.axional.server.dbstudio.script.js.ax.keystore.JSKeyStore@17de131c

1.1 KeyStore Load

To load a keystore into the KeyStore class you can use method load(File, Pass)

Copy
<script>
    // Create a new (empty) KeyStore in PKCS12 format
    var ks = new Ax.ks.KeyStoreManager('PKCS12');

    // Write to file using given password
    ks.writeTo(new Ax.io.File("/tmp/keystore.p12"), 'secret');        
    
    var ksc = new Ax.ks.KeyStore('pkcs12').load(new Ax.io.File("/tmp/keystore.p12"), 'secret');
    console.log(ksc);
 </script>
deister.axional.server.dbstudio.script.js.ax.keystore.JSKeyStore@32161f1b