This repository has been archived by the owner on Dec 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIDO Server conformance tests now passing 100% (#38)
* Moved COSE related things to their own package * move assertion to cose verify * Server-ServerPublicKeyCredentialCreationOptions-Req-1 * Update login.go * Fix packed attestation signature verification and added ServerResponse structure * Conformance testing fixes for MakeCredential * Conformance tests nearly complete * Initial metadata layout * Metadata progress * Further progress on metadata * Resolving conflict * Production and conformance metadata now load * Move SafetyNet to jwt-go and add sanity check for timestamp * Certificate checks on metadata TOC * Restrict timestamp check in safetynet to conformance only * Don't return safetynet x5c * Metadata (#1) * Moved COSE related things to their own package * move assertion to cose verify * Server-ServerPublicKeyCredentialCreationOptions-Req-1 * Update login.go * Fix packed attestation signature verification and added ServerResponse structure * Conformance testing fixes for MakeCredential * Conformance tests nearly complete * Initial metadata layout * Metadata progress * Further progress on metadata * Resolving conflict * Production and conformance metadata now load * Move SafetyNet to jwt-go and add sanity check for timestamp * Certificate checks on metadata TOC * Restrict timestamp check in safetynet to conformance only * Don't return safetynet x5c * SafetyNet timestamp check * Added metadata tests * Update metadata tests
- Loading branch information
Showing
10 changed files
with
342 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package metadata | ||
|
||
import ( | ||
"io/ioutil" | ||
"net/http" | ||
"testing" | ||
"time" | ||
|
||
jwt "github.com/dgrijalva/jwt-go" | ||
) | ||
|
||
func TestMetadataTOCParsing(t *testing.T) { | ||
Conformance = true | ||
httpClient := &http.Client{ | ||
Timeout: time.Second * 30, | ||
} | ||
|
||
tests := []struct { | ||
name string | ||
file string | ||
wantErr error | ||
}{ | ||
{ | ||
"success", | ||
"../testdata/MetadataTOCParsing-P1.jwt", | ||
nil, | ||
}, | ||
{ | ||
"verification_failure", | ||
"../testdata/MetadataTOCParsing-F1.jwt", | ||
errIntermediateCertRevoked, | ||
}, | ||
{ | ||
"intermediate_revoked", | ||
"../testdata/MetadataTOCParsing-F2.jwt", | ||
jwt.ErrECDSAVerification, | ||
}, | ||
{ | ||
"leaf_revoked", | ||
"../testdata/MetadataTOCParsing-F3.jwt", | ||
errLeafCertRevoked, | ||
}, | ||
{ | ||
"asn1_parse_error", | ||
"../testdata/MetadataTOCParsing-F4.jwt", | ||
errCRLUnavailable, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
b, _ := ioutil.ReadFile(tt.file) | ||
_, _, err := unmarshalMDSTOC(b, *httpClient) | ||
failed := true | ||
if err != nil { | ||
failed = (err.Error() != tt.wantErr.Error()) | ||
} else { | ||
failed = tt.wantErr != nil | ||
} | ||
if failed { | ||
t.Errorf("unmarshalMDSTOC() got %v, wanted %v", err, tt.wantErr) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func TestMetadataStatementParsing(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
file string | ||
hash string | ||
wantErr error | ||
}{ | ||
{ | ||
"success", | ||
"../testdata/TestMetadataStatementParsing-P1.json", | ||
"bEtEyoVkc-X-ypuFoAIj8s4xKKTZw3wzD7IuDnoBUE8", | ||
nil, | ||
}, | ||
{ | ||
"hash_value_mismatch", | ||
"../testdata/TestMetadataStatementParsing-F1.json", | ||
"eq28frELluGyBesOw_xE_10Tj25NG0pDS7Oa0DP2kVk", | ||
errHashValueMismatch, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
b, _ := ioutil.ReadFile(tt.file) | ||
_, err := unmarshalMetadataStatement(b, tt.hash) | ||
if err != tt.wantErr { | ||
t.Errorf("unmarshalMetadataStatement() error %v, wantErr %v", err, tt.wantErr) | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.
aa748d7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#86 #95