Discuss this help topic in SecureBlackbox Forum

Using Java classes in Java and Android applications

To use SecureBlackbox functionality in your Java/Android application, add the corresponding classes to the project. All necessary JAR files are located in <SecureBlackbox>\Classes\Java or <SecureBlackbox>\Classes\Android folders accordingly. The naming of Java JAR files in SecureBlackbox is the same as the naming of .NET assemblies. The naming of Java classes in SecureBlackbox is the same as the naming of .NET components and classes.

Be sure to include all indirectly used JAR files to your project, as described in "Deployment of Java classes" topic.

Java Native Interface

Java Native Interface (JNI) is used to let Java application access system-specific features such as Windows Crypto API and PKCS#11 drivers (DLLs).

JNI layer consists of two native libraries for Windows: sbbjni32.dll and sbbjni64.dll (for 32-bit and x64 systems respectively). JNI should be turned on if you need PKCS #11 or Win32 CryptoAPI / CNG support. CryptUI utility methods also require JNI.

JNI can be turned on using SecureBlackbox.Base.JNI.initialize() method. You can put both DLLs to java.library.path and call this method without parameters or pass a full path to a library as a parameter.

Using Java classes

Method names in Java are the same as in VCL/.NET, however, the signatures may differ slightly, e.g.:


TElSymmetricCrypto c = new TElSymmetricCrypto();
int OutSize = 100;
c.Encrypt(InBuffer, 0, InBuffer.Length, OutBuffer, 0, ref OutSize);


TElSymmetricCrypto c = new TElSymmetricCrypto();
int  OutSize  = c.Encrypt(InBuffer, 0, InBuffer.length, OutBuffer, 0, 100);

Java doesn't support properties, and the corresponding getter/setter methods must be used instead:

TElSimpleSSHClient ssh = new TElSimpleSSHClient();
boolean isActive = ssh.GetActive();

Event handler example:

TElSimpleSFTPClient client = new TElSimpleSFTPClient();
client.SetOnKeyValidate(new TSSHKeyValidateEvent(onKeyValidate));
TSSHKeyValidateEvent.Callback onKeyValidate = new TSSHKeyValidateEvent.Callback() {
    public boolean TSSHKeyValidateEventCallback(TObject sender, TElSSHKey serverKey) {
        System.out.println("Server key received");
        return true;

Discuss this help topic in SecureBlackbox Forum