From c072b3cb6cefc0a1e544ed403bf224ccf662a5a3 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Fri, 18 Mar 2011 12:02:44 -0700 Subject: [PATCH] key length can be obtained from the key --- core/src/main/java/hudson/model/UsageStatistics.java | 4 ++-- test/src/test/java/hudson/model/UsageStatisticsTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/hudson/model/UsageStatistics.java b/core/src/main/java/hudson/model/UsageStatistics.java index 8800d9764a..8de447e302 100644 --- a/core/src/main/java/hudson/model/UsageStatistics.java +++ b/core/src/main/java/hudson/model/UsageStatistics.java @@ -226,8 +226,8 @@ public class UsageStatistics extends PageDecorator { super.in = new CipherInputStream(in,sym); } - public CombinedCipherInputStream(InputStream in, RSAKey key, String algorithm, int keyLength) throws IOException, GeneralSecurityException { - this(in,toCipher(key,Cipher.DECRYPT_MODE),algorithm,keyLength); + public CombinedCipherInputStream(InputStream in, RSAKey key, String algorithm) throws IOException, GeneralSecurityException { + this(in,toCipher(key,Cipher.DECRYPT_MODE),algorithm,key.getModulus().bitLength()); } } diff --git a/test/src/test/java/hudson/model/UsageStatisticsTest.java b/test/src/test/java/hudson/model/UsageStatisticsTest.java index 9acc9a4dda..38cbe50477 100644 --- a/test/src/test/java/hudson/model/UsageStatisticsTest.java +++ b/test/src/test/java/hudson/model/UsageStatisticsTest.java @@ -57,7 +57,7 @@ public class UsageStatisticsTest extends HudsonTestCase { byte[] cipherText = Base64.decode(data.toCharArray()); InputStreamReader r = new InputStreamReader(new GZIPInputStream( - new CombinedCipherInputStream(new ByteArrayInputStream(cipherText),priv,"AES",1024)), "UTF-8"); + new CombinedCipherInputStream(new ByteArrayInputStream(cipherText),priv,"AES")), "UTF-8"); JSONObject o = JSONObject.fromObject(IOUtils.toString(r)); System.out.println(o); assertEquals(1,o.getInt("stat"));