forked from TrueCloudLab/certificates
Fix linter warnings
This commit is contained in:
parent
54d92095ac
commit
e75e7e7cd6
2 changed files with 13 additions and 14 deletions
|
@ -50,7 +50,6 @@ linters-settings:
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
enable:
|
enable:
|
||||||
- deadcode
|
|
||||||
- gocritic
|
- gocritic
|
||||||
- gofmt
|
- gofmt
|
||||||
- gosimple
|
- gosimple
|
||||||
|
|
|
@ -355,9 +355,8 @@ func deviceAttest01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose
|
||||||
return acmeError
|
return acmeError
|
||||||
}
|
}
|
||||||
return storeError(ctx, db, ch, true, acmeError)
|
return storeError(ctx, db, ch, true, acmeError)
|
||||||
} else {
|
|
||||||
return WrapErrorISE(err, "error validating attestation")
|
|
||||||
}
|
}
|
||||||
|
return WrapErrorISE(err, "error validating attestation")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate nonce with SHA-256 of the token.
|
// Validate nonce with SHA-256 of the token.
|
||||||
|
@ -385,9 +384,8 @@ func deviceAttest01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose
|
||||||
return acmeError
|
return acmeError
|
||||||
}
|
}
|
||||||
return storeError(ctx, db, ch, true, acmeError)
|
return storeError(ctx, db, ch, true, acmeError)
|
||||||
} else {
|
|
||||||
return WrapErrorISE(err, "error validating attestation")
|
|
||||||
}
|
}
|
||||||
|
return WrapErrorISE(err, "error validating attestation")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate Apple's ClientIdentifier (Identifier.Value) with device
|
// Validate Apple's ClientIdentifier (Identifier.Value) with device
|
||||||
|
@ -625,20 +623,22 @@ func doStepAttestationFormat(ctx context.Context, ch *Challenge, jwk *jose.JSONW
|
||||||
return nil, NewError(ErrorBadAttestationStatement, "unsupported public key type %T", pub)
|
return nil, NewError(ErrorBadAttestationStatement, "unsupported public key type %T", pub)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse attestation data
|
// Parse attestation data:
|
||||||
|
// TODO(mariano): add support for other extensions.
|
||||||
data := &stepAttestationData{
|
data := &stepAttestationData{
|
||||||
Certificate: leaf,
|
Certificate: leaf,
|
||||||
}
|
}
|
||||||
for _, ext := range leaf.Extensions {
|
for _, ext := range leaf.Extensions {
|
||||||
switch {
|
if !ext.Id.Equal(oidYubicoSerialNumber) {
|
||||||
case ext.Id.Equal(oidYubicoSerialNumber):
|
continue
|
||||||
var serialNumber int
|
|
||||||
rest, err := asn1.Unmarshal(ext.Value, &serialNumber)
|
|
||||||
if err != nil || len(rest) > 0 {
|
|
||||||
return nil, WrapError(ErrorBadAttestationStatement, err, "error parsing serial number")
|
|
||||||
}
|
|
||||||
data.SerialNumber = strconv.Itoa(serialNumber)
|
|
||||||
}
|
}
|
||||||
|
var serialNumber int
|
||||||
|
rest, err := asn1.Unmarshal(ext.Value, &serialNumber)
|
||||||
|
if err != nil || len(rest) > 0 {
|
||||||
|
return nil, WrapError(ErrorBadAttestationStatement, err, "error parsing serial number")
|
||||||
|
}
|
||||||
|
data.SerialNumber = strconv.Itoa(serialNumber)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return data, nil
|
return data, nil
|
||||||
|
|
Loading…
Reference in a new issue