Skip to content

Commit 606aef3

Browse files
committed
Crypto: Removing non-ascii characters from unit tests
1 parent b32a640 commit 606aef3

File tree

6 files changed

+5
-21
lines changed

6 files changed

+5
-21
lines changed

java/ql/test/experimental/library-tests/quantum/jca/EllipticCurve2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* - Brainpool (e.g., brainpoolP256r1)
2525
* - CURVE25519 (for X25519 key agreement)
2626
* - ES (e.g., Ed25519 for signatures)
27-
* - Other fallback (e.g., secp256r1 for OtherEllipticCurveType)
27+
* - Other fallback (e.g., secp256r1 for "OtherEllipticCurveType")
2828
*
2929
* Best practices:
3030
* - Use ephemeral keys and a strong RNG.

java/ql/test/experimental/library-tests/quantum/jca/KeyDerivation1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* 1. PBKDF2 Examples:
2929
* - Parent Classification: Password-Based Key Derivation Function (PBKDF).
3030
* - SAST:
31-
* * pbkdf2DerivationBasic: Uses PBKDF2WithHmacSHA256 with 10,000 iterations
31+
* * pbkdf2DerivationBasic: Uses PBKDF2WithHmacSHA256 with 10,000 iterations -
3232
* acceptable if parameters meet current standards.
3333
* * pbkdf2LowIteration: Uses only 10 iterations – flagged as insecure due to
3434
* insufficient iteration count.

java/ql/test/experimental/library-tests/quantum/jca/MACOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
/**
1717
* MACOperation demonstrates various Message Authentication Code (MAC)
18-
* operations and further use of MAC outputs as inputs into higherlevel
18+
* operations and further use of MAC outputs as inputs into higher-level
1919
* cryptosystems.
2020
*
2121
* Flows include:

java/ql/test/experimental/library-tests/quantum/jca/SignEncryptCombinations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public boolean verifyHmacSHA256(SecretKey key, byte[] data, byte[] givenMac) thr
143143
* UNSAFE FLOW: Signs the plaintext and encrypts only the signature.
144144
*
145145
* <p>
146-
* **Issue:** The plaintext message is not encryptedonly the signature is.
146+
* **Issue:** The plaintext message is not encrypted, only the signature is.
147147
* This exposes the original message to eavesdroppers and negates the purpose of
148148
* encryption.
149149
* </p>

java/ql/test/experimental/library-tests/quantum/jca/SignatureOperation.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -235,22 +235,6 @@ public void signAndVerifyEmptyMessage() throws Exception {
235235
System.out.println("Empty message signature verified? " + verified);
236236
}
237237

238-
/**
239-
* Demonstrates signing and verifying data containing non-ASCII characters.
240-
*
241-
* CBOM/SAST Notes:
242-
* - Edge Case: Non-ASCII (e.g., Unicode) data should be handled correctly.
243-
*/
244-
public void signAndVerifyNonAsciiMessage() throws Exception {
245-
// Use a message with Unicode characters.
246-
String nonAscii = "こんにちは世界"; // "Hello World" in Japanese.
247-
byte[] message = nonAscii.getBytes("UTF-8");
248-
KeyPair kp = generateEd25519KeyPair();
249-
byte[] sig = signEd25519(kp.getPrivate(), message);
250-
boolean verified = verifyEd25519(kp.getPublic(), message, sig);
251-
System.out.println("Non-ASCII message signature verified? " + verified);
252-
}
253-
254238
/**
255239
* Demonstrates that even a slight tampering with the signature will cause
256240
* verification to fail.

java/ql/test/experimental/library-tests/quantum/jca/SymmetricAlgorithm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public byte[] aesGcmEncryptSafe(SecretKey key, byte[] plaintext) throws Exceptio
8181
*/
8282
public byte[] aesGcmEncryptUnsafe(SecretKey key, byte[] plaintext) throws Exception {
8383
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
84-
byte[] iv = new byte[12]; // Fixed IV (all zeros by default) insecure.
84+
byte[] iv = new byte[12]; // Fixed IV (all zeros by default) - insecure.
8585
GCMParameterSpec spec = new GCMParameterSpec(128, iv);
8686
cipher.init(Cipher.ENCRYPT_MODE, key, spec);
8787
byte[] ciphertext = cipher.doFinal(plaintext);

0 commit comments

Comments
 (0)