public abstract class CryptoModuleBase extends java.lang.Object implements CryptoModule
限定符和类型 | 字段和说明 |
---|---|
protected com.tencent.cos.xml.crypto.ContentCryptoScheme |
contentCryptoScheme |
protected CosXmlSimpleService |
cos |
protected com.tencent.cos.xml.crypto.COSCryptoScheme |
cryptoScheme |
protected static int |
DEFAULT_BUFFER_SIZE |
protected EncryptionMaterialsProvider |
kekMaterialsProvider |
protected QCLOUDKMS |
kms |
protected java.util.Map<java.lang.String,MultipartUploadCryptoContext> |
multipartUploadContexts
Map of data about in progress encrypted multipart uploads.
|
限定符 | 构造器和说明 |
---|---|
protected |
CryptoModuleBase(CosXmlSimpleService cos,
QCloudCredentialProvider credentialsProvider,
EncryptionMaterialsProvider kekMaterialsProvider)
For testing purposes only.
|
protected |
CryptoModuleBase(QCLOUDKMS kms,
CosXmlSimpleService cos,
QCloudCredentialProvider credentialsProvider,
EncryptionMaterialsProvider kekMaterialsProvider) |
限定符和类型 | 方法和说明 |
---|---|
protected InitMultipartUploadRequest |
cipherInitMultipartUploadRequest(InitMultipartUploadRequest request) |
protected abstract long |
ciphertextLength(long plaintextLength)
Returns the length of the ciphertext computed from the length of the plaintext.
|
CompleteMultiUploadResult |
completeMultipartUploadSecurely(CompleteMultiUploadRequest req) |
protected com.tencent.cos.xml.crypto.ContentCryptoMaterial |
createContentCryptoMaterial(CosXmlRequest req)
Creates and returns a non-null content crypto material for the given request.
|
protected javax.crypto.SecretKey |
generateCEK(EncryptionMaterials kekMaterials,
java.security.Provider providerIn) |
com.tencent.cos.xml.crypto.COSCryptoScheme |
getCOSCryptoScheme() |
MultipartUploadCryptoContext |
getCryptoContext(java.lang.String uploadId) |
boolean |
hasMultipartUploadContext(java.lang.String uploadId) |
InitMultipartUploadResult |
initMultipartUploadSecurely(InitMultipartUploadRequest request) |
CipherLiteInputStream |
newCOSCipherLiteInputStream(PutObjectRequest req,
com.tencent.cos.xml.crypto.CipherLite cipherLite) |
CipherLiteInputStream |
newMultipartCOSCipherInputStream(UploadPartRequest req,
com.tencent.cos.xml.crypto.CipherLite cipherLite) |
protected long |
plaintextLength(PutObjectRequest request,
ObjectMetadata metadata)
Returns the plaintext length from the request and metadata; or -1 if unknown.
|
PutObjectResult |
putObjectSecurely(PutObjectRequest req) |
protected ObjectMetadata |
updateMetadataWithContentCryptoMaterial(ObjectMetadata metadata,
com.tencent.cos.xml.crypto.ContentCryptoMaterial instruction) |
void |
uploadPartAsyncSecurely(UploadPartRequest req,
CosXmlResultListener resultListener) |
UploadPartResult |
uploadPartSecurely(UploadPartRequest req)
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.
|
protected PutObjectRequest |
wrapWithCipher(PutObjectRequest request,
com.tencent.cos.xml.crypto.ContentCryptoMaterial cekMaterial)
Returns the given
PutObjectRequest but has the content as input stream wrapped
with a cipher, and configured with some meta data and user metadata. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getObjectSecurely
protected static final int DEFAULT_BUFFER_SIZE
protected final EncryptionMaterialsProvider kekMaterialsProvider
protected final com.tencent.cos.xml.crypto.COSCryptoScheme cryptoScheme
protected final com.tencent.cos.xml.crypto.ContentCryptoScheme contentCryptoScheme
protected final java.util.Map<java.lang.String,MultipartUploadCryptoContext> multipartUploadContexts
protected final CosXmlSimpleService cos
protected final QCLOUDKMS kms
protected CryptoModuleBase(QCLOUDKMS kms, CosXmlSimpleService cos, QCloudCredentialProvider credentialsProvider, EncryptionMaterialsProvider kekMaterialsProvider)
protected CryptoModuleBase(CosXmlSimpleService cos, QCloudCredentialProvider credentialsProvider, EncryptionMaterialsProvider kekMaterialsProvider)
protected abstract long ciphertextLength(long plaintextLength)
plaintextLength
- a non-negative numberpublic PutObjectResult putObjectSecurely(PutObjectRequest req) throws CosXmlClientException, CosXmlServiceException
public InitMultipartUploadResult initMultipartUploadSecurely(InitMultipartUploadRequest request) throws CosXmlClientException, CosXmlServiceException
public boolean hasMultipartUploadContext(java.lang.String uploadId)
public MultipartUploadCryptoContext getCryptoContext(java.lang.String uploadId)
public UploadPartResult uploadPartSecurely(UploadPartRequest req) throws CosXmlClientException, 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.
public void uploadPartAsyncSecurely(UploadPartRequest req, CosXmlResultListener resultListener)
uploadPartAsyncSecurely
在接口中 CryptoModule
public final CipherLiteInputStream newMultipartCOSCipherInputStream(UploadPartRequest req, com.tencent.cos.xml.crypto.CipherLite cipherLite) throws CosXmlClientException
public CompleteMultiUploadResult completeMultipartUploadSecurely(CompleteMultiUploadRequest req) throws CosXmlClientException, CosXmlServiceException
protected final ObjectMetadata updateMetadataWithContentCryptoMaterial(ObjectMetadata metadata, com.tencent.cos.xml.crypto.ContentCryptoMaterial instruction) throws CosXmlClientException
protected final com.tencent.cos.xml.crypto.ContentCryptoMaterial createContentCryptoMaterial(CosXmlRequest req) throws CosXmlClientException
CosXmlClientException
- if no encryption material can be found.protected final javax.crypto.SecretKey generateCEK(EncryptionMaterials kekMaterials, java.security.Provider providerIn) throws CosXmlClientException
kekMaterials
- non-null encryption materialsCosXmlClientException
protected final PutObjectRequest wrapWithCipher(PutObjectRequest request, com.tencent.cos.xml.crypto.ContentCryptoMaterial cekMaterial) throws CosXmlClientException
PutObjectRequest
but has the content as input stream wrapped
with a cipher, and configured with some meta data and user metadata.protected final InitMultipartUploadRequest cipherInitMultipartUploadRequest(InitMultipartUploadRequest request)
public CipherLiteInputStream newCOSCipherLiteInputStream(PutObjectRequest req, com.tencent.cos.xml.crypto.CipherLite cipherLite) throws CosXmlClientException
protected final long plaintextLength(PutObjectRequest request, ObjectMetadata metadata)
public final com.tencent.cos.xml.crypto.COSCryptoScheme getCOSCryptoScheme()