In swift, strings must be strictly utf8, and when golang
returns a string with non utf8 characters, it gets translated to
an empty string for utf8.
To avoid this situation, we sanitize strings before returning them.
This behavior is only enabled when building with the "ios" build tag.
When the PGP/MIME decryption encounters a signature verification error, it will keep decrypting the content
and return it in the appropriate callbacks.
This allows the caller to choose to display the content with a warning rather than just returning an error.
In pgpMessage.SeparateKeyAndData(), the parsing would
ignore AEAD encrypted data packets. Which would result
in a split message with a nil data packet.
We add support for AEAD encrypted data packets.
This also affects `NewPGPSplitMessageFromArmored` and `NewPGPSplitMessage`.
When decrypting message, we have to use verifyTime in the config
otherwise signatures not valid at verifyTime but valid at Now()
will be seen as valid.
Because a GNU dummy key has a `PrivateKey` property, the existing check will
count it as a key to be decrypted. However, a `Decrypt` call on such key will
then yield an error, as it is a dummy key.
This commit addresses this behaviour by summing all valid decrpytable private
keys and returning on their count.
Further, it adapts `Unlock` to ignore any dummy subkey.
Fixes#138
* barebone streaming functionality
* encryption needs to return a writecloser
* added eof check
* workaround for reader problem with copies
* separate mobile wrappers from main api
* add a clone in the read result to avoid memory corruption
* refactor to reuse code, and fix verification
* have to give the verify key at the start of the decryption
* enfore readAll before signature verification
* streaming api for SessionKey
* add split message stream apis
* name interface params
* fix streaming api so it's supported by go-mobile
* hide internal writeCloser
* fix nil access
* added detached sigs methods
* started unit testing
* unit testing and fixed a bug where key and data packets where inverted
* remove unecessary error wrapping
* figured out closing order and error handling
* add GC calls to mobile writer and reader
* remove debugging values and arrays
* writer with builtin sha256
* unit testing the mobile helpers
* comments and linting
* Typo in error
Co-authored-by: wussler <aron@wussler.it>
* Add GetKeyPacket doc
Co-authored-by: wussler <aron@wussler.it>
* Add rfc reference in comments
Co-authored-by: wussler <aron@wussler.it>
* small improvements
* add compatibility tests with normal methods
* remove unecessary copies in the tests
* update go-crypto to the merged changes commit
* update comments of core internal functions
* remove unused nolint comment
* group message metadata in a struct
* fix comments
* change default values for metadata
* change the mobile reader wrapper to fit the behavior of java
* remove gc calls in the wrappers to avoid performance penalties
* bring back the former Go2MobileReader to be used for ios
* Update crypto/keyring_streaming.go
Co-authored-by: wussler <aron@wussler.it>
* return an error when verifying an embedded sig with no keyring
* Update crypto/sessionkey_streaming.go
Co-authored-by: wussler <aron@wussler.it>
* linter error
* update changelog
* update changelog
Co-authored-by: wussler <aron@wussler.it>