Skip to content

Commit e549f4f

Browse files
committed
Add some debugging to PCP credential activation
1 parent 83d9767 commit e549f4f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

attest/pcp_windows.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"bytes"
2222
"crypto/x509"
2323
"encoding/binary"
24+
"encoding/hex"
2425
"fmt"
2526
"io"
2627
"syscall"
@@ -816,6 +817,9 @@ func (h *winPCP) ActivateCredential(hKey uintptr, activationBlob []byte) ([]byte
816817
return nil, err
817818
}
818819

820+
hexBlob := hex.EncodeToString(activationBlob)
821+
fmt.Println("activation blob", hexBlob)
822+
819823
r, _, msg := nCryptSetProperty.Call(hKey, uintptr(unsafe.Pointer(&utf16ActivationStr[0])), uintptr(unsafe.Pointer(&activationBlob[0])), uintptr(len(activationBlob)), 0)
820824
if r != 0 {
821825
if tpmErr := maybeWinErr(r); tpmErr != nil {
@@ -828,6 +832,10 @@ func (h *winPCP) ActivateCredential(hKey uintptr, activationBlob []byte) ([]byte
828832
var size uint32
829833
r, _, msg = nCryptGetProperty.Call(hKey, uintptr(unsafe.Pointer(&utf16ActivationStr[0])), uintptr(unsafe.Pointer(&secretBuff[0])), uintptr(len(secretBuff)), uintptr(unsafe.Pointer(&size)), 0)
830834
if r != 0 {
835+
fmt.Println("secret size", size)
836+
hexSecret := hex.EncodeToString(secretBuff)
837+
fmt.Println("secret blob", hexSecret)
838+
831839
if tpmErr := maybeWinErr(r); tpmErr != nil {
832840
msg = tpmErr
833841
}

0 commit comments

Comments
 (0)