Skip to content

Add RSA and Ed25519 key tests, implement ChaCha20-Poly1305 methods#22

Merged
nedithgar merged 7 commits intomainfrom
fix/investigate-chacha
Oct 14, 2025
Merged

Add RSA and Ed25519 key tests, implement ChaCha20-Poly1305 methods#22
nedithgar merged 7 commits intomainfrom
fix/investigate-chacha

Conversation

@nedithgar
Copy link
Copy Markdown
Owner

Introduce round-trip tests for RSA 2048 key generation, enhance Ed25519 key parsing tests, and implement ChaCha20-Poly1305 encryption and decryption methods with worked example tests. Update version to 0.1.10.

Copilot AI review requested due to automatic review settings October 14, 2025 14:21
@nedithgar nedithgar merged commit 044f068 into main Oct 14, 2025
4 checks passed
@nedithgar nedithgar deleted the fix/investigate-chacha branch October 14, 2025 14:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive test coverage for RSA and Ed25519 key encryption with various ciphers, implements ChaCha20-Poly1305 OpenSSH encryption methods, and bumps the version to 0.1.10.

  • Adds Ed25519 key parsing tests for multiple encryption algorithms (AES-CTR, AES-CBC, AES-GCM, 3DES-CBC, and ChaCha20-Poly1305)
  • Implements new ChaCha20-Poly1305 OpenSSH encryption and decryption methods with test coverage
  • Adds RSA 2048 key round-trip testing

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Tests/SwiftKeyGenTests/Integration/OpenSSHFormatIntegrationTests.swift Adds Ed25519 encryption tests and RSA round-trip test
Tests/SwiftKeyGenTests/Cryptography/Ciphers/ChaCha20-Poly1305UnitTests.swift Adds worked example tests for ChaCha20-Poly1305
Sources/SwiftKeyGenCLI/main.swift Version bump to 0.1.10
Sources/SwiftKeyGen/Cryptography/Ciphers/Cipher.swift Updates comment to reference new file name
Sources/SwiftKeyGen/Cryptography/Ciphers/ChaCha20Poly1305OpenSSH.swift New ChaCha20-Poly1305 implementation
Sources/SwiftKeyGen/Cryptography/Ciphers/ChaCha20Poly1305.swift Removed old implementation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

aadLength: ChaCha20Poly1305Fixtures.aadLength
)

#expect(encrypted.count == vectors.fullCiphertext.count)
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The count comparison on line 60 is redundant since the equality check on line 61 already verifies the data matches completely, which includes the count.

Suggested change
#expect(encrypted.count == vectors.fullCiphertext.count)

Copilot uses AI. Check for mistakes.
Comment on lines +138 to +143
private static func clampAADLength(_ requested: Int, dataLength: Int) -> Int {
if requested <= 0 {
return 0
}
return min(requested, dataLength)
}
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The function name 'clampAADLength' could be more descriptive. Consider renaming to 'validateAADLength' or 'normalizeAADLength' to better convey its purpose of ensuring the AAD length doesn't exceed the data length.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants