Skip to content

Commit

Permalink
fix signed attributes validation
Browse files Browse the repository at this point in the history
  • Loading branch information
freigeistig committed Mar 8, 2024
1 parent bc9c2a2 commit 0ccffe5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/service/api/handlers/create_identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,12 @@ func validateSignedAttributes(signedAttributes, encapsulatedContent []byte, algo
return errors.Wrap(err, "failed to unmarshal ASN1 with params")
}

if len(signedAttributesASN1) < 2 {
return errors.New("signed attributes amount is less than 2")
if len(signedAttributesASN1) == 0 {
return errors.New("signed attributes amount is 0")
}

digestAttr := resources.DigestAttribute{}
if _, err := asn1.Unmarshal(signedAttributesASN1[1].FullBytes, &digestAttr); err != nil {
if _, err := asn1.Unmarshal(signedAttributesASN1[len(signedAttributesASN1)-1].FullBytes, &digestAttr); err != nil {
return errors.Wrap(err, "failed to unmarshal ASN1")
}

Expand Down

0 comments on commit 0ccffe5

Please sign in to comment.