import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.security.Security;
public static void main(String[] args) throws Exception {
Security.addProvider(new BouncyCastleProvider());
KeyGenerator kg = KeyGenerator.getInstance("aes", BouncyCastleProvider.PROVIDER_NAME);
kg.init(256);
SecretKey secretKey=kg.generateKey();
System.out.println(secretKey.getFormat());
Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding", "BC");
c.init(Cipher.ENCRYPT_MODE, secretKey);
byte[] t1 = c.update("ok2dfasjfhasjkdfhkawlehfkawefawef".getBytes());
byte[] t2 = c.doFinal("ok".getBytes());
System.out.println(Base64.toBase64String(t1));
}
public static int hashCode(byte[] value) {
int h = 0;
for (byte v : value) {
h = 31 * h + (v & 0xff);
}
return h;
}
AlgorithmParameters.getInstance(algorithm); "EC"
ecAlgParams.init(initSpec); //new ECGenParameterSpec(curveName);
ECParameterSpec ecSpec = ecAlgParams.getParameterSpec(ECParameterSpec.class);
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(new ASN1Integer(checkValue(n, x)));
return new DERSequence(v).getEncoded(ASN1Encoding.DER);