mirror of
https://github.com/kairos-io/tpm-helpers.git
synced 2025-09-13 05:12:28 +00:00
Add TPM accessors
This commit is contained in:
26
tpm_encrypt_test.go
Normal file
26
tpm_encrypt_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package tpm_test
|
||||
|
||||
import (
|
||||
. "github.com/kairos-io/tpm-helpers"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("TPM Encryption", func() {
|
||||
Context("Blob", func() {
|
||||
It("encrypts a blob", func() {
|
||||
var encodedBlob []byte
|
||||
var err error
|
||||
By("Encoding the blob", func() {
|
||||
encodedBlob, err = EncodeBlob([]byte("foo"), EmulatedTPM)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
By("Decoding the blob", func() {
|
||||
foo, err := DecodeBlob(encodedBlob, EmulatedTPM)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(foo).To(Equal([]byte("foo")))
|
||||
})
|
||||
CloseEmulatedDevice()
|
||||
})
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user