1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| Alert alert = //... create the CAP Alert
String jceAlgorithmName = "AES";
KeyGenerator keyGenerator =
KeyGenerator.getInstance(jceAlgorithmName);
keyGenerator.init(128);
SecretKey key = keyGenerator.generateKey();
AbderaSecurity absec = new AbderaSecurity(abdera);
Encryption enc = absec.getEncryption();
EncryptionOptions options = enc.getDefaultEncryptionOptions();
options.setDataEncryptionKey(key);
// Encrypt the document using the generated key
Document enc_doc = enc.encrypt(alert.getDocument(), options);
|