* Crypto: Rename bouncycastle HMAC libs so they don't conflict

with older Android versions which bundle them
This commit is contained in:
zzz
2012-08-23 19:11:55 +00:00
parent e3e15850bb
commit 5ffefd2a19
11 changed files with 40 additions and 18 deletions

View File

@ -4,12 +4,12 @@ import gnu.crypto.hash.Sha256Standalone;
import net.i2p.I2PAppContext;
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.macs.I2PHMac;
import org.bouncycastle.oldcrypto.Digest;
import org.bouncycastle.oldcrypto.macs.I2PHMac;
/**
* Calculate the HMAC-SHA256 of a key+message. All the good stuff occurs
* in {@link org.bouncycastle.crypto.macs.I2PHMac} and
* in {@link org.bouncycastle.oldcrypto.macs.I2PHMac} and
* {@link gnu.crypto.hash.Sha256Standalone}.
*
* This should be compatible with javax.crypto.Mac.getInstance("HmacSHA256")

View File

@ -16,13 +16,13 @@ import net.i2p.data.Hash;
import net.i2p.data.SessionKey;
import net.i2p.util.SimpleByteCache;
import org.bouncycastle.crypto.digests.MD5Digest;
import org.bouncycastle.crypto.macs.I2PHMac;
import org.bouncycastle.oldcrypto.digests.MD5Digest;
import org.bouncycastle.oldcrypto.macs.I2PHMac;
/**
* Calculate the HMAC-MD5-128 of a key+message. All the good stuff occurs
* in {@link org.bouncycastle.crypto.macs.I2PHMac} and
* {@link org.bouncycastle.crypto.digests.MD5Digest}.
* in {@link org.bouncycastle.oldcrypto.macs.I2PHMac} and
* {@link org.bouncycastle.oldcrypto.digests.MD5Digest}.
*
* Keys are always 32 bytes.
* This is used only by UDP.

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto;
package org.bouncycastle.oldcrypto;
/*
* Copyright (c) 2000 - 2004 The Legion Of The Bouncy Castle
* (http://www.bouncycastle.org)

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto;
package org.bouncycastle.oldcrypto;
/*
* Copyright (c) 2000 - 2004 The Legion Of The Bouncy Castle
* (http://www.bouncycastle.org)

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto.digests;
package org.bouncycastle.oldcrypto.digests;
/*
* Copyright (c) 2000 - 2004 The Legion Of The Bouncy Castle
* (http://www.bouncycastle.org)
@ -26,7 +26,7 @@ package org.bouncycastle.crypto.digests;
*
*/
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.oldcrypto.Digest;
/**
* base implementation of MD4 family style digest as outlined in

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto.digests;
package org.bouncycastle.oldcrypto.digests;
/**

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto.macs;
package org.bouncycastle.oldcrypto.macs;
/*
* Copyright (c) 2000 - 2004 The Legion Of The Bouncy Castle
* (http://www.bouncycastle.org)
@ -31,8 +31,8 @@ import java.util.Arrays;
import net.i2p.util.SimpleByteCache;
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.Mac;
import org.bouncycastle.oldcrypto.Digest;
import org.bouncycastle.oldcrypto.Mac;
/**
* HMAC implementation based on RFC2104

View File

@ -0,0 +1,14 @@
<html>
<body>
<p>
This is from some very old version of bouncycastle, part of package org.bouncycastle.crypto.
Android bundled something similar in pre-Gingerbread, but upgraded to a later, incompatible version
in Gingerbread. As of Java 1.4 these are in javax.crypto - more or less.
To avoid having to make two different versions of our Android app, we rename to org.bouncycastle.oldcrypto.
</p><p>
Ref: <a href="http://docs.oracle.com/javase/1.5.0/docs/api/javax/crypto/package-summary.html">javax.crypto</a>
and
<a href="http://code.google.com/p/android/issues/detail?id=3280">this android issue</a>.
</p>
</body>
</html>