aws-samples / aws-samples/aws-cloudhsm-jce-examples

Error in AESGCM sample

Open
#91 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.