Crypto: Change serial number in selfsigned certs from int to long

Add CertUtil to command line
This commit is contained in:
zzz
2016-11-08 14:09:56 +00:00
parent cd775fa38d
commit b559b412aa
3 changed files with 7 additions and 8 deletions

View File

@@ -535,8 +535,6 @@ public final class CertUtil {
}
/****
public static final void main(String[] args) {
if (args.length < 2) {
System.out.println("Usage: [loadcert | loadcrl | loadcrldir | loadcrldirs | isrevoked | loadprivatekey] file");
@@ -545,7 +543,8 @@ public final class CertUtil {
try {
File f = new File(args[1]);
if (args[0].equals("loadcert")) {
loadCert(f);
X509Certificate cert = loadCert(f);
System.out.println(net.i2p.util.HexDump.dump(cert.getEncoded()));
} else if (args[0].equals("loadcrl")) {
loadCRL(f);
} else if (args[0].equals("loadcrldir")) {
@@ -569,5 +568,4 @@ public final class CertUtil {
System.exit(1);
}
}
****/
}

View File

@@ -264,11 +264,11 @@ public final class SelfSignedGenerator {
// a0 ???, int = 2
byte[] version = { (byte) 0xa0, 3, 2, 1, 2 };
// postive serial number (int)
byte[] serial = new byte[6];
// positive serial number (long)
byte[] serial = new byte[10];
serial[0] = 2;
serial[1] = 4;
RandomSource.getInstance().nextBytes(serial, 2, 4);
serial[1] = 8;
RandomSource.getInstance().nextBytes(serial, 2, 8);
serial[2] &= 0x7f;
// going to use this for both issuer and subject

View File

@@ -22,6 +22,7 @@ public class CommandLine {
"freenet.support.CPUInformation.CPUID",
"net.i2p.CoreVersion",
"net.i2p.client.naming.BlockfileNamingService",
"net.i2p.crypto.CertUtil",
"net.i2p.crypto.CryptoCheck",
"net.i2p.crypto.SU3File",
"net.i2p.crypto.TrustedUpdate",