@@ -24,22 +24,22 @@ import (
24
24
"github.com/google/go-tpm/tpm2"
25
25
)
26
26
27
- // windowsKey12 represents a Windows-managed key on a TPM1.2 TPM.
28
- type windowsKey12 struct {
27
+ // windowsAK12 represents a Windows-managed key on a TPM1.2 TPM.
28
+ type windowsAK12 struct {
29
29
hnd uintptr
30
30
pcpKeyName string
31
31
public []byte
32
32
}
33
33
34
- func newWindowsKey12 (hnd uintptr , pcpKeyName string , public []byte ) ak {
35
- return & windowsKey12 {
34
+ func newWindowsAK12 (hnd uintptr , pcpKeyName string , public []byte ) ak {
35
+ return & windowsAK12 {
36
36
hnd : hnd ,
37
37
pcpKeyName : pcpKeyName ,
38
38
public : public ,
39
39
}
40
40
}
41
41
42
- func (k * windowsKey12 ) marshal () ([]byte , error ) {
42
+ func (k * windowsAK12 ) marshal () ([]byte , error ) {
43
43
out := serializedKey {
44
44
Encoding : keyEncodingOSManaged ,
45
45
TPMVersion : TPMVersion12 ,
@@ -49,7 +49,7 @@ func (k *windowsKey12) marshal() ([]byte, error) {
49
49
return out .Serialize ()
50
50
}
51
51
52
- func (k * windowsKey12 ) activateCredential (t tpmBase , in EncryptedCredential ) ([]byte , error ) {
52
+ func (k * windowsAK12 ) activateCredential (t tpmBase , in EncryptedCredential ) ([]byte , error ) {
53
53
tpm , ok := t .(* windowsTPM )
54
54
if ! ok {
55
55
return nil , fmt .Errorf ("expected *windowsTPM, got %T" , t )
@@ -61,7 +61,7 @@ func (k *windowsKey12) activateCredential(t tpmBase, in EncryptedCredential) ([]
61
61
return decryptCredential (secretKey , in .Secret )
62
62
}
63
63
64
- func (k * windowsKey12 ) quote (tb tpmBase , nonce []byte , alg HashAlg ) (* Quote , error ) {
64
+ func (k * windowsAK12 ) quote (tb tpmBase , nonce []byte , alg HashAlg ) (* Quote , error ) {
65
65
if alg != HashSHA1 {
66
66
return nil , fmt .Errorf ("only SHA1 algorithms supported on TPM 1.2, not %v" , alg )
67
67
}
@@ -103,21 +103,21 @@ func (k *windowsKey12) quote(tb tpmBase, nonce []byte, alg HashAlg) (*Quote, err
103
103
}, nil
104
104
}
105
105
106
- func (k * windowsKey12 ) close (tpm tpmBase ) error {
106
+ func (k * windowsAK12 ) close (tpm tpmBase ) error {
107
107
return closeNCryptObject (k .hnd )
108
108
}
109
109
110
- func (k * windowsKey12 ) attestationParameters () AttestationParameters {
110
+ func (k * windowsAK12 ) attestationParameters () AttestationParameters {
111
111
return AttestationParameters {
112
112
Public : k .public ,
113
113
}
114
114
}
115
- func (k * windowsKey12 ) certify (tb tpmBase , handle interface {}) (* CertificationParameters , error ) {
115
+ func (k * windowsAK12 ) certify (tb tpmBase , handle interface {}) (* CertificationParameters , error ) {
116
116
return nil , fmt .Errorf ("not implemented" )
117
117
}
118
118
119
- // windowsKey20 represents a key bound to a TPM 2.0.
120
- type windowsKey20 struct {
119
+ // windowsAK20 represents a key bound to a TPM 2.0.
120
+ type windowsAK20 struct {
121
121
hnd uintptr
122
122
123
123
pcpKeyName string
@@ -127,8 +127,8 @@ type windowsKey20 struct {
127
127
createSignature []byte
128
128
}
129
129
130
- func newWindowsKey20 (hnd uintptr , pcpKeyName string , public , createData , createAttest , createSig []byte ) ak {
131
- return & windowsKey20 {
130
+ func newWindowsAK20 (hnd uintptr , pcpKeyName string , public , createData , createAttest , createSig []byte ) ak {
131
+ return & windowsAK20 {
132
132
hnd : hnd ,
133
133
pcpKeyName : pcpKeyName ,
134
134
public : public ,
@@ -138,7 +138,7 @@ func newWindowsKey20(hnd uintptr, pcpKeyName string, public, createData, createA
138
138
}
139
139
}
140
140
141
- func (k * windowsKey20 ) marshal () ([]byte , error ) {
141
+ func (k * windowsAK20 ) marshal () ([]byte , error ) {
142
142
out := serializedKey {
143
143
Encoding : keyEncodingOSManaged ,
144
144
TPMVersion : TPMVersion20 ,
@@ -152,15 +152,15 @@ func (k *windowsKey20) marshal() ([]byte, error) {
152
152
return out .Serialize ()
153
153
}
154
154
155
- func (k * windowsKey20 ) activateCredential (t tpmBase , in EncryptedCredential ) ([]byte , error ) {
155
+ func (k * windowsAK20 ) activateCredential (t tpmBase , in EncryptedCredential ) ([]byte , error ) {
156
156
tpm , ok := t .(* windowsTPM )
157
157
if ! ok {
158
158
return nil , fmt .Errorf ("expected *windowsTPM, got %T" , t )
159
159
}
160
160
return tpm .pcp .ActivateCredential (k .hnd , append (in .Credential , in .Secret ... ))
161
161
}
162
162
163
- func (k * windowsKey20 ) quote (tb tpmBase , nonce []byte , alg HashAlg ) (* Quote , error ) {
163
+ func (k * windowsAK20 ) quote (tb tpmBase , nonce []byte , alg HashAlg ) (* Quote , error ) {
164
164
t , ok := tb .(* windowsTPM )
165
165
if ! ok {
166
166
return nil , fmt .Errorf ("expected *windowsTPM, got %T" , tb )
@@ -177,11 +177,11 @@ func (k *windowsKey20) quote(tb tpmBase, nonce []byte, alg HashAlg) (*Quote, err
177
177
return quote20 (tpm , tpmKeyHnd , alg .goTPMAlg (), nonce )
178
178
}
179
179
180
- func (k * windowsKey20 ) close (tpm tpmBase ) error {
180
+ func (k * windowsAK20 ) close (tpm tpmBase ) error {
181
181
return closeNCryptObject (k .hnd )
182
182
}
183
183
184
- func (k * windowsKey20 ) attestationParameters () AttestationParameters {
184
+ func (k * windowsAK20 ) attestationParameters () AttestationParameters {
185
185
return AttestationParameters {
186
186
Public : k .public ,
187
187
CreateData : k .createData ,
@@ -190,7 +190,7 @@ func (k *windowsKey20) attestationParameters() AttestationParameters {
190
190
}
191
191
}
192
192
193
- func (k * windowsKey20 ) certify (tb tpmBase , handle interface {}) (* CertificationParameters , error ) {
193
+ func (k * windowsAK20 ) certify (tb tpmBase , handle interface {}) (* CertificationParameters , error ) {
194
194
t , ok := tb .(* windowsTPM )
195
195
if ! ok {
196
196
return nil , fmt .Errorf ("expected *windowsTPM, got %T" , tb )
0 commit comments