Exemple #1
0
extern "C" NS_EXPORT jstring JNICALL
Java_org_mozilla_gecko_NSSBridge_nativeEncrypt(JNIEnv* jenv, jclass,
                                               jstring jPath,
                                               jstring jValue)
{
    jstring ret = jenv->NewStringUTF("");

    const char* path;
    path = jenv->GetStringUTFChars(jPath, nullptr);

    const char* value;
    value = jenv->GetStringUTFChars(jValue, nullptr);

    char* result;
    SECStatus rv = doCrypto(jenv, path, value, &result, true);
    if (rv == SECSuccess) {
      ret = jenv->NewStringUTF(result);
      free(result);
    }

    jenv->ReleaseStringUTFChars(jValue, value);
    jenv->ReleaseStringUTFChars(jPath, path);

    return ret;
}
void BlowfishCrypto::Decrypt(const TCHAR *cipherText, TCHAR *clearText)
{
	doCrypto(cipherText, clearText, &this->decrypt);
}
void BlowfishCrypto::Encrypt(const TCHAR *clearText, TCHAR *cipherText)
{
	doCrypto(clearText,cipherText, &this->encrypt);
}