Commit graph

161 commits

Author SHA1 Message Date
M. Thiercelin
e9fca4d62f
Wrap the cause of signature verification errors.
Instead of swallowing the cause of verification errors,
we use error wrapping to communicate the cause to the caller.
2023-04-05 13:50:55 +02:00
M. Thiercelin
1ec90e34ea
Add API to add contexts to detached signatures.
Using the notation data packets of signatures, we add a way to
set a context to detached signatures.
We also add a way to enforce that signatures have the right context
during verification.
2023-03-13 11:48:31 +01:00
Daniel Huigens
9d05b3e9b6 Use returned signature in GetVerifiedSignatureTimestamp
Instead of parsing the signature packets manually, use the signature
packet returned by VerifyDetachedSignatureAndHash to get the
signature creation time.
2023-02-20 12:53:44 +01:00
Daniel Huigens
379e4814e0 More strictly verify detached signatures
Reject detached signatures from revoked and expired keys.
2023-02-20 12:53:44 +01:00
Aron Wussler
47534e9288 Upgrade go crypto and adapt SEIPD 2023-01-25 14:42:41 +01:00
M. Thiercelin
eccc1df619
Add streaming APIs to encrypt with compression 2023-01-24 17:44:07 +01:00
M. Thiercelin
2b9d76708a Size checks not needed in linebreaks unit tests 2022-11-18 15:33:31 +01:00
M. Thiercelin
76b77258e3 Add tests for encrypring text with non canonical line ends 2022-11-18 15:33:31 +01:00
Daniel Huigens
b189309152 Don't trim trailing spaces from non-clearsigned text messages 2022-11-18 15:33:31 +01:00
M. Thiercelin
bae54f7e83 Check signature types in unit tests 2022-11-17 17:28:55 +00:00
Daniel Huigens
b90e70daa4 Detached sign text messages with signature type text 2022-11-16 14:21:39 +01:00
M. Thiercelin
4971d78a53
Sanitize strings by default on all platforms.
Instead of sanitizing strings only on iOS, we do it on all platforms.
2022-11-03 12:32:20 +01:00
M. Thiercelin
a2fd1c6a3b
Sanitize non utf8 strings before returning them to iOS apps
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.
2022-11-03 12:31:05 +01:00
Aron Wussler
a065bf20b0 Update go-crypto 2022-08-19 11:20:08 +02:00
Martin
1791c07702
[codespell] Fix typos (#190) 2022-07-11 10:27:59 +02:00
M. Thiercelin
373e1ad526
Add unit tests for decryption of aead packets 2022-06-14 16:49:16 +02:00
M. Thiercelin
4cea9a0940
Decrypt AEAD encrypted data packets with a session key
Adds the support to decrypt AEAD encrypted data packets
when decrypting the data packet with a session key directly.
2022-06-14 16:10:25 +02:00
Aron Wussler
fee9ec19fd Improve golang CI 2022-05-17 17:06:18 +02:00
Aron Wussler
f5803d148d Do not return error on empty name or email key generation 2022-04-26 10:21:28 +02:00
marinthiercelin
2f59f6414f Return decrypted PGP/MIME content with wrong signatures
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.
2022-04-25 16:00:28 +02:00
M. Thiercelin
b54b5f4d6d
Fix test data for PGP/MIME tests
We update the test data for the PGP/MIME unit tests.
For a PGP/MIME signature to be valid, it must be done on the canonical text
and not the raw text.
2022-03-17 10:31:09 +01:00
M. Thiercelin
5c5666eaa1
Canonicalize PGP/MIME content before verifying signatures
Before verifying signatures of PGP/MIME messages we need to canonicalize
the content
2022-03-17 10:17:34 +01:00
wussler
53010fdee7
Update crypto/message.go 2022-03-01 09:14:38 +01:00
Daniel Huigens
e1f6ea603a Create SplitMessage() to replace SeparateKeyAndData(...int)
Keep SeparateKeyAndData(_ int, _ int) for backwards compatibility
with go-mobile bindings.
Deprecate SeparateKeyAndData in favor of SplitMessage.
2022-02-28 18:50:01 +01:00
Daniel Huigens
ff97844785 Clone data when splitting messages 2022-02-28 12:26:01 +01:00
Aron Wussler
3a65fb8dbb Fix bad MDC messages parsing 2022-02-24 19:20:15 +01:00
Aron Wussler
6799f1e8ce Fix linter 2022-02-15 11:57:30 +01:00
Daniel Huigens
7103bdf2a5 Generic implementation of splitting messages 2022-02-15 11:32:32 +01:00
Daniel Huigens
682166d9e3 Fix attachment processor error handling 2022-02-11 16:14:28 +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
wussler
18bc6a059c
Apply suggestions from code review 2021-12-15 11:28:45 +01:00
marin thiercelin
e2f03af655
Fix verification of signature for PGP/MIME messages
We fix the verification of embedded and PGM/MIME signatures
when decrypting PGP/MIME messages.
2021-12-15 11:01:04 +01:00
Aron Wussler
130472d5a5 Release 2.3.0: Update go-crypto, add Key.IsRevoked and fix key.IsExpired 2021-11-15 15:46:42 +01:00
Aron Wussler
24a754d34a Fix linter 2021-11-11 17:03:40 +01:00
Aron Wussler
1db1b41588 Fix unlocking and locking keys 2021-11-11 16:36:44 +01:00
Carlos Quintana
2118a0e776
Lint fixes 2021-10-19 09:06:09 +02:00
Carlos Quintana
c406b182bb
Replace Mutex with RWMutex 2021-10-19 08:09:59 +02:00
Carlos Quintana
9f25490f61
Lock global gopenpgp fields 2021-10-18 11:40:58 +02:00
marin thiercelin
5558d4a177
Fix: use verifyTime in the config time instead of Now()
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.
2021-09-23 17:14:19 +02:00
Aron Wussler
dcd95f3e5b Fix linter 2021-09-21 11:34:17 +02:00
Aron Wussler
64c051f0d9 Generate keys with compression & release 2.2.3 2021-09-21 11:20:36 +02:00
Aron Wussler
e0531b779c Add NewKeyFromEntity 2021-08-04 12:04:20 +02:00
Aron Wussler
26dd18cf42 Add documentation for messages 2021-08-03 20:55:03 +02:00
wussler
abf7e6f86a
Merge branch 'master' into master 2021-07-30 14:39:28 +02:00
Aron Wussler
5904ff3d70 Add static malformed key test 2021-07-30 13:01:23 +02:00
Aron Wussler
b50a051c7e Deprecate Key#Check() 2021-07-30 11:20:38 +02:00
Hendrik 'T4cC0re' Meyer
c5a8b1f2f7 Disregard GNU dummy subkeys when checking (un)locked state and unlocking a crypto.Key
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
2021-07-18 22:45:18 +02:00
marin thiercelin
77df8cba3d
Fix signature status when verifying unsigned message
Return `SIGNATURE_NOT_SIGNED` instead of `SIGNATURE_NO_VERIFIER` when
verifying a messages with no embedded signatures.
2021-07-16 12:17:18 +02:00
larabr
cd4adae9f2
Update error messages in passwordDecrypt (#124) 2021-07-05 10:42:18 +02:00