1
0
mirror of https://github.com/etesync/android synced 2024-12-23 15:18:14 +00:00

Journal manager crypto: change RSA key length to 3072.

I set it to 2048 following the NIST recommendations[1] which said it was
OK, but actually, as pointed out by Dominik Schürmann, it's probably a
better idea to set to 3072.

Users who already have a 2048 key pair won't be affected, while users
who don't will have a 3072 key created for them. Users with different
key lengths can interact with each other without any issues.

1: https://www.keylength.com/en/4/
This commit is contained in:
Tom Hacohen 2017-05-12 12:42:33 +01:00
parent b33e5003d4
commit 9cdd63f1d9

View File

@ -55,7 +55,7 @@ public class Crypto {
public static AsymmetricKeyPair generateKeyPair() { public static AsymmetricKeyPair generateKeyPair() {
RSAKeyPairGenerator keyPairGenerator = new RSAKeyPairGenerator(); RSAKeyPairGenerator keyPairGenerator = new RSAKeyPairGenerator();
keyPairGenerator.init(new RSAKeyGenerationParameters(BigInteger.valueOf(65537), new SecureRandom(), 2048, 160)); keyPairGenerator.init(new RSAKeyGenerationParameters(BigInteger.valueOf(65537), new SecureRandom(), 3072, 160));
AsymmetricCipherKeyPair keyPair = keyPairGenerator.generateKeyPair(); AsymmetricCipherKeyPair keyPair = keyPairGenerator.generateKeyPair();
try { try {
PrivateKeyInfo privateKeyInfo = PrivateKeyInfoFactory.createPrivateKeyInfo(keyPair.getPrivate()); PrivateKeyInfo privateKeyInfo = PrivateKeyInfoFactory.createPrivateKeyInfo(keyPair.getPrivate());