Commit graph

51 commits

Author SHA1 Message Date
Daniel Huigens
ff97844785 Clone data when splitting messages 2022-02-28 12:26:01 +01:00
Daniel Huigens
7103bdf2a5 Generic implementation of splitting messages 2022-02-15 11:32:32 +01:00
marin thiercelin
1a2e569373
Fix parsing issue of AEAD encrypted messages.
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`.
2022-01-10 14:24:08 +01:00
marin thiercelin
6f86adc432
Add keyRing.GetVerifiedSignatureTimestamp()
Add a function to verify a detached signature and access
its creation time.
2021-12-21 10:02:23 +01:00
Aron Wussler
26dd18cf42 Add documentation for messages 2021-08-03 20:55:03 +02:00
wussler
27efcb4627
WIP: Add tests for attachments (#116)
* Add tests for attachments

* Fix CI

* Use go 1.15 for mobile
2021-03-08 17:59:03 +01:00
Daniel Huigens
d0daa53ca6
Update x/crypto fork to github.com/ProtonMail/go-crypto (#106) 2020-12-08 18:34:39 +01:00
wussler
385e6d21d2
Drop regex for canonicalization (#102)
* Drop regex for canonicalization

* Fix CI
2020-12-01 18:09:25 +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
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
af371097e0
break for cycle in getEncryptionKeyIDs (#74)
break cycle on literal/aead/encrypted/compressed packets
2020-08-26 19:05:06 +03: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
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
Daniel Huigens
10a9a0f557
Don't retain references to passed byte slices (#40) 2020-04-08 11:11:16 +02: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
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
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
7d9930b8e0 Improve documentation and naming
- Rename pmmime to gomime
- Rename pmKeyObject to pgpKeyObject
2019-05-15 14:34:22 +02:00
Daniel Huigens
bb1be4a43b Rename PmCrypto to GopenPGP 2019-05-14 18:12:35 +02:00
Daniel Huigens
da2e0f77f0 Rename package to gopenpgp 2019-05-14 18:09:06 +02:00
Daniel Huigens
4081e693fc Fix build
`errors` import was missing due to conflicting PRs.
2019-05-14 16:51:02 +02:00
Daniel Huigens
0931705fce Merge branch 'addexamples' into 'master'
Add examples

See merge request ProtonMail/go-pm-crypto!20
2019-05-14 14:44:08 +00:00
Aron Wussler
78e3abb0d8 go vet and lint
* Naming
    * If this is not some OpenPGP standard I follow rule that `DES` should be
      upper case as it is abreviation and `Triple` should be camel-case as it
      is normal word hence `TripleDES`
    * rename `errors2` -> `errorsPGP`
* long lines
    * https://github.com/golang/go/wiki/CodeReviewComments#line-length
    * I bit improved long lines based on my folding
    * reuse type in definition if possible i.e. `a string, b string, c string` -> `a,b,c string`
    * `if long_statetent(); err!=nil {` -> `long_statement;↵ if err!=nil {`
    * spaces around operators (e.g. `a + b` -> `a+b`)
* removing empty lines on start and end of scope
* comments
    * on all exported functions
    * start with function name
* import:
    * order in alphabet
    * separate native, golang.org/x/ and our libs
2019-05-14 14:42:38 +00:00
William Gotti
0421e1c829 Add Encrypt/Decrypt examples 2019-05-14 15:45:15 +02:00
Daniel Huigens
b1e3bd78d1 Don't loop forever when passed an incorrect password 2019-05-14 13:34:42 +00:00
William Gotti
b820c14c1a Remove unused code + handle errors 2019-05-13 12:42:29 +00:00
William Gotti
5cdec38a18 fix typo / improve documentatation 2019-05-13 12:33:01 +00:00
Daniel Huigens
2091fc106c Use new KeyExpired function 2019-04-27 07:32:20 +02:00
Jakub
36b497d591 fix compile 2019-03-07 16:56:12 +01:00
Jakub Lehotsky
b218f523af Methods use + unit tests update 2019-01-11 00:23:00 +01:00
Jakub Lehotsky
d7f0550a4b Low-memory garbage collector 2018-11-22 10:53:14 +01:00
Jakub Lehotsky
686d4f1b7d Medning wrong commit 2018-11-22 00:01:18 +01:00
Jakub Lehotsky
8cf5054ff2 Readded deleted sym.encryption methods 2018-11-21 23:44:33 +01:00
Jakub Lehotsky
fc706ffa3e Signing/unlocking entities simplification 2018-11-21 21:11:30 +01:00
Jakub Lehotsky
d57b71e5ec Android-side KeyRing reuse refactoring support 2018-11-09 13:03:46 +01:00
Jakub Lehotsky
984f8eb391 Android stable version 2018-11-09 02:08:39 +01:00
Jakub Lehotsky
3fe6899fbb Android stable version 2018-11-09 02:03:19 +01:00
Jakub Lehotsky
fdd1a727cb Issue #3: mobile client fallback version 2018-11-05 22:55:45 +01:00
Jakub Lehotsky
0bf075d49d Minor build fixes 2018-11-01 17:03:43 +01:00
Jakub Lehotsky
b3e6e67cac Refactor: Moved relevant parts of Key and KeyRing objs from go-pmapi 2018-09-20 15:20:45 +02:00
Jakub Lehotsky
d005dca0a4 Minor: spelling and typos 2018-09-19 11:52:14 +02:00