mirror of
https://github.com/google/go-attestation.git
synced 2025-04-15 06:56:40 +00:00
Attempt to read the EK from NVRAM if the system cert store cannot provide it. (#35)
This commit is contained in:
parent
a801f7333b
commit
3dc8a7d841
@ -392,6 +392,16 @@ func (h *winPCP) EKCerts() ([]*x509.Certificate, error) {
|
||||
c = append(c, eccCerts...)
|
||||
}
|
||||
|
||||
// Reading the certificate from the system store has failed.
|
||||
// Lets try reading the raw bytes directly from NVRAM intead.
|
||||
if len(c) == 0 {
|
||||
buf, err = getNCryptBufferProperty(h.hProv, "PCP_EKNVCERT")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to read PCP_EKNVCERT: %v", err)
|
||||
}
|
||||
c = append(c, buf)
|
||||
}
|
||||
|
||||
var out []*x509.Certificate
|
||||
for _, der := range c {
|
||||
cert, err := x509.ParseCertificate(der)
|
||||
|
Loading…
x
Reference in New Issue
Block a user