Adds the following API functions:
- API to get signature key IDs for mobile:
func (msg *PGPMessage) GetHexSignatureKeyIDsJson() []byte
- API to get encryption key IDs for mobile:
func (msg *PGPMessage) GetHexEncryptionKeyIDsJson() []byte
- API to get the number of key packets in a PGP message:
func (msg *PGPSplitMessage) GetNumberOfKeyPackets() (int, error)
- API in package `helper` to encrypt a PGP message to an additional key:
func EncryptPGPMessageToAdditionalKey(messageToModify *crypto.PGPSplitMessage, keyRing *crypto.KeyRing, additionalKey *crypto.KeyRing) error
This commit adds the function QuickCheckDecrypt to the helper package.
The function allows to check with high probability if a session key can decrypt a data packet given its 24-byte prefix.
It only works for SEIPDv1 data packets that uses AES as a cipher.
Adds the helper `VerifySignatureExplit()` to get an explicit `SignatureVerificationError`
when verifying a `PlainMessageReader`. This is needed for mobile apps, that
can't cast an error to a signature error.
* 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>
* added signcryption in the helpers
* changed the name of encrypted signature
* changed the name of an encrypted signature
Co-authored-by: marin thiercelin <marin.thiercelin@pm.me>
* new helpers for drive decryption
* modular helper functions and reciprocals
* removed duplicates helper functions
* added mobile wrapper
* unit tests for new helpers
Co-authored-by: wussler <aron@wussler.it>
* Add EncryptBinaryMessageArmored helper function to generate an armored PGP message given binary data and an armored public key
* Add DecryptBinaryMessageArmored helper function to decrypt armored PGP message into binary data
* Streamline the code and fix naming pattern + tests
* Implement GetArmoredWithCustomHeaders
ArmorWithTypeAndCustomHeaders can be reused by other PGP armoured
objects.
* Update linting, and lint accordingly
`godot` has been improved and `goerr113` has been added (and ignored
here).
* Add custom headers for keys
* Minor comment changes
Co-authored-by: Aron Wussler <aron@wussler.it>
* Reduce complexity of SignatureCollector.Accept
* Add stylecheck linter, and lint accordingly
* Rephrase some comments
* godot - Top level comments should end with a dot.
* nestif - Reduce nested complexity of code
* Review changes
Co-authored-by: Aron Wussler <aron@wussler.it>
* Update header version to 2.0.0
* Add space to cleartext message armouring
* Fix password encrypted binary files
* Clear key private params in helpers
* Do not unlock key if private key is nil
* Document changes
* Use defer for ClearPrivateKeyParams
* Refactor library, remove duplicates
* Rebuild structure to use Messages and Signature models
* Use PGPSplitMessage
* Remove signature model
* Various fixes
* Add helpers with tests
* Fixes, add some docs, add tests
* Add attachment helpers
* Add helpers Symmetric encryption
* Edit docs + examples
* Rename kr to keyRing
* Various fixes for documentation
* Edit JSON handling functions, add decrypt keyring via token
* Add proposal changes doc
* Fix CI
* Drop *Message functions, join CleartextMessage and BinaryMessage
* Change canonicalization and trimming only to text signatures
* Add cleartextsignature, detach signature from message model, move helpers
* Documentation, remove optional parameters
* Move verification to separate model
* Don't return message in VerifyDetached
* Update table of contents in readme
* Appease golint
* Run go fmt
* Rename Encrypt/DecryptMessageWithPassword to ..WithToken
These functions shouldn't be used with user-provided passwords,
as they don't do any key-stretching.
* Change key generation usernames