File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ -----BEGIN PGP SIGNED MESSAGE-----
2+ Hash: SHA512
3+
4+ This is not JSON
5+ -----BEGIN PGP SIGNATURE-----
6+ Comment: generated with `gpg --homedir . --output invalid-cleartext.signature -u 08CD26E446E2E95249B7A405E932F44B23E8DD43 --clear-sign <<< "This is not JSON"`
7+
8+ iQGzBAEBCgAdFiEECM0m5Ebi6VJJt6QF6TL0SyPo3UMFAmi3YlcACgkQ6TL0SyPo
9+ 3UMjQwv/TGivmwhYT8p9F5akuyZ0vkPhB+K4vr+M2VX1vIFGzL6edDWiiRYmysiY
10+ KtTdrRNnCZo6YbcOgdeL2OUpNWeoEshGhV0TqI/kstUa4vRs30NQ3kHX23+mcaf4
11+ iWI0RDmc05MHFXmOzMaWlb91hZBTGhHwvvPinqMg24QRNH1z1OEsuyJ2oBxdSj/Y
12+ dvGaSy0j8FimbfZS9mbf4+wfAUzkQi4PNBg+21l0QnEgl663VgcOQXK412WKNWcW
13+ vQkSXRFkpJNFF3lWjT4asiAV3T/KHUEq+QZE9rOa945wB0hoE7bZPx2hfZw4Se9/
14+ KH9O/ZM5WR5GyKbQV/ELNQJkJaDLcM56rBAl2l8eUV+bd8a7QrULjKP0dAffg8t8
15+ TKWyCSKddtiuJnuidCPV/A1iij0sZiSMzxb+Y33zgIrWThnfggpi0Oo9MYlF5hqF
16+ kD3b4zV1+7EW5YCEGT8sYhPpp96c1JnJbXZX2ii0KECdhLNB/iv44rSjOcl82nOY
17+ pa03tP/x
18+ =RDU4
19+ -----END PGP SIGNATURE-----
Original file line number Diff line number Diff line change @@ -48,3 +48,17 @@ func TestGPGMESigningMechanismSupportsSigning(t *testing.T) {
4848 err = mech .SupportsSigning ()
4949 assert .NoError (t , err )
5050}
51+
52+ func TestGPGMESigningMechanismVerifyCleartext (t * testing.T ) {
53+ mech , err := newGPGSigningMechanismInDirectory (testGPGHomeDirectory )
54+ require .NoError (t , err )
55+ defer mech .Close ()
56+
57+ // Successful verification of a cleartext signature
58+ signature , err := os .ReadFile ("./fixtures/invalid-cleartext.signature" )
59+ require .NoError (t , err )
60+ content , signingFingerprint , err := mech .Verify (signature )
61+ require .NoError (t , err )
62+ assert .Equal (t , []byte ("This is not JSON\n " ), content )
63+ assert .Equal (t , TestKeyFingerprint , signingFingerprint )
64+ }
Original file line number Diff line number Diff line change 33package signature
44
55import (
6+ "os"
67 "testing"
78
89 "github.com/stretchr/testify/assert"
@@ -34,3 +35,17 @@ func TestSequoiaSigningMechanismSign(t *testing.T) {
3435 assert .Error (t , err )
3536 assert .IsType (t , SigningNotSupportedError ("" ), err )
3637}
38+
39+ func TestSequoiaSigningMechanismVerifyCleartext (t * testing.T ) {
40+ mech , err := newGPGSigningMechanismInDirectory (testGPGHomeDirectory )
41+ require .NoError (t , err )
42+ defer mech .Close ()
43+
44+ // Successful verification of a cleartext signature
45+ signature , err := os .ReadFile ("./fixtures/invalid-cleartext.signature" )
46+ require .NoError (t , err )
47+ content , signingFingerprint , err := mech .Verify (signature )
48+ require .NoError (t , err )
49+ assert .Equal (t , []byte ("This is not JSON\n " ), content )
50+ assert .Equal (t , TestKeyFingerprint , signingFingerprint )
51+ }
You can’t perform that action at this time.
0 commit comments