swift-crypto
swift-crypto copied to clipboard
Why is `ivBytes` not publicly accessible on `AES._CBC.IV`?
Question Checklist
- [x] I'm using the latest version of Swift Crypto (main branch)
- [x] I read the Contribution Guidelines
- [x] I searched for existing GitHub issues
Question Subject
Why ivBytes is not a public property on AES._CBC.IV?
Question Description
I would expect ivBytes to be public which would enable me to encode it to an external representation.
There is a workaround for this issue:
var copy = iv
let ivData = withUnsafeBytes(of: ©) { Data($0) }
The answer is basically by analogy to the nonces in Crypto, however a piece of code is missing. The CBC IV should conform to at least Sequence though, if not Collection, which would let you do what you're trying to do. I'd welcome a patch that adds that conformance.