私のコードは
import java.security.Key;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
public class apiKeyGenerate {
public static void main(String[] args) throws Exception {
// Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
byte[] input = "input".getBytes();
byte[] ivBytes = "1234567812345678".getBytes();
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
KeyGenerator generator = KeyGenerator.getInstance("AES", "BC");
generator.init(128);
Key encryptionKey = generator.generateKey();
System.out.println("key : " + new String(encryptionKey.getEncoded()));
}
}
上記のコードで発生する例外は次のとおりです: - java.security.NoSuchProviderException: つまり
Exception in thread "main" java.security.NoSuchProviderException: no such provider: BC
at sun.security.jca.GetInstance.getService(Unknown Source)
at javax.crypto.SunJCE_b.a(DashoA13*..)
at javax.crypto.KeyGenerator.getInstance(DashoA13*..)
at apiKeyGenerate.main(apiKeyGenerate.java:17)
どうやってやるの ??前もって感謝します