티스토리 뷰

If your BC version is <= 1.50 and if it's trying to do XML encryption with AES in GCM mode, then you can try

setting this system property:

org.apache.xml.security.cipher.gcm.useIvParameterSpec=true


That's because BC <= 1.50 doesn't support the new javax.crypto.spec.GCMParameterSpec that exists in Java 7+ (which is otherwise found reflectively), and instead requires use of the older javax.crypto.spec.IvParameterSpec.IvParameterSpec.


cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(sharedKey, "AES/GCM/NoPadding"), new GCMParameterSpec(128, ivBytes));

The authentication tag can be specified by using the GCMParameterSpec. The default length of authentication tag is 128.

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2025/11   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
글 보관함