-
Notifications
You must be signed in to change notification settings - Fork 1
/
to2-common.go
69 lines (54 loc) · 2.5 KB
/
to2-common.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package to2
import (
"github.com/fido-alliance/fdo-fido-conformance-server/core/device/common"
fdoshared "github.com/fido-alliance/fdo-fido-conformance-server/core/shared"
"github.com/fido-alliance/fdo-fido-conformance-server/core/shared/testcom"
)
var MaxDeviceMessageSize uint16 = 2048
var MaxOwnerServiceInfoSize uint16 = 2048
type To2Requestor struct {
SrvEntry common.SRVEntry
Credential fdoshared.WawDeviceCredential
KexSuiteName fdoshared.KexSuiteName
CipherSuiteName fdoshared.CipherSuiteName
AuthzHeader string
SessionKey fdoshared.SessionKeyInfo
XAKex []byte
XBKEXParams fdoshared.KeXParams
NonceTO2ProveOV60 fdoshared.FdoNonce
NonceTO2ProveDv61 fdoshared.FdoNonce
NonceTO2SetupDv64 fdoshared.FdoNonce
ProveOVHdr61PubKey fdoshared.FdoPublicKey
OvHmac fdoshared.HashOrHmac
Completed60 bool
Completed62 bool
Completed64 bool
}
func NewTo2Requestor(srvEntry common.SRVEntry, credential fdoshared.WawDeviceCredential, kexSuitName fdoshared.KexSuiteName, cipherSuitName fdoshared.CipherSuiteName) To2Requestor {
return To2Requestor{
SrvEntry: srvEntry,
Credential: credential,
KexSuiteName: kexSuitName,
CipherSuiteName: cipherSuitName,
}
}
func (h *To2Requestor) confCheckResponse(bodyBytes []byte, fdoTestID testcom.FDOTestID, httpStatusCode int) testcom.FDOTestState {
switch fdoTestID {
case testcom.ExpectGroupTests(testcom.FIDO_TEST_LIST_DOT_60, fdoTestID):
return testcom.ExpectAnyFdoError(bodyBytes, fdoTestID, fdoshared.MESSAGE_BODY_ERROR, httpStatusCode)
case testcom.ExpectGroupTests(testcom.FIDO_TEST_LIST_DOT_62, fdoTestID):
return testcom.ExpectAnyFdoError(bodyBytes, fdoTestID, fdoshared.MESSAGE_BODY_ERROR, httpStatusCode)
case testcom.ExpectGroupTests(testcom.FIDO_TEST_LIST_DOT_64, fdoTestID):
return testcom.ExpectAnyFdoError(bodyBytes, fdoTestID, fdoshared.MESSAGE_BODY_ERROR, httpStatusCode)
case testcom.ExpectGroupTests(testcom.FIDO_TEST_LIST_DOT_66, fdoTestID):
return testcom.ExpectAnyFdoError(bodyBytes, fdoTestID, fdoshared.MESSAGE_BODY_ERROR, httpStatusCode)
case testcom.ExpectGroupTests(testcom.FIDO_TEST_LIST_DOT_68, fdoTestID):
return testcom.ExpectAnyFdoError(bodyBytes, fdoTestID, fdoshared.MESSAGE_BODY_ERROR, httpStatusCode)
case testcom.ExpectGroupTests(testcom.FIDO_TEST_LIST_DOT_70, fdoTestID):
return testcom.ExpectAnyFdoError(bodyBytes, fdoTestID, fdoshared.MESSAGE_BODY_ERROR, httpStatusCode)
}
return testcom.FDOTestState{
Passed: false,
Error: "Unsupported test " + string(fdoTestID),
}
}