を使用してAmazon S3の中の使用サーバー側の暗号化、私はcom.intridea下S3FileObjectクラスを見つけVFS-s3-2.2.1.jar を使用しています。 io.vfs.provider.s3パッケージ。 コピーファイル用にpublic void copyFrom(final FileObject file, final FileSelector selector)
メソッドを使用しています。私は見つけることができませんVFS-s3-2.2.1.jarS3FileObject のcopyFrom方法でのjava:S3にファイルをコピーするためのVFS S3プラグイン
try {
if (srcFile.getType().hasChildren()) {
destFile.createFolder();
// do server side copy if both source and dest are in S3 and using same credentials
} else if (srcFile instanceof S3FileObject) {
S3FileObject s3SrcFile = (S3FileObject)srcFile;
String srcBucketName = s3SrcFile.getBucket().getName();
String srcFileName = s3SrcFile.getS3Key();
String destBucketName = destFile.getBucket().getName();
String destFileName = destFile.getS3Key();
CopyObjectRequest copy = new CopyObjectRequest(
srcBucketName, srcFileName, destBucketName, destFileName);
if (srcFile.getType() == FileType.FILE && getServerSideEncryption()) {
ObjectMetadata meta = s3SrcFile.getObjectMetadata();
meta.setSSEAlgorithm(AES_256_SERVER_SIDE_ENCRYPTION);
copy.setNewObjectMetadata(meta);
}
getService().copyObject(copy);
} else if (srcFile.getType().hasContent() && srcFile.getURL().getProtocol().equals("file")) {
// do direct upload from file to avoid overhead of making a copy of the file
try {
File localFile = new File(srcFile.getURL().toURI());
destFile.upload(localFile);
} catch (URISyntaxException e) {
// couldn't convert URL to URI, but should still be able to do the slower way
super.copyFrom(file, selector);
}
} else {
super.copyFrom(file, selector);
}
} catch (IOException e) {
throw new FileSystemException("vfs.provider/copy-file.error", new Object[]{srcFile, destFile}, e);
} catch (AmazonClientException e) {
throw new FileSystemException("vfs.provider/copy-file.error", new Object[]{srcFile, destFile}, e);
} finally {
destFile.close();
}
In official reference it uses these method
withSourceSSECustomerKey(sseKey)
withDestinationSSECustomerKey(newSseKey);
:私は次のコード見つけ、この方法では どのような方法を設定するSSECustomerKey 私は同じことを達成することができます。 ありがとう、ありがとう。