| (Java) RSA Import Private KeyShows how to select/import a private key for RSA signing or decryption.Note: This example requires Chilkat v11.0.0 or greater. 
 import com.chilkatsoft.*;
public class ChilkatExample {
  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }
  public static void main(String argv[])
  {
    boolean success = false;
    CkPrivateKey privKey = new CkPrivateKey();
    String password = "secret";
    // In all Chilkat methods expecting a path, you pass either absolute or relative paths.
    success = privKey.LoadAnyFormatFile("rsaKeys/myTestRsaPrivate.pem",password);
    if (success == false) {
        System.out.println(privKey.lastErrorText());
        return;
        }
    CkRsa rsa = new CkRsa();
    // Tell the RSA object to use the private key (i.e. import the private key)
    rsa.UsePrivateKey(privKey);
  }
}
 |