Documentation ¶
Index ¶
- Constants
- func NewKMSClient(cred *cos.Credential, region string) (*kms.Client, error)
- type Cipher
- type CipherData
- type ContentCipher
- type ContentCipherBuilder
- type CryptoClient
- type CryptoContext
- type CryptoDecrypter
- type CryptoEncrypter
- type CryptoObjectService
- func (s *CryptoObjectService) CompleteMultipartUpload(ctx context.Context, name, uploadID string, ...) (*cos.CompleteMultipartUploadResult, *cos.Response, error)
- func (s *CryptoObjectService) CopyPart(ctx context.Context, name, uploadID string, partNumber int, sourceURL string, ...) (*cos.CopyPartResult, *cos.Response, error)
- func (s *CryptoObjectService) Download(ctx context.Context, name string, filepath string, ...) (*cos.Response, error)
- func (s *CryptoObjectService) Get(ctx context.Context, name string, opt *cos.ObjectGetOptions, id ...string) (*cos.Response, error)
- func (s *CryptoObjectService) GetToFile(ctx context.Context, name, localpath string, opt *cos.ObjectGetOptions, ...) (*cos.Response, error)
- func (s *CryptoObjectService) InitiateMultipartUpload(ctx context.Context, name string, opt *cos.InitiateMultipartUploadOptions, ...) (*cos.InitiateMultipartUploadResult, *cos.Response, error)
- func (s *CryptoObjectService) MultiUpload(ctx context.Context, name string, filepath string, opt *cos.MultiUploadOptions) (*cos.CompleteMultipartUploadResult, *cos.Response, error)
- func (s *CryptoObjectService) Put(ctx context.Context, name string, r io.Reader, opt *cos.ObjectPutOptions) (*cos.Response, error)
- func (s *CryptoObjectService) PutFromFile(ctx context.Context, name, filePath string, opt *cos.ObjectPutOptions) (resp *cos.Response, err error)
- func (s *CryptoObjectService) Upload(ctx context.Context, name string, filepath string, opt *cos.MultiUploadOptions) (*cos.CompleteMultipartUploadResult, *cos.Response, error)
- func (s *CryptoObjectService) UploadPart(ctx context.Context, name, uploadID string, partNumber int, r io.Reader, ...) (*cos.Response, error)
- type Decrypter
- type Encrypter
- type Envelope
- type MasterCipher
- type MasterKMSCipher
Constants ¶
View Source
const ( COSClientSideEncryptionKey string = "x-cos-meta-client-side-encryption-key" COSClientSideEncryptionStart = "x-cos-meta-client-side-encryption-start" COSClientSideEncryptionCekAlg = "x-cos-meta-client-side-encryption-cek-alg" COSClientSideEncryptionWrapAlg = "x-cos-meta-client-side-encryption-wrap-alg" COSClientSideEncryptionMatDesc = "x-cos-meta-client-side-encryption-matdesc" COSClientSideEncryptionUnencryptedContentLength = "x-cos-meta-client-side-encryption-unencrypted-content-length" COSClientSideEncryptionUnencryptedContentMD5 = "x-cos-meta-client-side-encryption-unencrypted-content-md5" COSClientSideEncryptionDataSize = "x-cos-meta-client-side-encryption-data-size" COSClientSideEncryptionPartSize = "x-cos-meta-client-side-encryption-part-size" UserAgent = "User-Agent" )
View Source
const ( CosKmsCryptoWrap = "KMS/TencentCloud" AesCtrAlgorithm = "AES/CTR/NoPadding" EncryptionUaSuffix = "COSEncryptionClient" )
View Source
const (
KMSEndPoint = "kms.tencentcloudapi.com"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CipherData ¶
type CipherData struct { IV []byte Key []byte MatDesc string WrapAlgorithm string CEKAlgorithm string EncryptedIV []byte EncryptedKey []byte }
func (*CipherData) Clone ¶
func (cd *CipherData) Clone() CipherData
func (*CipherData) GetIV ¶
func (cd *CipherData) GetIV() uint64
func (*CipherData) RandomKeyIv ¶
func (cd *CipherData) RandomKeyIv(keyLen int, ivLen int) error
func (*CipherData) SeekIV ¶
func (cd *CipherData) SeekIV(startPos uint64)
func (*CipherData) SetIV ¶
func (cd *CipherData) SetIV(iv uint64)
type ContentCipher ¶
type ContentCipher interface { EncryptContent(io.Reader) (io.ReadCloser, error) DecryptContent(io.Reader) (io.ReadCloser, error) Clone(cd CipherData) (ContentCipher, error) GetEncryptedLen(int64) int64 GetCipherData() *CipherData GetAlignLen() int }
type ContentCipherBuilder ¶
type ContentCipherBuilder interface { ContentCipher() (ContentCipher, error) ContentCipherEnv(Envelope) (ContentCipher, error) GetMatDesc() string }
func CreateAesCtrBuilder ¶
func CreateAesCtrBuilder(cipher MasterCipher) ContentCipherBuilder
type CryptoClient ¶
type CryptoClient struct { *cos.Client Object *CryptoObjectService ContentCipherBuilder ContentCipherBuilder // contains filtered or unexported fields }
func NewCryptoClient ¶
func NewCryptoClient(client *cos.Client, masterCipher MasterCipher) *CryptoClient
type CryptoContext ¶
type CryptoContext struct { DataSize int64 PartSize int64 ContentCipher ContentCipher }
type CryptoDecrypter ¶
type CryptoDecrypter struct { Body io.Reader Decrypter io.Reader // contains filtered or unexported fields }
CryptoDecrypter provides close method for Decrypter
func (*CryptoDecrypter) Close ¶
func (rc *CryptoDecrypter) Close() error
Close lets the CryptoDecrypter satisfy io.ReadCloser interface
type CryptoEncrypter ¶
type CryptoEncrypter struct { Body io.Reader Encrypter io.Reader // contains filtered or unexported fields }
CryptoEncrypter provides close method for Encrypter
func (*CryptoEncrypter) Close ¶
func (rc *CryptoEncrypter) Close() error
Close lets the CryptoEncrypter satisfy io.ReadCloser interface
type CryptoObjectService ¶
type CryptoObjectService struct { *cos.ObjectService // contains filtered or unexported fields }
func (*CryptoObjectService) CompleteMultipartUpload ¶
func (s *CryptoObjectService) CompleteMultipartUpload(ctx context.Context, name, uploadID string, opt *cos.CompleteMultipartUploadOptions) (*cos.CompleteMultipartUploadResult, *cos.Response, error)
func (*CryptoObjectService) InitiateMultipartUpload ¶
func (s *CryptoObjectService) InitiateMultipartUpload(ctx context.Context, name string, opt *cos.InitiateMultipartUploadOptions, cryptoCtx *CryptoContext) (*cos.InitiateMultipartUploadResult, *cos.Response, error)
func (*CryptoObjectService) MultiUpload ¶
func (*CryptoObjectService) PutFromFile ¶
func (s *CryptoObjectService) PutFromFile(ctx context.Context, name, filePath string, opt *cos.ObjectPutOptions) (resp *cos.Response, err error)
func (*CryptoObjectService) UploadPart ¶
func (s *CryptoObjectService) UploadPart(ctx context.Context, name, uploadID string, partNumber int, r io.Reader, opt *cos.ObjectUploadPartOptions, cryptoCtx *CryptoContext) (*cos.Response, error)
type Envelope ¶
type MasterCipher ¶
type MasterCipher interface { Encrypt([]byte) ([]byte, error) Decrypt([]byte) ([]byte, error) GetWrapAlgorithm() string GetMatDesc() string }
func CreateMasterKMS ¶
type MasterKMSCipher ¶
func (*MasterKMSCipher) Decrypt ¶
func (kc *MasterKMSCipher) Decrypt(ciphertext []byte) ([]byte, error)
func (*MasterKMSCipher) Encrypt ¶
func (kc *MasterKMSCipher) Encrypt(plaintext []byte) ([]byte, error)
func (*MasterKMSCipher) GetMatDesc ¶
func (kc *MasterKMSCipher) GetMatDesc() string
func (*MasterKMSCipher) GetWrapAlgorithm ¶
func (kc *MasterKMSCipher) GetWrapAlgorithm() string
Click to show internal directories.
Click to hide internal directories.