Skip to content

Add plaintext support for NanoTDF within the SDK #2178

@jrschumacher

Description

@jrschumacher

The current implementation of nanoTDF in the SDK only supports encrypted policy. The nanoTDF spec explicitly supports encrypted and plaintext policy.

The current need of plaintext policy is to both be compatible with Base TDF (ZTDF), but also to enable reading the policy for visibility trimming without the need to over-privledge service accounts.

See spec: https://github.com/opentdf/spec/blob/main/schema/nanotdf/README.md

Policy mode hardcoded as encrypted: https://github.com/opentdf/platform/blob/main/sdk/nanotdf.go#L502-L503

Policy body encrypted:

platform/sdk/nanotdf.go

Lines 547 to 554 in ee67026

const (
kIvLength = 12
)
iv := make([]byte, kIvLength)
cipherText, err := aesGcm.EncryptWithIVAndTagSize(iv, policyObjectAsStr, tagSize)
if err != nil {
return nil, 0, 0, fmt.Errorf("AesGcm.EncryptWithIVAndTagSize failed:%w", err)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions