类 CryptoModuleBase

  • 所有已实现的接口:
    CryptoModule
    直接已知子类:
    CryptoModuleAE

    public abstract class CryptoModuleBase
    extends java.lang.Object
    implements CryptoModule
    Common implementation for different COS cryptographic modules.
    • 字段详细资料

      • DEFAULT_BUFFER_SIZE

        protected static final int DEFAULT_BUFFER_SIZE
        另请参阅:
        常量字段值
      • cryptoScheme

        protected final com.tencent.cos.xml.crypto.COSCryptoScheme cryptoScheme
      • contentCryptoScheme

        protected final com.tencent.cos.xml.crypto.ContentCryptoScheme contentCryptoScheme
      • multipartUploadContexts

        protected final java.util.Map<java.lang.String,​MultipartUploadCryptoContext> multipartUploadContexts
        Map of data about in progress encrypted multipart uploads.
    • 方法详细资料

      • ciphertextLength

        protected abstract long ciphertextLength​(long plaintextLength)
        Returns the length of the ciphertext computed from the length of the plaintext.
        参数:
        plaintextLength - a non-negative number
        返回:
        a non-negative number
      • putObjectSecurely

        public PutObjectResult putObjectSecurely​(PutObjectRequest req)
                                          throws com.tencent.cos.xml.exception.CosXmlClientException,
                                                 com.tencent.cos.xml.exception.CosXmlServiceException
        指定者:
        putObjectSecurely 在接口中 CryptoModule
        抛出:
        com.tencent.cos.xml.exception.CosXmlClientException
        com.tencent.cos.xml.exception.CosXmlServiceException
      • hasMultipartUploadContext

        public boolean hasMultipartUploadContext​(java.lang.String uploadId)
      • uploadPartSecurely

        public com.tencent.cos.xml.model.object.UploadPartResult uploadPartSecurely​(com.tencent.cos.xml.model.object.UploadPartRequest req)
                                                                             throws com.tencent.cos.xml.exception.CosXmlClientException,
                                                                                    com.tencent.cos.xml.exception.CosXmlServiceException

        NOTE: Because the encryption process requires context from previous blocks, parts uploaded with the COSEncryptionClient (as opposed to the normal COSClient) must be uploaded serially, and in order. Otherwise, the previous encryption context isn't available to use when encrypting the current part.

        指定者:
        uploadPartSecurely 在接口中 CryptoModule
        抛出:
        com.tencent.cos.xml.exception.CosXmlClientException
        com.tencent.cos.xml.exception.CosXmlServiceException
      • uploadPartAsyncSecurely

        public void uploadPartAsyncSecurely​(com.tencent.cos.xml.model.object.UploadPartRequest req,
                                            com.tencent.cos.xml.listener.CosXmlResultListener resultListener)
        指定者:
        uploadPartAsyncSecurely 在接口中 CryptoModule
      • newMultipartCOSCipherInputStream

        public final CipherLiteInputStream newMultipartCOSCipherInputStream​(com.tencent.cos.xml.model.object.UploadPartRequest req,
                                                                            com.tencent.cos.xml.crypto.CipherLite cipherLite)
                                                                     throws com.tencent.cos.xml.exception.CosXmlClientException
        抛出:
        com.tencent.cos.xml.exception.CosXmlClientException
      • updateMetadataWithContentCryptoMaterial

        protected final ObjectMetadata updateMetadataWithContentCryptoMaterial​(ObjectMetadata metadata,
                                                                               com.tencent.cos.xml.crypto.ContentCryptoMaterial instruction)
                                                                        throws com.tencent.cos.xml.exception.CosXmlClientException
        抛出:
        com.tencent.cos.xml.exception.CosXmlClientException
      • createContentCryptoMaterial

        protected final com.tencent.cos.xml.crypto.ContentCryptoMaterial createContentCryptoMaterial​(com.tencent.cos.xml.model.CosXmlRequest req)
                                                                                              throws com.tencent.cos.xml.exception.CosXmlClientException
        Creates and returns a non-null content crypto material for the given request.
        抛出:
        com.tencent.cos.xml.exception.CosXmlClientException - if no encryption material can be found.
      • generateCEK

        protected final javax.crypto.SecretKey generateCEK​(EncryptionMaterials kekMaterials,
                                                           java.security.Provider providerIn)
                                                    throws com.tencent.cos.xml.exception.CosXmlClientException
        参数:
        kekMaterials - non-null encryption materials
        抛出:
        com.tencent.cos.xml.exception.CosXmlClientException
      • wrapWithCipher

        protected final PutObjectRequest wrapWithCipher​(PutObjectRequest request,
                                                        com.tencent.cos.xml.crypto.ContentCryptoMaterial cekMaterial)
                                                 throws com.tencent.cos.xml.exception.CosXmlClientException
        Returns the given PutObjectRequest but has the content as input stream wrapped with a cipher, and configured with some meta data and user metadata.
        抛出:
        com.tencent.cos.xml.exception.CosXmlClientException
      • newCOSCipherLiteInputStream

        public CipherLiteInputStream newCOSCipherLiteInputStream​(PutObjectRequest req,
                                                                 com.tencent.cos.xml.crypto.CipherLite cipherLite)
                                                          throws com.tencent.cos.xml.exception.CosXmlClientException
        抛出:
        com.tencent.cos.xml.exception.CosXmlClientException
      • plaintextLength

        protected final long plaintextLength​(PutObjectRequest request,
                                             ObjectMetadata metadata)
        Returns the plaintext length from the request and metadata; or -1 if unknown.
      • getCOSCryptoScheme

        public final com.tencent.cos.xml.crypto.COSCryptoScheme getCOSCryptoScheme()