mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-19 21:04:39 -05:00
2d8fcd9bf4
Co-authored-by: Malte Poll <mp@edgeless.systems> Co-authored-by: katexochen <katexochen@users.noreply.github.com> Co-authored-by: Daniel Weiße <dw@edgeless.systems> Co-authored-by: Thomas Tendyck <tt@edgeless.systems> Co-authored-by: Benedict Schlueter <bs@edgeless.systems> Co-authored-by: leongross <leon.gross@rub.de> Co-authored-by: Moritz Eckert <m1gh7ym0@gmail.com>
31 lines
589 B
Go
31 lines
589 B
Go
//go:build aws
|
|
// +build aws
|
|
|
|
package aws
|
|
|
|
// #include <nitroattest.h>
|
|
import "C"
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
func NaAdGetVerifiedPayloadAsJson(adBlob []byte, rootCertDer []byte, ts time.Time) (string, error) {
|
|
jsonCstr := C.na_ad_get_verified_payload_as_json(
|
|
(*C.uint8_t)(&adBlob[0]),
|
|
C.size_t(len(adBlob)),
|
|
(*C.uint8_t)(&rootCertDer[0]),
|
|
C.size_t(len(rootCertDer)),
|
|
C.uint64_t(ts.Unix()),
|
|
)
|
|
jsonStr := C.GoString(jsonCstr)
|
|
C.na_str_free(jsonCstr)
|
|
|
|
if jsonStr == "" {
|
|
return "", fmt.Errorf("failed to verify attestation document: %s", adBlob)
|
|
}
|
|
|
|
return jsonStr, nil
|
|
}
|