Struct: s3crypto.CryptoRegistry

import "../ibm-cos-sdk-go/service/s3/s3crypto"

Overview

CryptoRegistry is a collection of registries for configuring a decryption client with different key wrapping algorithms, content encryption algorithms, and padders.

Implemented Interfaces

s3crypto.Cipher, s3manager.ReadSeekerWriteTo, s3manager.WriterReadFrom

Constructor Functions collapse

Method Summary collapse

Function Details

func NewCryptoRegistry() *CryptoRegistry

NewCryptoRegistry creates a new CryptoRegistry to which wrapping algorithms, content encryption ciphers, and padders can be registered for use with the DecryptionClientV2.



16
17
18
19
20
21
22
// File 'service/s3/s3crypto/crypto_registry.go', line 16

func NewCryptoRegistry() *CryptoRegistry { return &CryptoRegistry{ wrap: map[string]WrapEntry{}, cek: map[string]CEKEntry{}, padder: map[string]Padder{}, } }

Method Details

func (c *CryptoRegistry) AddCEK(name string, entry CEKEntry) error

AddCEK registers CEKEntry under the given name, returns an error if a CEKEntry is already present for the given name.

This method should only be used if you need to register custom content encryption algorithms. Please see the following methods for helpers to register AWS provided algorithms:

RegisterAESGCMContentCipher (AES/GCM) RegisterAESCBCContentCipher (AES/CBC)


93
94
95
96
97
98
99
100
101
102
// File 'service/s3/s3crypto/crypto_registry.go', line 93

func (c *CryptoRegistry) AddCEK(name string, entry CEKEntry) error { if entry == nil { return errNilCEKEntry } if _, ok := c.cek[name]; ok { return newErrDuplicateCEKEntry(name) } c.cek[name] = entry return nil }

func (c *CryptoRegistry) AddPadder(name string, padder Padder) error

AddPadder registers Padder under the given name, returns an error if a Padder is already present for the given name.

This method should only be used to register custom padder implementations not provided by AWS.



128
129
130
131
132
133
134
135
136
137
// File 'service/s3/s3crypto/crypto_registry.go', line 128

func (c *CryptoRegistry) AddPadder(name string, padder Padder) error { if padder == nil { return errNilPadder } if _, ok := c.padder[name]; ok { return newErrDuplicatePadderEntry(name) } c.padder[name] = padder return nil }

func (c *CryptoRegistry) AddWrap(name string, entry WrapEntry) error

AddWrap registers the provided WrapEntry under the given name, returns an error if a WrapEntry is already present for the given name.

This method should only be used if you need to register custom wrapping algorithms. Please see the following methods for helpers to register AWS provided algorithms:

RegisterKMSContextWrapWithAnyCMK (kms+context) RegisterKMSContextWrapWithCMK (kms+context) RegisterKMSWrapWithAnyCMK (kms) RegisterKMSWrapWithCMK (kms)


53
54
55
56
57
58
59
60
61
62
63
// File 'service/s3/s3crypto/crypto_registry.go', line 53

func (c *CryptoRegistry) AddWrap(name string, entry WrapEntry) error { if entry == nil { return errNilWrapEntry } if _, ok := c.wrap[name]; ok { return newErrDuplicateWrapEntry(name) } c.wrap[name] = entry return nil }

func (c CryptoRegistry) GetCEK(name string) (CEKEntry, bool)

GetCEK returns the CEKEntry identified by the given name. Returns false if the entry is not registered.



78
79
80
81
82
83
84
// File 'service/s3/s3crypto/crypto_registry.go', line 78

func (c CryptoRegistry) GetCEK(name string) (CEKEntry, bool) { if c.cek == nil { return nil, false } entry, ok := c.cek[name] return entry, ok }

func (c *CryptoRegistry) GetPadder(name string) (Padder, bool)

GetPadder returns the Padder identified by name. If the Padder is not present, returns false.



117
118
119
120
121
122
123
// File 'service/s3/s3crypto/crypto_registry.go', line 117

func (c *CryptoRegistry) GetPadder(name string) (Padder, bool) { if c.padder == nil { return nil, false } entry, ok := c.padder[name] return entry, ok }

func (c CryptoRegistry) GetWrap(name string) (WrapEntry, bool)

GetWrap returns the WrapEntry identified by the given name. Returns false if the entry is not registered.



35
36
37
38
39
40
41
// File 'service/s3/s3crypto/crypto_registry.go', line 35

func (c CryptoRegistry) GetWrap(name string) (WrapEntry, bool) { if c.wrap == nil { return nil, false } entry, ok := c.wrap[name] return entry, ok }

func (c *CryptoRegistry) RemoveCEK(name string) (CEKEntry, bool)

RemoveCEK removes the CEKEntry identified by name. If the entry is not present returns false.



105
106
107
108
109
110
111
112
113
114
// File 'service/s3/s3crypto/crypto_registry.go', line 105

func (c *CryptoRegistry) RemoveCEK(name string) (CEKEntry, bool) { if c.cek == nil { return nil, false } entry, ok := c.cek[name] if ok { delete(c.cek, name) } return entry, ok }

func (c *CryptoRegistry) RemovePadder(name string) (Padder, bool)

RemovePadder removes the Padder identified by name. If the entry is not present returns false.



140
141
142
143
144
145
146
147
148
149
// File 'service/s3/s3crypto/crypto_registry.go', line 140

func (c *CryptoRegistry) RemovePadder(name string) (Padder, bool) { if c.padder == nil { return nil, false } padder, ok := c.padder[name] if ok { delete(c.padder, name) } return padder, ok }

func (c *CryptoRegistry) RemoveWrap(name string) (WrapEntry, bool)

RemoveWrap removes the WrapEntry identified by name. If the WrapEntry is not present returns false.



66
67
68
69
70
71
72
73
74
75
// File 'service/s3/s3crypto/crypto_registry.go', line 66

func (c *CryptoRegistry) RemoveWrap(name string) (WrapEntry, bool) { if c.wrap == nil { return nil, false } entry, ok := c.wrap[name] if ok { delete(c.wrap, name) } return entry, ok }