I keep on getting java.security.NoSuchAlgorithmException: no such algorithm: AES for provider BC
with my code below. It looks like I have included all the things I need.
My class is as follows:
....
import org.bouncycastle.jce.provider.BouncyCastleProvider;
class ... {
static
{
Security.addProvider(new BouncyCastleProvider());
}
public CryptSession(String _algo, String _provider, String _keyAlgo, int _keySize)
throws
NoSuchAlgorithmException,
NoSuchProviderException
{
KeyGenerator generator = KeyGenerator.getInstance("AES", "BC"); // KeyGenerator.getInstance(_algo, _provider);
generator.init(256); //generator.init(_keySize);
this._algo = _algo;
this._provider = _provider;
this._keyAlgo = _keyAlgo;
this._keySize = _keySize;
this._key = generator.generateKey();
}
...