标签: encryption

R密码保护.rdata数据文件

我正在尝试保护我在R中保存的一些数据文件.有没有办法用密码保护R数据文件(.Rdata)?

谢谢

encryption r data-files password-protection rdata

6
推荐指数
1
解决办法
957
查看次数

NSFileProtectionComplete不加密核心数据文件

我正在使用Xcode 7.3 for iOS 9.3来尝试加密Core Data文件.我正在尝试使用NSPersistentStoreFileProtectionKey并将其设置为NSFileProtectionComplete以启用加密.它由于某种原因无法工作,我总能看到应用程序生成的.sqlite文件,并浏览sqlitebrowser或iexplorer中的内容.这是我的代码:

lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator = {
    // The persistent store coordinator for the application. This implementation creates and returns a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail.

    // Create the coordinator and store
    let coordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
    let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("SingleViewCoreData.sqlite")
    var failureReason = "There was an error creating or …
Run Code Online (Sandbox Code Playgroud)

encryption core-data xcode7 swift2

6
推荐指数
2
解决办法
5076
查看次数

无法使用app.config中的提供程序"DataProtectionConfigurationProvider"进行解密

我使用以下方法加密我的项目中的connectionstrings部分(我app.config在我的WinForms项目中使用Code First EF):

public static void EncryptConfig(string exeConfigName)
{
    var config = ConfigurationManager.OpenExeConfiguration(exeConfigName);
    var section = config.GetSection("connectionStrings") as ConnectionStringsSection;
    if (section != null || !section.SectionInformation.IsProtected)
    {
       section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
       config.Save();
    }
}
Run Code Online (Sandbox Code Playgroud)

我也使用以下方法解密该connectionstrings部分:

public static void DecryptConfig(string exeConfigName)
{
    var config = ConfigurationManager.OpenExeConfiguration(exeConfigName);
    var section = config.GetSection("connectionStrings") as ConnectionStringsSection;
    if (section != null && section.SectionInformation.IsProtected)
        section.SectionInformation.UnprotectSection();
}
Run Code Online (Sandbox Code Playgroud)

这个方法适用于我的机器,但当我将我的应用程序部署到另一台机器时,我得到以下异常:

System.Configuration.ConfigurationErrorsException:无法使用提供程序'DataProtectionConfigurationProvider'解密.来自提供程序的错误消息:密钥无法在指定状态下使用.(来自HRESULT的异常:0x8009000B)(D:\ l4test\Level4UI.exe.config第82行)---> System.Runtime.InteropServices.COMException:密钥在指定状态下无效.(来自HRESULT的异常:0x8009000B)

在System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode,IntPtr errorInfo)

在System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)

在System.Configuration.DpapiProtectedConfigurationProvider.DecryptText(String encText)

在System.Configuration.DpapiProtectedConfigurationProvider.Decrypt(XmlNode encryptedNode)

在System.Configuration.ProtectedConfigurationSection.DecryptSection(String encryptedXml,ProtectedConfigurationProvider provider)

