Javax.crypto not resolving

Hi!
So I’m trying to import javax.crypto.* but it keeps saying that the import cannot be resolved. I’ve tried everything i’ve been able to think about. I’ve tried the other packages in javax and all seem fine, ive tried all posible ways to check if it was a spelling problem, i’ve tried substituting the processing JRE files for the ones in the latest JDK and nothing changes…
Do you need to do something else than just downloading processing to acces crypto?

1 Like

By chance, have you forgotten the semicolon after the asterisk? :thinking:

import javax.crypto.* :arrow_right: import javax.crypto.*;

Docs.Oracle.com/en/java/javase/11/docs/api/java.base/javax/crypto/package-summary.html

1 Like

I wish it was that but nope:

import javax.crypto.*;

void setup() {
  size(600,600);
}

void draw() {
  background(0);
}```

Hey there! :blush: So this may come as odd to you but, merely using import javax.crypto.*; or together with any of its derivatives seems to cause this problem unless used with bouncycastle .

I’ve put an example implementation using it with the blowfish cipher algorithm. Find it here on Dropbox.

Hope you find it helpful :hugs:

thanks @Abel,
but i not find your example,
only the ICE lib and the org.provider

:see_no_evil: Shoot! I forgot. Here is the example. [The above link has also been updated.]

2 Likes

Okay so I found out that if you copy the jce.jar in jre/lib into a folder called code in the sketch folder, it actually does import it.

2 Likes

Hi,
I have the same problem. Tried everything but can’t make processing import this javax.crypto
Using Processing 3.5.4 and Java 8 Update 291 (64-bit)
Any idea?

:wave: Hey hey,

Here are the libraries required (Crypto, and Base64) along with a working example.

Just make sure to copy both folders, ‘crypto’ and ‘base64’, in your ‘…/Processing/libraries/’ folder.

This shall resolve the issue.

1 Like

Thanks so much for creating and sharing this, @Abel!

A note for people using these:

Both libraries are necessary for the Crypto Blowfish demo sketch to run.

  1. To install crypto support that is importable by any Processing sketch, copy both folders into your Processing libraries folder:

    • cryptoProcessing/libraries/crypto
    • base64Processing/libraries/base64
  2. To install crypto support for a single sketch only, copy both folders into a new folder in your sketch named /code.
    In this example, CryptoBlowfish is the name of your sketch:

    • cryptoCryptoBlowfish/code/crypto
    • base64CryptoBlowfish/code/base64