Documentation
¶
Index ¶
- Constants
- func NewCertExchangeTokenSource(info oauth.CertExchangeInfo, credentials oauth.ClientCredentials, ...) (auth.AccessTokenSource, error)
- func SanitizePlatformEndpoint(e string) (string, error)
- func SizeOfAuthTagForCipher(cipherType CipherMode) (int, error)
- type Assertion
- type CertExchangeTokenSource
- type CipherMode
- type EncryptedMetadata
- type EncryptionInformation
- type Error
- type IDPAccessTokenSource
- type IDPTokenExchangeTokenSource
- type IntegrityAlgorithm
- type IntegrityInformation
- type KASClient
- type KASInfo
- type KeyAccess
- type Manifest
- type Method
- type NanoKASInfo
- type NanoTDFConfig
- type NanoTDFHeader
- type NanoTDFOption
- type Option
- func WithClientCredentials(clientID, clientSecret string, scopes []string) Option
- func WithCustomAuthorizationConnection(conn *grpc.ClientConn) Option
- func WithCustomEntityResolutionConnection(conn *grpc.ClientConn) Option
- func WithCustomPolicyConnection(conn *grpc.ClientConn) Option
- func WithCustomWellknownConnection(conn *grpc.ClientConn) Option
- func WithExtraDialOptions(dialOptions ...grpc.DialOption) Option
- func WithIPC() Option
- func WithInsecurePlaintextConn() Option
- func WithInsecureSkipVerifyConn() Option
- func WithNoKIDInKAO() Option
- func WithPlatformConfiguration(platformConfiguration PlatformConfiguration) Option
- func WithSessionEncryptionRSA(key *rsa.PrivateKey) Option
- func WithSessionSignerRSA(key *rsa.PrivateKey) Option
- func WithTLSCredentials(tls *tls.Config, audience []string) Option
- func WithTokenEndpoint(tokenEndpoint string) Option
- func WithTokenExchange(subjectToken string, audience []string) Option
- type Payload
- type PlatformConfiguration
- type PolicyBinding
- type PolicyBody
- type PolicyObject
- type Reader
- func (r *Reader) DataAttributes() ([]string, error)
- func (r *Reader) Init(ctx context.Context) error
- func (r *Reader) Manifest() Manifest
- func (r *Reader) Policy() (PolicyObject, error)
- func (r *Reader) Read(p []byte) (int, error)
- func (r *Reader) ReadAt(buf []byte, offset int64) (int, error)
- func (r *Reader) UnencryptedMetadata() ([]byte, error)
- func (r *Reader) WriteTo(writer io.Writer) (int64, error)
- type RequestBody
- type ResourceLocator
- type RootSignature
- type SDK
- func (s SDK) Close() error
- func (s SDK) Conn() *grpc.ClientConn
- func (s SDK) CreateNanoTDF(writer io.Writer, reader io.Reader, config NanoTDFConfig) (uint32, error)
- func (s SDK) CreateTDF(writer io.Writer, reader io.ReadSeeker, opts ...TDFOption) (*TDFObject, error)
- func (s SDK) CreateTDFContext(ctx context.Context, writer io.Writer, reader io.ReadSeeker, opts ...TDFOption) (*TDFObject, error)
- func (s SDK) LoadTDF(reader io.ReadSeeker) (*Reader, error)
- func (s SDK) NewNanoTDFConfig() (*NanoTDFConfig, error)
- func (s SDK) PlatformIssuer() string
- func (s SDK) ReadNanoTDF(writer io.Writer, reader io.ReadSeeker) (uint32, error)
- func (s SDK) ReadNanoTDFContext(ctx context.Context, writer io.Writer, reader io.ReadSeeker) (uint32, error)
- type Segment
- type TDFConfig
- type TDFFormat
- type TDFObject
- type TDFOption
- func WithAutoconfigure(enable bool) TDFOption
- func WithDataAttributeValues(attributes ...*policy.Value) TDFOption
- func WithDataAttributes(attributes ...string) TDFOption
- func WithKasInformation(kasInfoList ...KASInfo) TDFOption
- func WithMetaData(metaData string) TDFOption
- func WithMimeType(mimeType string) TDFOption
- func WithSegmentSize(size int64) TDFOption
Constants ¶
const ( // Failure while connecting to a service. // Check your configuration and/or retry. ErrGrpcDialFailed = Error("failed to dial grpc endpoint") ErrShutdownFailed = Error("failed to shutdown sdk") ErrPlatformConfigFailed = Error("failed to retrieve platform configuration") ErrPlatformEndpointMalformed = Error("platform endpoint is malformed") )
const ( JSONFormat = iota XMLFormat )
const ( HS256 = iota GMAC )
const (
ErrNanoTDFHeaderRead = Error("nanoTDF read error")
)
Variables ¶
This section is empty.
Functions ¶
func NewCertExchangeTokenSource ¶ added in v0.2.1
func NewCertExchangeTokenSource(info oauth.CertExchangeInfo, credentials oauth.ClientCredentials, idpTokenEndpoint string, dpop *ocrypto.RsaKeyPair) (auth.AccessTokenSource, error)
func SanitizePlatformEndpoint ¶ added in v0.2.7
func SizeOfAuthTagForCipher ¶ added in v0.2.4
func SizeOfAuthTagForCipher(cipherType CipherMode) (int, error)
SizeOfAuthTagForCipher - Return the size in bytes of auth tag to be used for aes gcm encryption
Types ¶
type CertExchangeTokenSource ¶ added in v0.2.1
type CertExchangeTokenSource struct { auth.AccessTokenSource IdpEndpoint string // contains filtered or unexported fields }
func (*CertExchangeTokenSource) AccessToken ¶ added in v0.2.1
func (c *CertExchangeTokenSource) AccessToken(ctx context.Context, _ *http.Client) (auth.AccessToken, error)
type CipherMode ¶ added in v0.2.4
type CipherMode int
type EncryptedMetadata ¶
type EncryptionInformation ¶
type EncryptionInformation struct { KeyAccessType string `json:"type"` Policy string `json:"policy"` KeyAccessObjs []KeyAccess `json:"keyAccess"` Method Method `json:"method"` IntegrityInformation `json:"integrityInformation"` }
type IDPAccessTokenSource ¶
type IDPAccessTokenSource struct {
// contains filtered or unexported fields
}
IDPAccessTokenSource credentials that allow us to connect to an IDP and obtain an access token that is bound to a DPoP key
func NewIDPAccessTokenSource ¶
func NewIDPAccessTokenSource( credentials oauth.ClientCredentials, idpTokenEndpoint string, scopes []string, key *ocrypto.RsaKeyPair) (*IDPAccessTokenSource, error)
func (*IDPAccessTokenSource) AccessToken ¶
func (t *IDPAccessTokenSource) AccessToken(ctx context.Context, client *http.Client) (auth.AccessToken, error)
AccessToken use a pointer receiver so that the token state is shared
type IDPTokenExchangeTokenSource ¶
type IDPTokenExchangeTokenSource struct { IDPAccessTokenSource oauth.TokenExchangeInfo }
func NewIDPTokenExchangeTokenSource ¶
func NewIDPTokenExchangeTokenSource(exchangeInfo oauth.TokenExchangeInfo, credentials oauth.ClientCredentials, idpTokenEndpoint string, scopes []string, key *ocrypto.RsaKeyPair) (*IDPTokenExchangeTokenSource, error)
func (*IDPTokenExchangeTokenSource) AccessToken ¶
func (i *IDPTokenExchangeTokenSource) AccessToken(ctx context.Context, client *http.Client) (auth.AccessToken, error)
type IntegrityAlgorithm ¶
type IntegrityAlgorithm = int
type IntegrityInformation ¶
type IntegrityInformation struct { RootSignature `json:"rootSignature"` SegmentHashAlgorithm string `json:"segmentHashAlg"` DefaultSegmentSize int64 `json:"segmentSizeDefault"` DefaultEncryptedSegSize int64 `json:"encryptedSegmentSizeDefault"` Segments []Segment `json:"segments"` }
type KASInfo ¶
type KASInfo struct { // URL of the KAS server URL string // Public key can be empty. // If it is empty, the public key will be fetched from the KAS server. PublicKey string // Key identifier associated with the given key, if present. KID string // The algorithm associated with this key Algorithm string // If this KAS should be used as the default for 'encrypt' calls Default bool }
KASInfo contains Key Access Server information.
type KeyAccess ¶
type KeyAccess struct { KeyType string `json:"type"` KasURL string `json:"url"` Protocol string `json:"protocol"` WrappedKey string `json:"wrappedKey"` PolicyBinding interface{} `json:"policyBinding"` EncryptedMetadata string `json:"encryptedMetadata,omitempty"` KID string `json:"kid,omitempty"` SplitID string `json:"sid,omitempty"` }
type Manifest ¶
type Manifest struct { EncryptionInformation `json:"encryptionInformation"` Payload `json:"payload"` }
type NanoKASInfo ¶ added in v0.2.4
type NanoKASInfo struct {
// contains filtered or unexported fields
}
type NanoTDFConfig ¶ added in v0.2.4
type NanoTDFConfig struct {
// contains filtered or unexported fields
}
func (*NanoTDFConfig) EnableECDSAPolicyBinding ¶ added in v0.2.5
func (config *NanoTDFConfig) EnableECDSAPolicyBinding()
EnableECDSAPolicyBinding enable ecdsa policy binding
func (*NanoTDFConfig) SetAttributes ¶ added in v0.2.4
func (config *NanoTDFConfig) SetAttributes(attributes []string) error
SetAttributes - set the attributes to be used for this nanoTDF
func (*NanoTDFConfig) SetKasURL ¶ added in v0.2.4
func (config *NanoTDFConfig) SetKasURL(url string) error
SetKasURL - set the URL of the KAS endpoint to be used for this nanoTDF
type NanoTDFHeader ¶ added in v0.2.4
type NanoTDFHeader struct { EphemeralKey []byte EncryptedPolicyBody []byte // contains filtered or unexported fields }
func NewNanoTDFHeaderFromReader ¶ added in v0.2.4
func NewNanoTDFHeaderFromReader(reader io.Reader) (NanoTDFHeader, uint32, error)
func (*NanoTDFHeader) ECCurve ¶ added in v0.2.5
func (header *NanoTDFHeader) ECCurve() (elliptic.Curve, error)
func (*NanoTDFHeader) GetCipher ¶ added in v0.2.4
func (header *NanoTDFHeader) GetCipher() CipherMode
GetCipher -- get the cipher from the nano tdf header
func (*NanoTDFHeader) IsEcdsaBindingEnabled ¶ added in v0.2.5
func (header *NanoTDFHeader) IsEcdsaBindingEnabled() bool
func (*NanoTDFHeader) VerifyPolicyBinding ¶ added in v0.2.5
func (header *NanoTDFHeader) VerifyPolicyBinding() (bool, error)
type NanoTDFOption ¶ added in v0.2.4
type NanoTDFOption func(*NanoTDFConfig) error
func WithECDSAPolicyBinding ¶ added in v0.2.5
func WithECDSAPolicyBinding() NanoTDFOption
WithECDSAPolicyBinding enable ecdsa policy binding
func WithNanoDataAttributes ¶ added in v0.2.4
func WithNanoDataAttributes(attributes ...string) NanoTDFOption
WithNanoDataAttributes appends the given data attributes to the bound policy
func WithNanoKasInformation ¶ added in v0.2.4
func WithNanoKasInformation(kasInfoList ...NanoKASInfo) NanoTDFOption
WithNanoKasInformation adds the first kas url and its corresponding public key that is required to create and read the nanotdf. Note that only the first entry is used, as multi-kas is not supported for nanotdf
type Option ¶
type Option func(*config)
func WithClientCredentials ¶
WithClientCredentials returns an Option that sets up authentication with client credentials.
func WithCustomAuthorizationConnection ¶
func WithCustomAuthorizationConnection(conn *grpc.ClientConn) Option
func WithCustomEntityResolutionConnection ¶ added in v0.2.3
func WithCustomEntityResolutionConnection(conn *grpc.ClientConn) Option
func WithCustomPolicyConnection ¶
func WithCustomPolicyConnection(conn *grpc.ClientConn) Option
func WithCustomWellknownConnection ¶ added in v0.2.5
func WithCustomWellknownConnection(conn *grpc.ClientConn) Option
func WithExtraDialOptions ¶
func WithExtraDialOptions(dialOptions ...grpc.DialOption) Option
func WithIPC ¶ added in v0.2.7
func WithIPC() Option
WithIPC returns an Option that indicates the SDK should use IPC for communication this will allow the platform endpoint to be an empty string
func WithInsecurePlaintextConn ¶ added in v0.2.1
func WithInsecurePlaintextConn() Option
WithInsecurePlaintextConn returns an Option that sets up HTTP connection sent in the clear.
func WithInsecureSkipVerifyConn ¶ added in v0.2.1
func WithInsecureSkipVerifyConn() Option
WithInsecureSkipVerifyConn returns an Option that sets up HTTPS connection without verification.
func WithNoKIDInKAO ¶ added in v0.2.8
func WithNoKIDInKAO() Option
WithNoKIDInKAO disables storing the KID in the KAO. This allows generating TDF files that are compatible with legacy file formats (no KID).
func WithPlatformConfiguration ¶ added in v0.2.5
func WithPlatformConfiguration(platformConfiguration PlatformConfiguration) Option
WithPlatformConfiguration allows you to override the remote platform configuration Use this option with caution, as it may lead to unexpected behavior
func WithSessionEncryptionRSA ¶ added in v0.2.4
func WithSessionEncryptionRSA(key *rsa.PrivateKey) Option
The session key pair is used to encrypt responses from KAS for a given session and can be reused across an entire session. Please use with caution.
func WithSessionSignerRSA ¶ added in v0.2.4
func WithSessionSignerRSA(key *rsa.PrivateKey) Option
The DPoP key pair is used to implement sender constrained tokens from the identity provider, and should be associated with the lifetime of a session for a given identity. Please use with caution.
func WithTLSCredentials ¶ added in v0.2.1
func WithTokenEndpoint ¶
WithTokenEndpoint When we implement service discovery using a .well-known endpoint this option may become deprecated Deprecated: SDK will discover the token endpoint from the platform configuration
func WithTokenExchange ¶
WithTokenExchange specifies that the SDK should obtain its access token by exchanging the given token for a new one
type PlatformConfiguration ¶ added in v0.2.5
type PlatformConfiguration map[string]interface{}
type PolicyBinding ¶ added in v0.3.3
type PolicyBody ¶
type PolicyBody struct {
// contains filtered or unexported fields
}
type PolicyObject ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Loads and reads ZTDF files
func (*Reader) DataAttributes ¶
DataAttributes return the data attributes present in tdf.
func (*Reader) Init ¶ added in v0.2.11
Do any network based operations required. This allows making the requests cancellable
func (*Reader) Policy ¶
func (r *Reader) Policy() (PolicyObject, error)
Policy returns a copy of the policy object in manifest, if it is valid. Otherwise, returns an error.
func (*Reader) Read ¶
Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. It returns an io.EOF error when the stream ends.
func (*Reader) ReadAt ¶
ReadAt reads len(p) bytes into p starting at offset off in the underlying input source. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. It returns an io.EOF error when the stream ends. NOTE: For larger tdf sizes use sdk.GetTDFPayload for better performance
func (*Reader) UnencryptedMetadata ¶
UnencryptedMetadata return decrypted metadata in manifest.
type RequestBody ¶
type ResourceLocator ¶ added in v0.2.4
type ResourceLocator struct {
// contains filtered or unexported fields
}
ResourceLocator - structure to contain a protocol + body comprising an URL
func NewResourceLocator ¶ added in v0.2.4
func NewResourceLocator(url string) (*ResourceLocator, error)
func NewResourceLocatorFromReader ¶ added in v0.2.4
func NewResourceLocatorFromReader(reader io.Reader) (*ResourceLocator, error)
type RootSignature ¶
type SDK ¶
type SDK struct { Namespaces namespaces.NamespaceServiceClient Attributes attributes.AttributesServiceClient ResourceMapping resourcemapping.ResourceMappingServiceClient SubjectMapping subjectmapping.SubjectMappingServiceClient KeyAccessServerRegistry kasregistry.KeyAccessServerRegistryServiceClient Unsafe unsafe.UnsafeServiceClient Authorization authorization.AuthorizationServiceClient EntityResoution entityresolution.EntityResolutionServiceClient // contains filtered or unexported fields }
func (SDK) CreateNanoTDF ¶ added in v0.2.4
func (s SDK) CreateNanoTDF(writer io.Writer, reader io.Reader, config NanoTDFConfig) (uint32, error)
CreateNanoTDF - reads plain text from the given reader and saves it to the writer, subject to the given options
func (SDK) CreateTDF ¶
func (s SDK) CreateTDF(writer io.Writer, reader io.ReadSeeker, opts ...TDFOption) (*TDFObject, error)
CreateTDF reads plain text from the given reader and saves it to the writer, subject to the given options
func (SDK) CreateTDFContext ¶ added in v0.3.0
func (s SDK) CreateTDFContext(ctx context.Context, writer io.Writer, reader io.ReadSeeker, opts ...TDFOption) (*TDFObject, error)
CreateTDF reads plain text from the given reader and saves it to the writer, subject to the given options
func (SDK) LoadTDF ¶
func (s SDK) LoadTDF(reader io.ReadSeeker) (*Reader, error)
LoadTDF loads the tdf and prepare for reading the payload from TDF
func (SDK) NewNanoTDFConfig ¶ added in v0.2.4
func (s SDK) NewNanoTDFConfig() (*NanoTDFConfig, error)
NewNanoTDFConfig - Create a new instance of a nanoTDF config
func (SDK) PlatformIssuer ¶ added in v0.2.5
func (SDK) ReadNanoTDF ¶ added in v0.2.4
ReadNanoTDF - read the nano tdf and return the decrypted data from it
type TDFConfig ¶
type TDFConfig struct {
// contains filtered or unexported fields
}
TDFConfig Internal config struct for building TDF options.
type TDFOption ¶
func WithAutoconfigure ¶ added in v0.3.0
WithAutoconfigure toggles inferring KAS info for encrypt from data attributes. This will use the Attributes service to look up key access grants. These are KAS URLs associated with attributes. Defaults to enabled.
func WithDataAttributeValues ¶ added in v0.3.0
WithDataAttributeValues appends the given data attributes to the bound policy. Unlike `WithDataAttributes`, this will not trigger an attribute definition lookup during autoconfigure. That is, to use autoconfigure in an 'offline' context, you must first store the relevant attribute information locally and load it to the `CreateTDF` method with this option.
func WithDataAttributes ¶
WithDataAttributes appends the given data attributes to the bound policy
func WithKasInformation ¶
WithKasInformation adds all the kas urls and their corresponding public keys that is required to create and read the tdf. For writing TDFs, this is optional, but adding it can bypass key lookup.
During creation, if the public key is set, the kas will not be contacted for the latest key. Please make sure to set the KID if the PublicKey is set to include a KID in any key wrappers.
func WithMetaData ¶
WithMetaData returns an Option that add metadata to TDF.
func WithMimeType ¶ added in v0.2.3
func WithSegmentSize ¶
WithSegmentSize returns an Option that set the default segment size to TDF.