Add SIGNATURE_BAD_CONTEXT status to verification error.
Add a special status for verification errors that are caused by the signature context.
This commit is contained in:
parent
ad18d59548
commit
257c381604
4 changed files with 18 additions and 7 deletions
|
|
@ -75,7 +75,7 @@ func TestVerifyTextDetachedSig(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func checkVerificationError(t *testing.T, err error, expectedStatus int) { //nolint: unparam
|
||||
func checkVerificationError(t *testing.T, err error, expectedStatus int) {
|
||||
if err == nil {
|
||||
t.Fatalf("Expected a verification error")
|
||||
}
|
||||
|
|
@ -435,7 +435,7 @@ func Test_VerifyDetachedWithWrongContext(t *testing.T) {
|
|||
verificationContext,
|
||||
)
|
||||
// then
|
||||
checkVerificationError(t, err, constants.SIGNATURE_FAILED)
|
||||
checkVerificationError(t, err, constants.SIGNATURE_BAD_CONTEXT)
|
||||
}
|
||||
|
||||
func Test_VerifyDetachedWithMissingNonRequiredContext(t *testing.T) {
|
||||
|
|
@ -491,7 +491,7 @@ func Test_VerifyDetachedWithMissingRequiredContext(t *testing.T) {
|
|||
verificationContext,
|
||||
)
|
||||
// then
|
||||
checkVerificationError(t, err, constants.SIGNATURE_FAILED)
|
||||
checkVerificationError(t, err, constants.SIGNATURE_BAD_CONTEXT)
|
||||
}
|
||||
|
||||
func Test_VerifyDetachedWithMissingRequiredContextBeforeCutoff(t *testing.T) {
|
||||
|
|
@ -561,7 +561,7 @@ func Test_VerifyDetachedWithMissingRequiredContextAfterCutoff(t *testing.T) {
|
|||
verificationContext,
|
||||
)
|
||||
// then
|
||||
checkVerificationError(t, err, constants.SIGNATURE_FAILED)
|
||||
checkVerificationError(t, err, constants.SIGNATURE_BAD_CONTEXT)
|
||||
}
|
||||
|
||||
func Test_VerifyDetachedWithDoubleContext(t *testing.T) {
|
||||
|
|
@ -587,5 +587,5 @@ func Test_VerifyDetachedWithDoubleContext(t *testing.T) {
|
|||
verificationContext,
|
||||
)
|
||||
// then
|
||||
checkVerificationError(t, err, constants.SIGNATURE_FAILED)
|
||||
checkVerificationError(t, err, constants.SIGNATURE_BAD_CONTEXT)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue