Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Fix code scanning alert no. 5: Use of a broken or risky cryptographic algorithm #47

Closed
wants to merge 1 commit into from

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Sep 28, 2024

Fixes https://github.com/codehaus-plexus/plexus-cipher/security/code-scanning/5

To fix the problem, we should replace the use of AES/CBC/PKCS5Padding with AES/GCM/NoPadding. GCM (Galois/Counter Mode) provides both encryption and integrity, making it a more secure choice. This change involves updating the CIPHER_ALG constant and modifying the createCipher method to handle the GCM-specific parameters.

  1. Update the CIPHER_ALG constant to use AES/GCM/NoPadding.
  2. Modify the createCipher method to generate a GCM parameter spec with a nonce.
  3. Ensure the encryption and decryption methods handle the GCM-specific parameters correctly.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

… algorithm

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@cstamas cstamas closed this Sep 28, 2024
@cstamas cstamas deleted the autofix/alert-5-af41a73e72 branch September 28, 2024 16:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant