Following GCM use of gyb for Nonce generation, I converted IV and Nonce classes of the CBC, CFB, and CTR to allow conformance to ContinuousBytes and Sequence.
Checklist
[x] I've run tests to see all new and existing tests pass
[x] I've followed the code style of the rest of the project
[?] I've updated the documentation if necessary (Probably need to do this)
If you've made changes to gyb files
[x] I've run .script/generate_boilerplate_files_with_gyb and included updated generated files in a commit of this pull request
Motivation:
The project I am working on uses a AES CBC algorithm to send encrypted data to exchange keys between a server and client. This means, that the client and server exchange the IV/Nonce with each other. Currently, we can only use CommonCrypto, because AES._CBC.IV doesn't facilitate an API to get the internal data bytes.
Modifications:
Removed the current IV and Nonce structs from their corresponding files. Made a Nonces.swift.gyb file that will generate the corresponding structs for each algorithm.
Result:
Allows us to integrate Crypto into our repository and fix an issue we have involving padding of our cipher data, when using CCCrypt
I'm happy to add unit tests for this PR, however I don't think they are needed. While the conformance to new Protocols is public, I believe their use is also internal and so they are being exercised by the current set of unit tests.
Following GCM use of gyb for Nonce generation, I converted IV and Nonce classes of the CBC, CFB, and CTR to allow conformance to ContinuousBytes and Sequence.
Checklist
If you've made changes to
gyb
files.script/generate_boilerplate_files_with_gyb
and included updated generated files in a commit of this pull requestMotivation:
The project I am working on uses a AES CBC algorithm to send encrypted data to exchange keys between a server and client. This means, that the client and server exchange the IV/Nonce with each other. Currently, we can only use CommonCrypto, because AES._CBC.IV doesn't facilitate an API to get the internal data bytes.
Modifications:
Removed the current IV and Nonce structs from their corresponding files. Made a Nonces.swift.gyb file that will generate the corresponding structs for each algorithm.
Result:
Allows us to integrate Crypto into our repository and fix an issue we have involving padding of our cipher data, when using CCCrypt
I'm happy to add unit tests for this PR, however I don't think they are needed. While the conformance to new Protocols is public, I believe their use is also internal and so they are being exercised by the current set of unit tests.