aws-samples / aws-samples/aws-cloudhsm-jce-examples
Error in AESGCM sample
- Dominant language
- Java
- Stars
- 46
- Forks
- 70
- Avg merge
- 52m
- Merged PRs (30d)
- 4
Description
https://github.com/aws-samples/aws-cloudhsm-jce-examples/blob/bc6aa764fe2f8bcdf848494157456bd1158b81fb/src/main/java/com/amazonaws/cloudhsm/examples/AESGCMEncryptDecryptRunner.java#L93
According to JCE spec Cipher.update(byte[]) is using for stream processing - it returns byte[] that shouldn't be ignored
```
encCipher.update(plainText);
byte[] ciphertext = encCipher.doFinal();
```
should be
```
byte[] ciphertext = encCipher.doFinal(plainText);
```
Or it is something special in CloudHSM provider implementation ?
Contributor guide
Research direction
Start with src/main/java/com/amazonaws/cloudhsm/examples/AESGCMEncryptDecryptRunner.java at line 93 and compare the sample's Cipher.update(byte[]) and doFinal() usage with the JCE specification. Check whether the CloudHSM provider changes the expected behavior. Done means correcting or confirming the AES-GCM sample so the plaintext and ciphertext handling is spec-compliant.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- cryptography, security
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100