CMSOutputEncryptor(ASN1ObjectIdentifier encryptionOID, int keySize, SecureRandom random) throws CMSException { if (random == null) { random = new SecureRandom(); } CipherKeyGenerator keyGen = helper.createKeyGenerator(encryptionOID, random); encKey = new KeyParameter(keyGen.generateKey()); algorithmIdentifier = helper.generateAlgorithmIdentifier(encryptionOID, encKey, random); cipher = helper.createContentCipher(true, encKey, algorithmIdentifier); }
protected BaseKeyGenerator( String algName, int defaultKeySize, CipherKeyGenerator engine) { this.algName = algName; this.keySize = this.defaultKeySize = defaultKeySize; this.engine = engine; }
private CipherKeyGenerator createCipherKeyGenerator(SecureRandom random, int keySize) { CipherKeyGenerator keyGen = new CipherKeyGenerator(); keyGen.init(new KeyGenerationParameters(random, keySize)); return keyGen; }
@SideOnly(Side.CLIENT) /** * Generate a new shared secret AES key from a secure random source */ public static SecretKey createNewSharedKey() { CipherKeyGenerator cipherkeygenerator = new CipherKeyGenerator(); cipherkeygenerator.init(new KeyGenerationParameters(new SecureRandom(), 128)); return new SecretKeySpec(cipherkeygenerator.generateKey(), "AES"); }
public KeyGen() { super("RC6", 256, new CipherKeyGenerator()); }
public KeyGen() { super("XTEA", 128, new CipherKeyGenerator()); }
public KeyGen() { super("Grain128", 128, new CipherKeyGenerator()); }
public KeyGen() { super("SEED", 128, new CipherKeyGenerator()); }
public KeyGen() { super("VMPC", 128, new CipherKeyGenerator()); }
public KeyGen() { super("Skipjack", 80, new CipherKeyGenerator()); }
public KeyGen(int keySize) { super("GOST28147", keySize, new CipherKeyGenerator()); }
public KeyGen() { super("Twofish", 256, new CipherKeyGenerator()); }
public KeyGen() { super("HC256", 256, new CipherKeyGenerator()); }
public KeyGen() { super("RC4", 128, new CipherKeyGenerator()); }
public KeyGen() { super("TEA", 128, new CipherKeyGenerator()); }
public KeyGen() { super("Noekeon", 128, new CipherKeyGenerator()); }
public KeyGen() { super("CAST5", 128, new CipherKeyGenerator()); }
public KeyGen() { super("Rijndael", 192, new CipherKeyGenerator()); }
public KeyGen() { super("Grainv1", 80, new CipherKeyGenerator()); }
public KeyGen() { super("Salsa20", 128, new CipherKeyGenerator()); }
public KeyGen() { super("VMPC-KSA3", 128, new CipherKeyGenerator()); }
public KeyGenerator() { super("RC2", 128, new CipherKeyGenerator()); }
public KeyGen() { super("HC128", 128, new CipherKeyGenerator()); }
public KeyGen32() { super("RC5", 128, new CipherKeyGenerator()); }
public KeyGen64() { super("RC5-64", 256, new CipherKeyGenerator()); }
public KeyGen(int keySize) { super("Camellia", keySize, new CipherKeyGenerator()); }
public KeyGen() { super("IDEA", 128, new CipherKeyGenerator()); }
public KeyGen() { super("Blowfish", 128, new CipherKeyGenerator()); }