Commit graph

95 commits

Author SHA1 Message Date
wussler
371d429001
WIP: Add compression to API (#91)
* Add compression to API

* Add docs

* Use defaults for a simpler interface

* Update x/crypto

* Fix ecdsa key types for lib update
2020-11-04 17:40:45 +01:00
wussler
53a85837e0
Improve error handling, fix linter (#92)
* Improve error handling, fix linter
2020-10-29 12:42:32 +01:00
wussler
d53bd4a351
Move getters to file excluded from android build (#88) 2020-10-14 18:28:12 +02:00
wussler
ac353fcbef
Make Time and Filename public (#87) 2020-10-13 13:14:09 +02: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
wussler
7de8833ff6
Fix binary format for session key encryption (#84) 2020-10-12 12:17:10 +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
wussler
64b3b45404
Fix mixed symmetric/asymmetric decryption (#77) 2020-09-01 11:07:30 +02:00
wussler
2f89b9fa0e
Add KeyIDs public API functionality (#76)
* Add public KeyIDs functions

* Add signature keyIDs functions

* Lint code
2020-09-01 10:02:13 +02:00
Ilya Chesnokov
1f4d966115
use aes256 for password encryption (#75) 2020-08-31 13:42:06 +03:00
Ilya Chesnokov
af371097e0
break for cycle in getEncryptionKeyIDs (#74)
break cycle on literal/aead/encrypted/compressed packets
2020-08-26 19:05:06 +03:00
wussler
979fdb3f4b
Add ToPublic method to get a public key object from a private key (#65) 2020-07-22 17:13:23 +02:00
dimitar10
48f05401ce
Prevent server time from going backwards in UpdateTime (#64) 2020-07-21 13:42:41 +02:00
wussler
8c04ff64a5
Add session key size check (#62)
* Add session key size check

Co-authored-by: Daniel Huigens <d.huigens@protonmail.com>
2020-07-20 11:43:36 +02:00
Ilya Chesnokov
88da5d44b1
Throw error EncryptSessionKey (#60)
* throw error EncryptSessionKey

throw error if one of the keys in keyring does not have valid encryption
key

* add key id to error description
2020-07-15 16:17:49 +07:00
Ilya Chesnokov
b38f993c25
Encrypt session key to multiple keys in keyring. (#59)
`EncryptSessionKey` now creates encrypted key packet for each valid key
in keyring.

Co-authored-by: Aron Wussler <aron@wussler.it>
2020-07-10 00:31:57 +07:00
Ilya Chesnokov
8d42a53775
Add getEntity and getEcryptionKeyIDs functions to key and message types respectively (#55)
* add getEntity function to key struct

* add getEncryptionKeyIDs

* add chengelog + bool return in getEncryptionKeyIDs

* fix description
2020-07-02 15:55:11 +07:00
Daniel Huigens
608bedaaf1
Reject signatures using insecure hash algorithms (#52) 2020-06-25 13:45:59 +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
Aron Wussler
4e5b29eb4a Fix symmetric session key test 2020-05-01 16:53:50 +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
zugzwang
0f35072bc4
Documentation fixes (#43)
* Fix Comment - NewKeyFromReader

* Trailing whitespace, correct function name

* Update CHANGELOG

* update README

Co-authored-by: zugzwang <talbotvinnik@pm.me>
Co-authored-by: Aron Wussler <aron@wussler.it>
2020-04-25 16:28:07 +02:00
Daniel Huigens
486e1220a1
Update ProtonMail/crypto (#42) 2020-04-25 16:03:49 +02:00
Daniel Huigens
10a9a0f557
Don't retain references to passed byte slices (#40) 2020-04-08 11:11:16 +02:00
wussler
3c79f40acb
Add SHA256 fingerprint utils and helpers (#41) 2020-04-07 14:59:25 +02:00
wussler
c8b7e87135
Fix test encryption test (#37)
* Fix TestMultipleKeyMessageEncryption

* Fix TestMultipleKeyMessageEncryption - simplify code

* Add diffs to changelog

* Simplify test code further
2020-03-05 22:16:38 +01:00
Aron Wussler
3f33c71496 Improve documentation for checking 2020-01-11 15:31:06 +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
5249d26588 Add text messages encryption 2019-09-12 11:58:09 +02:00
wussler
6136f75860 Remove JSON handling functions; export KeyRing.ReadFrom (#24) 2019-09-03 17:42:10 +02:00
wussler
52ecc1ce36
When keyring is empty KeyRing.FirstKey returns nil (#25) 2019-08-30 12:22:50 +02:00
wussler
72e33612c4
Edits for bridge (#22)
* Edits for bridge

* Add keyring method to extract first key, improve docs
2019-08-29 17:45:13 +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
552ce9554f
Add encryption and decryption for attachment tests (#16) 2019-06-13 01:26:13 -07:00
wussler
b30f047e53
Change verification system, add tests for issue 11 (#13) 2019-06-04 18:10:31 +02:00
Daniel Huigens
781681b548 Use Entitiy.EncryptionKey instead of reimplementing it
This fixes us sometimes using subkeys whose key flags allow
encryption but don't have a valid algorithm for encryption,
or that are expired, etc.
2019-06-04 16:45:33 +02: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
Daniel Huigens
4ef882c564 More documentation fixes 2019-05-15 15:17:03 +02:00
wussler
388fa872e7 Rename functions, clarify examples (#3) 2019-05-15 14:56:49 +02:00
wussler
b3047cee4d Improve docs for keyrings (#2) 2019-05-15 14:36:04 +02:00
Daniel Huigens
7d9930b8e0 Improve documentation and naming
- Rename pmmime to gomime
- Rename pmKeyObject to pgpKeyObject
2019-05-15 14:34:22 +02:00
Daniel Huigens
30ee92e63b Rename pmcrypto.go to gopenpgp.go 2019-05-15 13:51:42 +02:00
wussler
b074657c90 Add tests, remove duplicate signing functions (#1) 2019-05-15 13:48:47 +02:00
Daniel Huigens
d4cdec5229 Move subtle.go to its own package 2019-05-15 00:35:39 +02:00
Daniel Huigens
bb1be4a43b Rename PmCrypto to GopenPGP 2019-05-14 18:12:35 +02:00
Daniel Huigens
536a499f94 Rename go-pm-mime to go-mime 2019-05-14 18:09:06 +02:00