简体   繁体   English

在Windows Phone 8.1 Silverlight中加密文件

[英]Encrypting files in windows phone 8.1 Silverlight

I'm trying to implement file encryption in my app, which will take a filepath that has been obtained by a filepicker, encrypt that file and then sends the encrypted file to a different folder, and vice-versa for decryption. 我正在尝试在我的应用程序中实现文件加密,这将采用文件选择器已获取的文件路径,对该文件进行加密,然后将加密的文件发送到另一个文件夹,反之亦然,以进行解密。

I'm having trouble finding any examples that use files (I wish to encrypt images, and documents), they all seem to be for encrypting strings, which is not particularly helpful. 我在查找任何使用文件的示例(我希望对图像和文档进行加密)方面遇到麻烦,它们似乎都用于加密字符串,这并不是特别有用。 I have found this , which uses ProtectedData to protect data, but I can't see how it could be applied to files. 我发现了this ,它使用ProtectedData保护数据,但是我看不到如何将其应用于文件。

Does anyone know of any resources that could be helpful to me? 有人知道任何对我有帮助的资源吗?

Thanks 谢谢

All the encryption/decryption algorithms work with byte arrays. 所有加密/解密算法都可用于字节数组。 In the document you link, you can see that ProtectedData also works with an byte arrays. 在链接的文档中,您可以看到ProtectedData也可以用于字节数组。 So you need to read the file as an byte array, encrypt it and write the resulting byte array to a new file (a quick google search will show you how to do it). 因此,您需要将文件读取为字节数组,对其进行加密,然后将结果字节数组写入新文件(通过Google的快速搜索将向您展示如何操作)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM