(Swift) Convert PKCS12 / PFX  to Java KeyStore
      
      Converts a PKCS12 / PFX file to a Java keystore (JKS) file. 
		
 
      
func chilkatTest() {
    // This requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.
    let jks = CkoJavaKeyStore()!
    let pfx = CkoPfx()!
    var pfxPassword: String? = "secret"
    // Load a PKCS12 from a file.
    var success: Bool = pfx.loadFile("/someDir/my.p12", password: pfxPassword)
    if success != true {
        print("\(pfx.lastErrorText!)")
        return
    }
    var alias: String? = "someAlias"
    var jksPassword: String? = "jksSecret"
    // Add the PKCS12 to the empty Java keystore object:
    success = jks.add(pfx, alias: alias, password: jksPassword)
    if success != true {
        print("\(jks.lastErrorText!)")
        return
    }
    // Write the Java keystore to a file:
    success = jks.toFile(jksPassword, path: "/jksFiles/my.jks")
    if success != true {
        print("\(jks.lastErrorText!)")
    }
    else {
        print("Successfully converted PKCS12 to JKS")
    }
}
     |