2
2
// Apptainer a Series of LF Projects LLC.
3
3
// For website terms of use, trademark policy, privacy policy and other
4
4
// project policies see https://lfprojects.org/policies
5
- // Copyright (c) 2020-2023 , Sylabs Inc. All rights reserved.
5
+ // Copyright (c) 2020-2024 , Sylabs Inc. All rights reserved.
6
6
// This software is licensed under a 3-clause BSD license. Please consult the LICENSE.md file
7
7
// distributed with the sources of this project regarding your rights to use or distribute this
8
8
// software.
@@ -20,6 +20,7 @@ import (
20
20
"testing"
21
21
22
22
"github.com/ProtonMail/go-crypto/openpgp"
23
+ "github.com/ProtonMail/go-crypto/openpgp/packet"
23
24
"github.com/apptainer/sif/v2/pkg/sif"
24
25
)
25
26
@@ -199,7 +200,7 @@ func TestNewGroupSigner(t *testing.T) {
199
200
200
201
for _ , tt := range tests {
201
202
t .Run (tt .name , func (t * testing.T ) {
202
- en := newClearsignEncoder (getTestEntity (t ), fixedTime )
203
+ en := newClearsignEncoder (getTestEntity (t ), & packet. Config { Time : fixedTime } )
203
204
204
205
s , err := newGroupSigner (en , tt .fi , tt .groupID , tt .opts ... )
205
206
if got , want := err , tt .wantErr ; ! errors .Is (got , want ) {
@@ -258,12 +259,12 @@ func TestGroupSigner_Sign(t *testing.T) {
258
259
}
259
260
260
261
e := getTestEntity (t )
261
- clearsign := newClearsignEncoder (e , fixedTime )
262
+ clearsign := newClearsignEncoder (e , & packet. Config { Time : fixedTime } )
262
263
263
264
encrypted := getTestEntity (t )
264
265
encrypted .PrivateKey .Encrypted = true
265
266
266
- clearsignEncrypted := newClearsignEncoder (encrypted , fixedTime )
267
+ clearsignEncrypted := newClearsignEncoder (encrypted , & packet. Config { Time : fixedTime } )
267
268
268
269
tests := []struct {
269
270
name string
@@ -453,6 +454,11 @@ func TestNewSigner(t *testing.T) {
453
454
},
454
455
wantErr : sif .ErrNoObjects ,
455
456
},
457
+ {
458
+ name : "NoKeyMaterial" ,
459
+ fi : oneGroupImage ,
460
+ wantErr : ErrNoKeyMaterial ,
461
+ },
456
462
{
457
463
name : "InvalidObjectID" ,
458
464
fi : oneGroupImage ,
@@ -824,6 +830,18 @@ func TestSigner_Sign(t *testing.T) {
824
830
OptVerifyWithKeyRing (openpgp.EntityList {e }),
825
831
},
826
832
},
833
+ {
834
+ name : "OptSignWithoutPGPSignatureSalt" ,
835
+ inputFile : "one-group.sif" ,
836
+ signOpts : []SignerOpt {
837
+ OptSignWithEntity (e ),
838
+ OptSignWithTime (fixedTime ),
839
+ OptSignWithoutPGPSignatureSalt (),
840
+ },
841
+ verifyOpts : []VerifierOpt {
842
+ OptVerifyWithKeyRing (openpgp.EntityList {e }),
843
+ },
844
+ },
827
845
}
828
846
829
847
for _ , tt := range tests {
0 commit comments