Crypto: Avoid java-to-i2p ECDSA privkey conversion when generating CRL,

failing on Android for unknown reasons (ticket #2296)
This commit is contained in:
zzz
2018-09-26 15:19:14 +00:00
parent b82ace8a84
commit d27000ec07
4 changed files with 12 additions and 7 deletions

View File

@ -233,7 +233,7 @@ public final class SelfSignedGenerator {
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException iae) {
throw new GeneralSecurityException("cert error", iae); throw new GeneralSecurityException("cert error", iae);
} }
X509CRL crl = generateCRL(cert, validDays, 1, sigoid, jpriv); X509CRL crl = generateCRL(cert, validDays, 1, sigoid, priv);
// some simple tests // some simple tests
PublicKey cpub = cert.getPublicKey(); PublicKey cpub = cert.getPublicKey();
@ -281,10 +281,7 @@ public final class SelfSignedGenerator {
* Generate a CRL for the given cert, signed with the given private key * Generate a CRL for the given cert, signed with the given private key
*/ */
private static X509CRL generateCRL(X509Certificate cert, int validDays, int crlNum, private static X509CRL generateCRL(X509Certificate cert, int validDays, int crlNum,
byte[] sigoid, PrivateKey jpriv) throws GeneralSecurityException { byte[] sigoid, SigningPrivateKey priv) throws GeneralSecurityException {
SigningPrivateKey priv = SigUtil.fromJavaKey(jpriv);
byte[] tbs = genTBSCRL(cert, validDays, crlNum, sigoid); byte[] tbs = genTBSCRL(cert, validDays, crlNum, sigoid);
int tbslen = tbs.length; int tbslen = tbs.length;

View File

@ -189,8 +189,10 @@ public final class SigUtil {
type = SigType.ECDSA_SHA384_P384; type = SigType.ECDSA_SHA384_P384;
else if (spec.equals(SigType.ECDSA_SHA512_P521.getParams())) else if (spec.equals(SigType.ECDSA_SHA512_P521.getParams()))
type = SigType.ECDSA_SHA512_P521; type = SigType.ECDSA_SHA512_P521;
else else {
// failing on Android (ticket #2296)
throw new IllegalArgumentException("Unknown EC type: " + pk.getClass() + " spec: " + spec.getClass()); throw new IllegalArgumentException("Unknown EC type: " + pk.getClass() + " spec: " + spec.getClass());
}
return fromJavaKey(k, type); return fromJavaKey(k, type);
} }
if (pk instanceof EdDSAPrivateKey) { if (pk instanceof EdDSAPrivateKey) {

View File

@ -1,3 +1,9 @@
2018-09-26 zzz
* Crypto: Avoid privkey conversion when generating CRL,
failing on Android for unknown reasons (ticket #2296)
* IRC: Make inbound whitelist static
* Router: Don't add 'O' cap for P/X anymore
2018-09-24 zzz 2018-09-24 zzz
* Build: Compile jsps in-order for reproducibility (ticket #2279) * Build: Compile jsps in-order for reproducibility (ticket #2279)

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 8; public final static long BUILD = 9;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = "-rc"; public final static String EXTRA = "-rc";