Skip to content

Commit

Permalink
Remove unused getCreationMethod()
Browse files Browse the repository at this point in the history
  • Loading branch information
marinthiercelin committed Dec 20, 2021
1 parent 7fd793d commit 32ed533
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
14 changes: 0 additions & 14 deletions crypto/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (

"github.com/ProtonMail/gopenpgp/v2/constants"
"github.com/ProtonMail/gopenpgp/v2/internal"
goerrors "github.com/pkg/errors"
)

var allowedHashes = []crypto.Hash{
Expand Down Expand Up @@ -160,16 +159,3 @@ func verifySignature(pubKeyEntries openpgp.EntityList, origText io.Reader, signa

return nil
}

func (sig *PGPSignature) getCreationTime() (int64, error) {
packets := packet.NewReader(bytes.NewReader(sig.Data))
p, err := packets.Next()
if err != nil {
return 0, goerrors.Wrap(err, "gopenpgp: Can't parse signature")
}
sigPacket, ok := p.(*packet.Signature)
if !ok {
return 0, errors.New("gopenpgp: non signature packet found")
}
return sigPacket.CreationTime.Unix(), nil
}
20 changes: 0 additions & 20 deletions crypto/signature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,6 @@ func TestVerifyBinDetachedSig(t *testing.T) {
}
}

func Test_Signature_getSignatureCreationTime(t *testing.T) {
message := NewPlainMessageFromString("Hello world!")
var time int64 = 1600000000
pgp.latestServerTime = time
defer func() {
pgp.latestServerTime = testTime
}()
signature, err := keyRingTestPrivate.SignDetached(message)
if err != nil {
t.Errorf("Got an error while generating the signature: %v", err)
}
actualTime, err := signature.getCreationTime()
if err != nil {
t.Errorf("Got an error while parsing the signature creation time: %v", err)
}
if time != actualTime {
t.Errorf("Expected creation time to be %d, got %d", time, actualTime)
}
}

func Test_KeyRing_GetVerifiedSignatureTimestampSuccess(t *testing.T) {
message := NewPlainMessageFromString("Hello world!")
var time int64 = 1600000000
Expand Down

0 comments on commit 32ed533

Please sign in to comment.