Documentation
¶
Index ¶
- Constants
- func DecryptObjectDeterministic(ct []byte, context string, dek []byte) ([]byte, error)
- func DecryptObjectLinearOPE(ct []byte, dek []byte) (uint64, error)
- func DecryptObjectProbabilistic(ct []byte, dek []byte) ([]byte, error)
- func DenormalizeFloat32(v uint64) float32
- func DenormalizeFloat64(v uint64) float64
- func DenormalizeInt32(v uint64) int32
- func DenormalizeInt64(v uint64) int64
- func DenormalizeTime(v uint64) time.Time
- func DenormalizeTimeSeconds(v uint64) time.Time
- func DenormalizeUint32(v uint64) uint32
- func EncryptObjectDeterministic(pt []byte, context string, dek []byte) ([]byte, error)
- func EncryptObjectDeterministicFixed(pt []byte, context string, dek []byte) ([]byte, error)
- func EncryptObjectLinearOPE(plaintext uint64, dek []byte) ([]byte, error)
- func EncryptObjectProbabilistic(pt []byte, dek []byte) ([]byte, error)
- func GenerateEphemeralKeypair() (clientPriv [32]byte, clientPub [32]byte, err error)
- func NormalizeFloat32(v float32) uint64
- func NormalizeFloat64(v float64) uint64
- func NormalizeInt32(v int32) uint64
- func NormalizeInt64(v int64) uint64
- func NormalizeTime(t time.Time) uint64
- func NormalizeTimeSeconds(t time.Time) uint64
- func NormalizeUint32(v uint32) uint64
- func NormalizeValue(v any) (uint64, error)
- func UnwrapSingleDEK(ctx context.Context, config SessionConfig, wrappedDEK []byte, nonce []byte) ([]byte, error)
- type EnclaveSecureSession
- func (ess *EnclaveSecureSession) Close()
- func (ess *EnclaveSecureSession) GenerateDEK(ctx context.Context, tableHash string, count int) (generatedDEKs []GeneratedDEK, iek []byte, err error)
- func (ess *EnclaveSecureSession) GetAttestationInfo() map[string]any
- func (ess *EnclaveSecureSession) GetTableIEK(ctx context.Context, tableHash string) ([]byte, error)
- func (ess *EnclaveSecureSession) SessionUnwrap(ctx context.Context, items []enclaveproto.SessionUnwrapItem) (enclaveproto.SessionUnwrapResponse, error)
- func (ess *EnclaveSecureSession) UnsealDEK(ctx context.Context, encryptedDEK []byte, nonce []byte, objectID string) ([]byte, error)
- type GeneratedDEK
- type SessionConfig
Constants ¶
View Source
const ( AESKeySize = 32 // 256-bit AES key size GMCNonceSize = 12 // GCM standard nonce size )
Variables ¶
This section is empty.
Functions ¶
func DecryptObjectLinearOPE ¶
DecryptObjectLinearOPE decrypts data encrypted with EncryptObjectLinearOPE. Performs inverse linear transformation: pt = (ct - b) / a
func DenormalizeFloat32 ¶
func DenormalizeFloat64 ¶
func DenormalizeInt32 ¶
func DenormalizeInt64 ¶
func DenormalizeTime ¶
func DenormalizeTimeSeconds ¶
func DenormalizeUint32 ¶
func EncryptObjectLinearOPE ¶
WARNING: This is trivially breakable with known plaintext attacks TODO: Replace with a more secure OPE scheme (CRITICAL!!!!!) Could replace this algorithm with a ported version of pyope (https://github.com/tonyo/pyope), which implements Boldyreva's symmetric OPE scheme.
ct format: encrypted value (8 bytes)
func NormalizeFloat32 ¶
func NormalizeFloat64 ¶
func NormalizeInt32 ¶
func NormalizeInt64 ¶
func NormalizeTime ¶
Second-level normalization for time values to preserve order and allow range queries while encrypting with OPE.
func NormalizeTimeSeconds ¶
Use NormalizeTimeSeconds for historical dates or far-future timestamps
func NormalizeUint32 ¶
func NormalizeValue ¶
func UnwrapSingleDEK ¶
Types ¶
type EnclaveSecureSession ¶
type EnclaveSecureSession struct {
SessionId string
ClientPriv [32]byte // x25519 private key
ClientPub [32]byte // x25519 public key
EnclavePubRaw []byte // enclave's ephemeral public key (decoded)
SessionKey []byte // derived session key
ExpiresAt time.Time
Attestation []byte
ExpectedNonce []byte
AttestationVerified bool
AttestationResult *verificationResult
// contains filtered or unexported fields
}
func InitEnclaveSecureSession ¶
func InitEnclaveSecureSession(ctx context.Context, config SessionConfig) (*EnclaveSecureSession, error)
func (*EnclaveSecureSession) Close ¶
func (ess *EnclaveSecureSession) Close()
Close zeros out sensitive data
func (*EnclaveSecureSession) GenerateDEK ¶
func (ess *EnclaveSecureSession) GenerateDEK(ctx context.Context, tableHash string, count int) (generatedDEKs []GeneratedDEK, iek []byte, err error)
func (*EnclaveSecureSession) GetAttestationInfo ¶
func (ess *EnclaveSecureSession) GetAttestationInfo() map[string]any
func (*EnclaveSecureSession) GetTableIEK ¶
func (*EnclaveSecureSession) SessionUnwrap ¶
func (ess *EnclaveSecureSession) SessionUnwrap(ctx context.Context, items []enclaveproto.SessionUnwrapItem) (enclaveproto.SessionUnwrapResponse, error)
type GeneratedDEK ¶
type SessionConfig ¶
type SessionConfig struct {
// base URL of the proxy server
Endpoint string
// Tenant ID for authentication
TenantID string
// API Key for authentication
APIKey string
// PCR values you expect from the enclave
// Key: PCR index; Value: hex-encoded PCR hash
// Note: use "nitro-cli describe-eif --eif-path enclave.eif" to get these
ExpectedPCRs map[uint]string
// AWS Nitro Root CA certificate (optional)
RootCA *x509.Certificate
// Maximum age of the attestation document
MaxAttestationAge time.Duration
// Whether to verify PCR values
// Set to false during development, true in production
VerifyPCRs bool
// HTTPTimeout for requests
HTTPTimeout time.Duration
}
Click to show internal directories.
Click to hide internal directories.