在System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.DecryptSection(String …

c# encryption entity-framework app-config winforms

6
推荐指数
1
解决办法
4847
查看次数

JavaScript:写入下载流

我想从我的服务器下载加密文件,解密并在本地保存.我想解密文件并在下载时将其写入本地,而不是等待下载完成,解密,然后将解密文件放在锚标记中.我想这样做的主要原因是,对于大文件,浏览器不必在内存中存储数百兆字节或几千兆字节.

javascript encryption download file-storage

6
推荐指数
2
解决办法
2803
查看次数

AES128-CBC"坏幻数"和"错误读取输入文件"

我试图part444.txt用消息解密文件():

y2EdLtmNQsZkvwwf8jf3fM6c1thfzF0sQfblayGIBik=
Run Code Online (Sandbox Code Playgroud)

这是在CBC模式下128位AES下的base64编码加密文本.它没有填充.IV是加密文本的前16个字节,密钥是h4ckth1sk3yp4d16.

我知道人们从Base64的问题中收到了错误的幻数错误,但现在我得到了"错误读取输入文件"而不知道从哪里开始.

我试过了:

openssl enc -base64 -d part444.txt | openssl aes-128-cbc -d -k h4ckth1sk3yp4d16
Run Code Online (Sandbox Code Playgroud)

为什么我遇到错误"坏幻数"和"错误读取输入文件"?

encryption bash openssl cryptography aes

6
推荐指数
1
解决办法
5873
查看次数

bcrypt vs pbkdf2用于加密私钥

我正在构建一个应用程序,其中在客户端使用密码来加密椭圆曲线密钥对的私钥.然后密码被加密并发送到服务器(连同加密的私钥)和公钥.

最初,我在加密私钥之前使用pbkdf2来对密码进行哈希处理,但由于我也在加密密码,我可以使用加密密码吗?

根据https://medium.com/@mpreziuso/password-hashing-pbkdf2-scrypt-bcrypt-1ef4bb9c19b3#.sj4jcbynx,答案不仅是肯定的,而且bcrypt甚至更好,因为它更具GPU-ASIC弹性.我缺少什么?

encryption cryptography bcrypt pbkdf2

6
推荐指数
1
解决办法
2003
查看次数

SSL数据读写传输速率在Server中高效管理

如何有效地控制数据写入和读取?或者降低读/写速度的可能原因是什么?我的代码中有错误吗?目前它很慢.

我使用下面的代码:

listener.BeginAcceptTcpClient(new AsyncCallback(AcceptCallback), listener);
 .....
// Inside AcceptCallback()
dataStream = client.GetStream();
sslStream = new SslStream(dataStream, true, new RemoteCertificateValidationCallback(ValidateCert));

sslStream.AuthenticateAsServer(serverCertificate);
....
sslState.sslStream.BeginRead(buffer, 0, Length, StartSSLSession, sslState);


// Inside StartSSLSession(IAsyncResult ar)
sslStream.Write(responseBuffer);
sslStream.Flush();
Run Code Online (Sandbox Code Playgroud)

请提出建议或解决方案..

这里我附上了从客户端传输到服务器的数据当前长度的图像.这是否可以增加客户端数据的长度..? 在此输入图像描述

c# encryption ssl client server

6
推荐指数
1
解决办法
214
查看次数

基准测试WebCrypto比第三方库慢得多?

我正在评估WebCrypto性能与第三方加密库SJCL和Forge的比较.我希望WebCrypto 更快,因为它是本机浏览器实现.这也已经过基准测试并且已经显示出来.

我使用Benchmark.js实现了以下测试来测试密钥派生(PBKDF2-SHA256),加密(AES-CBC)和解密(AES-CBC).这些测试显示web加密速度明显慢于SJCL和Forge加密/解密.

基准代码

请看这里的小提琴:https://jsfiddle.net/kspearrin/1Lzvpzkz/

var iterations = 5000;
var keySize = 256;

sjcl.beware['CBC mode is dangerous because it doesn\'t protect message integrity.']();

// =========================================================
// Precomputed enc values for decrypt benchmarks
// =========================================================

var encIv = 'FX7Y3pYmcLIQt6WrKc62jA==';
var encCt = 'EDlxtzpEOfGIAIa8PkCQmA==';

// =========================================================
// Precomputed keys for benchmarks
// =========================================================

function sjclMakeKey() {
  return sjcl.misc.pbkdf2('mypassword', 'a salt', iterations, keySize, null);
}

var sjclKey = sjclMakeKey();

function forgeMakeKey() …
Run Code Online (Sandbox Code Playgroud)

javascript encryption sjcl benchmark.js webcrypto-api

6
推荐指数
1
解决办法
1096
查看次数

在Android上保持TensorFlow模型加密

我搜索了解是否有一种技术可以在Android应用程序中保持训练有素的张量流模型(.pb文件)安全,但没有找到任何有用的东西.我发布了一个包含张量流模型的应用程序,我在训练集上构建了该模型.当我发布应用程序时,任何人都可以访问该模型并将其用于自己的应用程序.我想知道是否有办法保护我放在Android应用程序资产文件夹中的张量流模型?

这是我在Android中加载模型的方式:

TensorFlowInferenceInterface tf = new TensorFlowInferenceInterface();    
tf.initializeTensorFlow(context.getAssets(), "file:///android_asset/model.pb");
Run Code Online (Sandbox Code Playgroud)

我想在应用程序中嵌入加密的模型并在运行时解密它,但如果有人调试应用程序,它可以获取密码并解密它.而且,TensorFlowInferenceInterface类中只有一个initizeTensorFlow方法的实现只接受(AssetManager assetManager,String model).可以写一个接受加密的一个,但它需要对Tensorflow C++库进行一些修改.我想知道是否有更可靠的解决方案.请问有什么建议吗?

encryption obfuscation android android-assets tensorflow

6
推荐指数
1
解决办法
2119
查看次数

bin2hex(random_bytes())取决于输入多少个字符?

我正在使用以下代码为我的应用生成一个简单的UID:

private function _createUid() {
    $bytes = random_bytes(128);
    $uid = bin2hex($bytes);

    return $uid;
}
Run Code Online (Sandbox Code Playgroud)

通过这样做,结果_createUid()将是256个字符的字符串.我的问题是,256如果在同一台服务器上运行,这个字符串是否总是字符,我知道不同服务器上的一些差异.另外,一个字节是否等于两个字符?

任何帮助都会很棒,谢谢!

php encryption byte cryptography

6
推荐指数
1
解决办法
1102
查看次数