如何以加密形式上传文件
我正在开发一个将文件上传到亚马逊的应用程序。亚马逊提供 一种方法 WithServerSideEncryptionMethod(ServerSideEncryptionMethod.AES256)
来加密文件,但它不起作用。它将文本保存为纯文本。
public static void UploadFile()
{
new Program();
var key = "a";
//key = ReplaceDblSlashToSingleFwdSlash(key);
//path = ReplaceFwdSlashToBackSlash(path);
var request = new PutObjectRequest();
request.WithBucketName("demo")
.WithContentBody("i am achal kumar")
.WithKey(key)
.WithServerSideEncryptionMethod(ServerSideEncryptionMethod.AES256);
//request.PutObjectProgressEvent += displayFileProgress;
S3Response response = s3Client.PutObject(request);
response.Dispose();
}
I am developing an application that will upload files to Amazon. Amazon provides
a method WithServerSideEncryptionMethod(ServerSideEncryptionMethod.AES256)
to encrypt files but it is not working. It is saving text as a plain text.
public static void UploadFile()
{
new Program();
var key = "a";
//key = ReplaceDblSlashToSingleFwdSlash(key);
//path = ReplaceFwdSlashToBackSlash(path);
var request = new PutObjectRequest();
request.WithBucketName("demo")
.WithContentBody("i am achal kumar")
.WithKey(key)
.WithServerSideEncryptionMethod(ServerSideEncryptionMethod.AES256);
//request.PutObjectProgressEvent += displayFileProgress;
S3Response response = s3Client.PutObject(request);
response.Dispose();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的数据可能已加密,并且只是使用您正在测试的数据自动解密。
http://aws.typepad.com /aws/2011/10/new-amazon-s3-server-side-encryption.html
Your data is likely encrypted and just being automatically decrypted with your get that you are testing with.
http://aws.typepad.com/aws/2011/10/new-amazon-s3-server-side-encryption.html
您可以使用以下代码来检查是否已加密..因为aws s3在将对象返回给您时已经解密了该对象。
因此,请尝试以下代码来检查对象是否在 amazon s3 上加密,
我希望这可以有所帮助
you can use the following code to check if the is encrypted or not .. because aws s3 they already decrypt the object when they return it to you.
so try the following code to check if the object is encrypted on amazon s3
i hope this could help