File tree 1 file changed +16
-2
lines changed
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ import (
29
29
"github.com/stretchr/testify/require"
30
30
)
31
31
32
- func TestTPMGeneratedKey (t * testing.T ) {
32
+ func TestTPM_loadCertificate (t * testing.T ) {
33
33
tpm , err := simulator .OpenSimulator ()
34
34
require .NoError (t , err )
35
35
defer tpm .Close ()
@@ -82,7 +82,21 @@ func TestTPMGeneratedKey(t *testing.T) {
82
82
assert .True (t , ok )
83
83
}
84
84
85
- func TestTPM_errors (t * testing.T ) {
85
+ func TestTPM_loadCertificate_error (t * testing.T ) {
86
+ tlsCfg := Config {
87
+ CertPem : "invalid" ,
88
+ KeyPem : "invalid" ,
89
+ TPMConfig : TPMConfig {
90
+ Enabled : true ,
91
+ Path : "simulator" ,
92
+ },
93
+ }
94
+ tlsCertificate , err := tlsCfg .loadCertificate ()
95
+ assert .Equal (t , "failed to load private key from TPM: failed to load TPM key: not an armored key" , err .Error ())
96
+ require .NotNil (t , tlsCertificate )
97
+ }
98
+
99
+ func TestTPM_tpmCertificate_errors (t * testing.T ) {
86
100
tpm , err := simulator .OpenSimulator ()
87
101
require .NoError (t , err )
88
102
defer tpm .Close ()
You can’t perform that action at this time.
0 commit comments