From 88c7abeddeed4d1119799a342a1503dfa51016c9 Mon Sep 17 00:00:00 2001 From: zzz Date: Mon, 19 Feb 2018 22:26:32 +0000 Subject: [PATCH] javadoc note --- core/java/src/net/i2p/crypto/KeyStoreUtil.java | 8 ++++---- core/java/src/net/i2p/crypto/SelfSignedGenerator.java | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/java/src/net/i2p/crypto/KeyStoreUtil.java b/core/java/src/net/i2p/crypto/KeyStoreUtil.java index 55eb18983..a922088b8 100644 --- a/core/java/src/net/i2p/crypto/KeyStoreUtil.java +++ b/core/java/src/net/i2p/crypto/KeyStoreUtil.java @@ -458,7 +458,7 @@ public final class KeyStoreUtil { * * @param ks path to the keystore * @param alias the name of the key - * @param cname e.g. randomstuff.console.i2p.net + * @param cname e.g. localhost. Must be a hostname or email address. IP addresses will not be correctly encoded. * @param ou e.g. console * @param keyPW the key password, must be at least 6 characters * @@ -482,7 +482,7 @@ public final class KeyStoreUtil { * @param ks path to the keystore * @param ksPW the keystore password * @param alias the name of the key - * @param cname e.g. randomstuff.console.i2p.net + * @param cname e.g. localhost. Must be a hostname or email address. IP addresses will not be correctly encoded. * @param ou e.g. console * @param validDays e.g. 3652 (10 years) * @param keyAlg e.g. DSA , RSA, EC @@ -530,7 +530,7 @@ public final class KeyStoreUtil { * @param ks path to the keystore * @param ksPW the keystore password * @param alias the name of the key - * @param cname e.g. randomstuff.console.i2p.net + * @param cname e.g. localhost. Must be a hostname or email address. IP addresses will not be correctly encoded. * @param ou e.g. console * @param validDays e.g. 3652 (10 years) * @param keyAlg e.g. DSA , RSA, EC @@ -578,7 +578,7 @@ public final class KeyStoreUtil { * @param ks path to the keystore * @param ksPW the keystore password * @param alias the name of the key - * @param cname e.g. randomstuff.console.i2p.net + * @param cname e.g. localhost. Must be a hostname or email address. IP addresses will not be correctly encoded. * @param ou e.g. console * @param validDays e.g. 3652 (10 years) * @param keyPW the key password, must be at least 6 characters diff --git a/core/java/src/net/i2p/crypto/SelfSignedGenerator.java b/core/java/src/net/i2p/crypto/SelfSignedGenerator.java index 13012da4a..40853386f 100644 --- a/core/java/src/net/i2p/crypto/SelfSignedGenerator.java +++ b/core/java/src/net/i2p/crypto/SelfSignedGenerator.java @@ -85,7 +85,7 @@ public final class SelfSignedGenerator { } /** - * @param cname the common name, non-null + * @param cname the common name, non-null. Must be a hostname or email address. IP addresses will not be correctly encoded. * @param ou The OU (organizational unit) in the distinguished name, non-null before 0.9.28, may be null as of 0.9.28 * @param o The O (organization)in the distinguished name, non-null before 0.9.28, may be null as of 0.9.28 * @param l The L (city or locality) in the distinguished name, non-null before 0.9.28, may be null as of 0.9.28 @@ -514,6 +514,7 @@ public final class SelfSignedGenerator { int wrap3len = spaceFor(TRUE.length); int ext3len = oid3.length + TRUE.length + spaceFor(wrap3len); + // TODO if IP address, encode as 4 or 16 bytes byte[] cnameBytes = DataHelper.getASCII(cname); int wrap41len = spaceFor(cnameBytes.length); // only used for CA @@ -620,6 +621,7 @@ public final class SelfSignedGenerator { idx = intToASN1(rv, idx, wrap4len); rv[idx++] = (byte) 0x30; idx = intToASN1(rv, idx, wrap41len); + // TODO if IP address, encode as 0x87 rv[idx++] = (byte) (isCA ? 0x82 : 0x81); // choice, dNSName or rfc822Name, IA5String implied idx = intToASN1(rv, idx, cnameBytes.length); System.arraycopy(cnameBytes, 0, rv, idx, cnameBytes.length);