我正在创建一个使用用户名/密码连接到服务器的应用程序,我想启用“保存密码”选项,这样用户就不必在每次应用程序启动时输入密码。

我试图用共享偏好来做,但不确定这是否是最好的解决方案。

我很感激任何关于如何在Android应用程序中存储用户值/设置的建议。

加密某些数据与签署某些数据(使用RSA)之间的区别是什么?

它只是颠倒了公共-私有密钥的角色吗?

For example, I want to use my private key to generate messages so only I can possibly be the sender. I want my public key to be used to read the messages and I do not care who reads them. I want to be able to encrypt certain information and use it as a product-key for my software. I only care that I am the only one who can generate these. I would like to include my public key in my software to decrypt/read the signature of the key. I do not care who can read the data in the key, I only care that I am the only verifiable one who can generate them.

签名在这种情况下有用吗?

我需要实现256位AES加密,但我在网上找到的所有示例都使用“KeyGenerator”来生成256位密钥,但我想使用我自己的passkey。如何创建自己的密钥?我尝试将其填充到256位,但随后我得到一个错误,说键太长。我确实安装了无限管辖权补丁,所以这不是问题:)

Ie。KeyGenerator是这样的…

// Get the KeyGenerator
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128); // 192 and 256 bits may not be available

// Generate the secret key specs.
SecretKey skey = kgen.generateKey();
byte[] raw = skey.getEncoded();

这里的代码

EDIT

我实际上是把密码填充到256字节,不是位,太长了。以下是我现在使用的一些代码,我有了更多的经验。

byte[] key = null; // TODO
byte[] input = null; // TODO
byte[] output = null;
SecretKeySpec keySpec = null;
keySpec = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
cipher.init(Cipher.ENCRYPT_MODE, keySpec);
output = cipher.doFinal(input)

你需要自己做的“TODO”部分:-)

在c#中满足下列条件的最现代(最好)的方法是什么?

string encryptedString = SomeStaticClass.Encrypt(sourceString);

string decryptedString = SomeStaticClass.Decrypt(encryptedString);

但是最少的麻烦涉及盐,键,字节[],等等。

我一直在谷歌上搜索,对我的发现感到困惑(你可以看到类似的SO q列表,看看这是一个欺骗性的问题)。

这是我第一次上传二进制文件。iTunes Connect问我:

出口法律要求含有加密技术的产品必须得到适当的出口授权。 如果不遵守,可能会受到严厉的处罚。 欲了解更多信息,请点击这里。 你的产品包含加密吗?

我使用https://,,但只通过NSURLConnection和UIWebView。

我对此的解读是,我的应用程序不“包含加密”,但我想知道这一点是否在任何地方都拼出来了。“严厉的惩罚”听起来一点也不令人愉快,所以“我认为这是正确的”有点粗略……权威的答案会更好。

谢谢。

我看到哈希和加密算法之间有很多混淆,我想听到一些关于以下方面的专家建议:

什么时候使用哈希和加密 是什么让哈希或加密算法不同(从理论/数学层面) 例如,是什么使得哈希不可逆(没有彩虹树的帮助)

以下是一些类似的SO问题,但没有像我想要的那样详细:

混淆、哈希和加密之间的区别是什么? 加密和哈希的区别

哪一个在什么情况下更受欢迎?

我想看看各种模式的评估标准列表,也许还有每个标准的适用性的讨论。

For example, I think one of the criteria is "size of the code" for encryption and decryption, which is important for micro-code embedded systems, like 802.11 network adapters. IF the code required to implement CBC is much smaller than that required for CTR (I don't know this is true, it's just an example), then I could understand why the mode with the smaller code would be preferred. But if I am writing an app that runs on a server, and the AES library I am using implements both CBC and CTR anyway, then this criterion is irrelevant.

看到我说的“评估标准清单和每个标准的适用性”了吗??

这与编程无关,但与算法有关。

当通过HTTPS发送数据时,我知道内容是加密的,但是关于头是否加密,或者头加密了多少,我听到了不同的答案。

有多少HTTPS头是加密的?

包括GET/POST请求url, cookie等。