Commit graph

30 commits

Author SHA1 Message Date
marin thiercelin
f4ccc63c40
Add a helper to verify stream signatures explicitly
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.
2021-07-16 12:16:33 +02:00
larabr
cd4adae9f2
Update error messages in passwordDecrypt (#124) 2021-07-05 10:42:18 +02:00
marinthiercelin
c46ed8ed9e
Add a streaming api to KeyRing and SessionKey (#131)
* 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>
2021-06-30 16:49:30 +02:00
wussler
c19faed5da
Add methods for embedded signatures using session keys (#128)
* Add methods to sign when using session keys

* Add mobile helpers for explicit decryption

* Add functions to CHANGELOG

* Fix linter
2021-04-27 17:38:25 +02:00
wussler
934571ce56
Fix AES tests for helpers (#122) 2021-03-30 11:46:32 +02:00
wussler
6105a3bcc0
Improve attachment memory allocation (#105)
* Improve attachment memory allocation

* added explicit garbage collection

* redundant GC

* added GCs in attachment processor and a FreeOSMemory helper

* added changelog

* linting

* Remove commented call to debug.FreeOSMemory

Co-authored-by: marin thiercelin <marin.thiercelin@pm.me>
Co-authored-by: marinthiercelin <marin.thiercelin@epfl.ch>
2020-12-08 17:52:50 +01:00
wussler
385e6d21d2
Drop regex for canonicalization (#102)
* Drop regex for canonicalization

* Fix CI
2020-12-01 18:09:25 +01:00
marinthiercelin
062cca9201
Added helpers with encrypted signatures and unarmored binary ciphertexts (#83)
* added signcryption for binary ciphertexts

* fixing merge issues

* removed newlines before error handling

Co-authored-by: marin thiercelin <marin.thiercelin@pm.me>
2020-10-29 14:20:39 +01:00
wussler
53a85837e0
Improve error handling, fix linter (#92)
* Improve error handling, fix linter
2020-10-29 12:42:32 +01:00
wussler
ce607e0fa8
Canonicalize line endings for text messages (#86)
* Canonicalize line endings for text messages

* Improve cleartext messages
2020-10-12 21:24:33 +02:00
wussler
a4d89bce32
Add filename and time properties to message (#85)
* Add filename and time properties to message

* Message time defaults to current time
2020-10-12 18:45:57 +02:00
marinthiercelin
ada3fd0533
Signcryption (#82)
* 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>
2020-10-07 15:26:36 +02:00
marinthiercelin
2b8d58d357
Fix gomobile compilation ssues (#81)
Co-authored-by: marin thiercelin <marin.thiercelin@pm.me>
2020-09-28 18:26:31 +02:00
wussler
16024c21ec
Move encrypt detached helper to avoid building on mobile (#79) 2020-09-14 09:19:33 +02:00
marinthiercelin
55c4bd994d
Additional helpers for iOS drive (#78)
* add tests

Co-authored-by: wussler <aron@wussler.it>
Co-authored-by: marin thiercelin <marin.thiercelin@pm.me>
2020-09-11 15:35:22 +02:00
marinthiercelin
39c2fa863e
new helpers for drive decryption (#73)
* 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>
2020-08-27 17:34:46 +02:00
wussler
b152448673
Convert private to public keys in helpers to prevent locked errors (#66) 2020-08-04 10:04:40 +02:00
Jamie
3b2e53c586
Add binary message helpers (#61)
* 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
2020-07-17 09:02:39 +02:00
zugzwang
dcc82c9fc3
Implement GetArmoredWithCustomHeaders (#48)
* 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>
2020-05-06 18:50:18 +02:00
zugzwang
ac8a49c114
Update lint (#44)
* 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>
2020-04-28 13:55:36 +02:00
wussler
222decb919
Fix various minor issues (#45)
* 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
2020-04-27 21:01:23 +02:00
Aron Wussler
9caf737bc7 Add documentation for SHA256 fingerprints 2020-04-07 15:19:48 +02:00
wussler
3c79f40acb
Add SHA256 fingerprint utils and helpers (#41) 2020-04-07 14:59:25 +02:00
Yanfeng Zhang
5c496d0505 Add build script and fix helper for mobile (#32)
* update build and fix helper for mobile

* Update readme, changelog and script cleanup

Co-authored-by: wussler <aron@wussler.it>
2020-01-06 13:21:44 +01:00
wussler
54f45d0471
Openpgp security update (V2) (#31)
* Change keyring unlock functionalities

* Add keyring#Lock, keyring#CheckIntegrity, tests

* Update helpers, fix bugs

* Update go.mod with ProtonMail/crypto commit

* Change key management system

* Clear keys from memory + tests

* Create SessionKey with direct encryption for datapackets. Move symmetrickey to password.

* Fix upstream dependencies

* Update module to V2, documentation

* Add linter

* Add v2 folder to .gitignore

* Minor changes to KeyID getters

* Remove old changelog

* Improve docs, remove compilation script
2019-12-27 19:35:43 +01:00
wussler
136c0a5495
Change time global handling (#29)
* Reverse time

* Change time handling global

* Remove debug functions

* Remove *pgp methods
2019-10-22 18:44:45 +02:00
Aron Wussler
4a41ea9e27 Add wrappers for iOS 2019-09-12 11:57:59 +02:00
wussler
4ef79f1d12 Rename conflicting methods (#20) 2019-08-19 12:06:30 +02:00
wussler
9195b9ae92
Fix compilation for gomobile iOS (#17)
* Move signature verification to errors

* Move cleartext messages to ClearTextMessage struct

* Fix documentation
2019-07-02 07:36:02 -07:00
wussler
e65ed17b41
Refactor api (#6)
* 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
2019-06-03 17:00:01 +02:00