类 CryptoModuleBase
- java.lang.Object
-
- com.tencent.cos.xml.crypto.CryptoModuleBase
-
- 所有已实现的接口:
CryptoModule
- 直接已知子类:
CryptoModuleAE
public abstract class CryptoModuleBase extends java.lang.Object implements CryptoModule
Common implementation for different COS cryptographic modules.
-
-
字段概要
字段 修饰符和类型 字段 说明 protected com.tencent.cos.xml.crypto.ContentCryptoSchemecontentCryptoSchemeprotected CosXmlSimpleServicecosprotected com.tencent.cos.xml.crypto.COSCryptoSchemecryptoSchemeprotected static intDEFAULT_BUFFER_SIZEprotected EncryptionMaterialsProviderkekMaterialsProviderprotected QCLOUDKMSkmsprotected java.util.Map<java.lang.String,MultipartUploadCryptoContext>multipartUploadContextsMap of data about in progress encrypted multipart uploads.
-
构造器概要
构造器 限定符 构造器 说明 protectedCryptoModuleBase(CosXmlSimpleService cos, com.tencent.qcloud.core.auth.QCloudCredentialProvider credentialsProvider, EncryptionMaterialsProvider kekMaterialsProvider)For testing purposes only.protectedCryptoModuleBase(QCLOUDKMS kms, CosXmlSimpleService cos, com.tencent.qcloud.core.auth.QCloudCredentialProvider credentialsProvider, EncryptionMaterialsProvider kekMaterialsProvider)
-
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected InitMultipartUploadRequestcipherInitMultipartUploadRequest(InitMultipartUploadRequest request)protected abstract longciphertextLength(long plaintextLength)Returns the length of the ciphertext computed from the length of the plaintext.CompleteMultiUploadResultcompleteMultipartUploadSecurely(CompleteMultiUploadRequest req)protected com.tencent.cos.xml.crypto.ContentCryptoMaterialcreateContentCryptoMaterial(com.tencent.cos.xml.model.CosXmlRequest req)Creates and returns a non-null content crypto material for the given request.protected javax.crypto.SecretKeygenerateCEK(EncryptionMaterials kekMaterials, java.security.Provider providerIn)com.tencent.cos.xml.crypto.COSCryptoSchemegetCOSCryptoScheme()MultipartUploadCryptoContextgetCryptoContext(java.lang.String uploadId)booleanhasMultipartUploadContext(java.lang.String uploadId)InitMultipartUploadResultinitMultipartUploadSecurely(InitMultipartUploadRequest request)CipherLiteInputStreamnewCOSCipherLiteInputStream(PutObjectRequest req, com.tencent.cos.xml.crypto.CipherLite cipherLite)CipherLiteInputStreamnewMultipartCOSCipherInputStream(com.tencent.cos.xml.model.object.UploadPartRequest req, com.tencent.cos.xml.crypto.CipherLite cipherLite)protected longplaintextLength(PutObjectRequest request, ObjectMetadata metadata)Returns the plaintext length from the request and metadata; or -1 if unknown.PutObjectResultputObjectSecurely(PutObjectRequest req)protected ObjectMetadataupdateMetadataWithContentCryptoMaterial(ObjectMetadata metadata, com.tencent.cos.xml.crypto.ContentCryptoMaterial instruction)voiduploadPartAsyncSecurely(com.tencent.cos.xml.model.object.UploadPartRequest req, com.tencent.cos.xml.listener.CosXmlResultListener resultListener)com.tencent.cos.xml.model.object.UploadPartResultuploadPartSecurely(com.tencent.cos.xml.model.object.UploadPartRequest req)protected PutObjectRequestwrapWithCipher(PutObjectRequest request, com.tencent.cos.xml.crypto.ContentCryptoMaterial cekMaterial)Returns the givenPutObjectRequestbut has the content as input stream wrapped with a cipher, and configured with some meta data and user metadata.-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 com.tencent.cos.xml.crypto.CryptoModule
getObjectSecurely
-
-
-
-
字段详细资料
-
DEFAULT_BUFFER_SIZE
protected static final int DEFAULT_BUFFER_SIZE
- 另请参阅:
- 常量字段值
-
kekMaterialsProvider
protected final EncryptionMaterialsProvider kekMaterialsProvider
-
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.
-
cos
protected final CosXmlSimpleService cos
-
kms
protected final QCLOUDKMS kms
-
-
构造器详细资料
-
CryptoModuleBase
protected CryptoModuleBase(QCLOUDKMS kms, CosXmlSimpleService cos, com.tencent.qcloud.core.auth.QCloudCredentialProvider credentialsProvider, EncryptionMaterialsProvider kekMaterialsProvider)
-
CryptoModuleBase
protected CryptoModuleBase(CosXmlSimpleService cos, com.tencent.qcloud.core.auth.QCloudCredentialProvider credentialsProvider, EncryptionMaterialsProvider kekMaterialsProvider)
For testing purposes only.
-
-
方法详细资料
-
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.CosXmlClientExceptioncom.tencent.cos.xml.exception.CosXmlServiceException
-
initMultipartUploadSecurely
public InitMultipartUploadResult initMultipartUploadSecurely(InitMultipartUploadRequest request) throws com.tencent.cos.xml.exception.CosXmlClientException, com.tencent.cos.xml.exception.CosXmlServiceException
- 指定者:
initMultipartUploadSecurely在接口中CryptoModule- 抛出:
com.tencent.cos.xml.exception.CosXmlClientExceptioncom.tencent.cos.xml.exception.CosXmlServiceException
-
hasMultipartUploadContext
public boolean hasMultipartUploadContext(java.lang.String uploadId)
-
getCryptoContext
public MultipartUploadCryptoContext getCryptoContext(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.CosXmlServiceExceptionNOTE: 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.CosXmlClientExceptioncom.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
-
completeMultipartUploadSecurely
public CompleteMultiUploadResult completeMultipartUploadSecurely(CompleteMultiUploadRequest req) throws com.tencent.cos.xml.exception.CosXmlClientException, com.tencent.cos.xml.exception.CosXmlServiceException
- 指定者:
completeMultipartUploadSecurely在接口中CryptoModule- 抛出:
com.tencent.cos.xml.exception.CosXmlClientExceptioncom.tencent.cos.xml.exception.CosXmlServiceException
-
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.CosXmlClientExceptionCreates 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 givenPutObjectRequestbut 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
-
cipherInitMultipartUploadRequest
protected final InitMultipartUploadRequest cipherInitMultipartUploadRequest(InitMultipartUploadRequest request)
-
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()
-
-