Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E8B9B18183 for ; Sun, 13 Dec 2015 03:52:39 +0000 (UTC) Received: (qmail 2653 invoked by uid 500); 13 Dec 2015 03:52:39 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 2527 invoked by uid 500); 13 Dec 2015 03:52:39 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 2493 invoked by uid 99); 13 Dec 2015 03:52:39 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Dec 2015 03:52:39 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 814C6E01F5; Sun, 13 Dec 2015 03:52:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: drankye@apache.org To: commits@directory.apache.org Date: Sun, 13 Dec 2015 03:52:40 -0000 Message-Id: In-Reply-To: <1696137d474c405c91df5e03ec9afc1a@git.apache.org> References: <1696137d474c405c91df5e03ec9afc1a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/4] directory-kerby git commit: PKINIT. Cleaned some unused codes and fixed some check styles http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/commons/ssl/Util.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/commons/ssl/Util.java b/kerby-pkix/src/main/java/org/apache/commons/ssl/Util.java deleted file mode 100644 index 0fc314f..0000000 --- a/kerby-pkix/src/main/java/org/apache/commons/ssl/Util.java +++ /dev/null @@ -1,458 +0,0 @@ -/* - * $HeadURL: http://juliusdavies.ca/svn/not-yet-commons-ssl/tags/commons-ssl-0.3.16/src/java/org/apache/commons/ssl/Util.java $ - * $Revision: 180 $ - * $Date: 2014-09-23 11:33:47 -0700 (Tue, 23 Sep 2014) $ - * - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - */ - -package org.apache.commons.ssl; - -import org.apache.commons.ssl.util.ByteArrayReadLine; -import org.apache.commons.ssl.util.IPAddressParser; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.cert.Certificate; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.LinkedList; -import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; -import java.util.TreeMap; -import java.util.TreeSet; - -/** - * @author Credit Union Central of British Columbia - * @author www.cucbc.com - * @author juliusdavies@cucbc.com - * @since 28-Feb-2006 - */ -public class Util { - public static final int SIZE_KEY = 0; - public static final int LAST_READ_KEY = 1; - - /** - * True if the Keystores have the same # of entries, have the same set of aliases, and all the certificate-chains - * (of the certificate entries) match. Does not check the private keys for equality, since we - * don't bother taking the passwords to get at them. - */ - public static boolean equals(KeyStore ks1, KeyStore ks2) throws KeyStoreException { - if (ks1 == null || ks2 == null) { - return ks1 == null && ks2 == null; - } - Set aliases1 = aliases(ks1); - Set aliases2 = aliases(ks2); - if (aliases1.equals(aliases2)) { - for (String s : aliases1) { - if (ks1.isCertificateEntry(s) != ks2.isCertificateEntry(s)) { - return false; - } - if (ks1.isKeyEntry(s) != ks2.isKeyEntry(s)) { - return false; - } - if (ks1.isCertificateEntry(s)) { - Certificate[] cc1 = ks1.getCertificateChain(s); - Certificate[] cc2 = ks2.getCertificateChain(s); - if (!Arrays.equals(cc1, cc2)) { - return false; - } - - Certificate c1 = ks1.getCertificate(s); - Certificate c2 = ks2.getCertificate(s); - if (!c1.equals(c2)) { - return false; - } - } - - // should we bother checking keys? maybe one day.... - } - } - return true; - } - - private static Set aliases(KeyStore ks) throws KeyStoreException { - Set aliases = new TreeSet(); - Enumeration en = ks.aliases(); - while (en.hasMoreElements()) { - aliases.add(en.nextElement()); - } - return aliases; - } - - public static boolean isYes(String yesString) { - if (yesString == null) { - return false; - } - String s = yesString.trim().toUpperCase(); - return "1".equals(s) || "YES".equals(s) || "TRUE".equals(s) - || "ENABLE".equals(s) || "ENABLED".equals(s) || "Y".equals(s) - || "ON".equals(s); - } - - public static String trim(final String s) { - if (s == null || "".equals(s)) { - return s; - } - int i = 0; - int j = s.length() - 1; - while (isWhiteSpace(s.charAt(i))) { - i++; - } - while (isWhiteSpace(s.charAt(j))) { - j--; - } - return j >= i ? s.substring(i, j + 1) : ""; - } - - public static boolean isWhiteSpace(final char c) { - switch (c) { - case 0: - case ' ': - case '\t': - case '\n': - case '\r': - case '\f': - return true; - default: - return false; - } - } - - public static void pipeStream(InputStream in, OutputStream out) - throws IOException { - pipeStream(in, out, true); - } - - public static void pipeStream(InputStream in, OutputStream out, - boolean autoClose) - throws IOException { - byte[] buf = new byte[8192]; - IOException ioe = null; - try { - int bytesRead = in.read(buf); - while (bytesRead >= 0) { - if (bytesRead > 0) { - out.write(buf, 0, bytesRead); - } - bytesRead = in.read(buf); - } - } finally { - // Probably it's best to let consumer call "close", but I'm usually - // the consumer, and I want to be lazy. [Julius, November 20th, 2006] - try { - in.close(); - } catch (IOException e) { - ioe = e; - } - if (autoClose) { - try { - out.close(); - } catch (IOException e) { - ioe = e; - } - } - } - if (ioe != null) { - throw ioe; - } - } - - public static byte[] fileToBytes(final File f) throws IOException { - return streamToBytes(new FileInputStream(f)); - } - - public static byte[] streamToBytes(final ByteArrayInputStream in, - int maxLength) { - byte[] buf = new byte[maxLength]; - int[] status = fill(buf, 0, in); - int size = status[SIZE_KEY]; - if (buf.length != size) { - byte[] smallerBuf = new byte[size]; - System.arraycopy(buf, 0, smallerBuf, 0, size); - buf = smallerBuf; - } - return buf; - } - - public static byte[] streamToBytes(final InputStream in, int maxLength) - throws IOException { - byte[] buf = new byte[maxLength]; - int[] status = fill(buf, 0, in); - int size = status[SIZE_KEY]; - if (buf.length != size) { - byte[] smallerBuf = new byte[size]; - System.arraycopy(buf, 0, smallerBuf, 0, size); - buf = smallerBuf; - } - return buf; - } - - public static byte[] streamToBytes(final InputStream in) throws IOException { - byte[] buf = new byte[4096]; - try { - int[] status = fill(buf, 0, in); - int size = status[SIZE_KEY]; - int lastRead = status[LAST_READ_KEY]; - while (lastRead != -1) { - buf = resizeArray(buf); - status = fill(buf, size, in); - size = status[SIZE_KEY]; - lastRead = status[LAST_READ_KEY]; - } - if (buf.length != size) { - byte[] smallerBuf = new byte[size]; - System.arraycopy(buf, 0, smallerBuf, 0, size); - buf = smallerBuf; - } - } finally { - in.close(); - } - return buf; - } - - public static byte[] streamToBytes(final ByteArrayInputStream in) { - byte[] buf = new byte[4096]; - int[] status = fill(buf, 0, in); - int size = status[SIZE_KEY]; - int lastRead = status[LAST_READ_KEY]; - while (lastRead != -1) { - buf = resizeArray(buf); - status = fill(buf, size, in); - size = status[SIZE_KEY]; - lastRead = status[LAST_READ_KEY]; - } - if (buf.length != size) { - byte[] smallerBuf = new byte[size]; - System.arraycopy(buf, 0, smallerBuf, 0, size); - buf = smallerBuf; - } - // in.close(); <-- this is a no-op on ByteArrayInputStream. - return buf; - } - - public static int[] fill(final byte[] buf, final int offset, - final InputStream in) - throws IOException { - int read = in.read(buf, offset, buf.length - offset); - int lastRead = read; - if (read == -1) { - read = 0; - } - while (lastRead != -1 && read + offset < buf.length) { - lastRead = in.read(buf, offset + read, buf.length - read - offset); - if (lastRead != -1) { - read += lastRead; - } - } - return new int[]{offset + read, lastRead}; - } - - public static int[] fill(final byte[] buf, final int offset, - final ByteArrayInputStream in) { - int read = in.read(buf, offset, buf.length - offset); - int lastRead = read; - if (read == -1) { - read = 0; - } - while (lastRead != -1 && read + offset < buf.length) { - lastRead = in.read(buf, offset + read, buf.length - read - offset); - if (lastRead != -1) { - read += lastRead; - } - } - return new int[]{offset + read, lastRead}; - } - - public static byte[] resizeArray(final byte[] bytes) { - byte[] biggerBytes = new byte[bytes.length * 2]; - System.arraycopy(bytes, 0, biggerBytes, 0, bytes.length); - return biggerBytes; - } - - public static String pad(String s, final int length, final boolean left) { - if (s == null) { - s = ""; - } - int diff = length - s.length(); - if (diff == 0) { - return s; - } else if (diff > 0) { - StringBuffer sb = new StringBuffer(); - if (left) { - for (int i = 0; i < diff; i++) { - sb.append(' '); - } - } - sb.append(s); - if (!left) { - for (int i = 0; i < diff; i++) { - sb.append(' '); - } - } - return sb.toString(); - } else { - return s; - } - } - - public static Map parseArgs(final String[] cargs) { - Map args = new TreeMap(); - Map argsMatch = Ping.argsMatch; - - int l = cargs.length; - final String[] emptyValue = {""}; - for (int i = 0; i < l; i++) { - String k = cargs[i]; - Ping.Arg a = (Ping.Arg) argsMatch.get(k); - if (l > i + 1) { - String v = cargs[++i]; - while (argsMatch.containsKey(v)) { - args.put(a, emptyValue); - a = (Ping.Arg) argsMatch.get(v); - v = ""; - if (l > i + 1) { - v = cargs[++i]; - } - } - String[] values = new String[1]; - values[0] = v; - args.put(a, values); - if (l > i + 1 && !argsMatch.containsKey(cargs[i + 1])) { - LinkedList list = new LinkedList(); - list.add(v); - while (l > i + 1 && !argsMatch.containsKey(cargs[i + 1])) { - v = cargs[++i]; - list.add(v); - } - args.put(a, list.toArray(new String[list.size()])); - } - } else { - args.put(a, emptyValue); - } - } - return args; - } - - public static HostPort toAddress(final String target, - final int defaultPort) - throws UnknownHostException { - String host = target; - int port = defaultPort; - StringTokenizer st = new StringTokenizer(target, ":"); - if (st.hasMoreTokens()) { - host = st.nextToken().trim(); - } - if (st.hasMoreTokens()) { - port = Integer.parseInt(st.nextToken().trim()); - } - if (st.hasMoreTokens()) { - throw new IllegalArgumentException("Invalid host: " + target); - } - return new HostPort(host, port); - } - - public static String cipherToAuthType(String cipher) { - if (cipher == null) { - return null; - } - - // SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA ==> "DHE_DSS_EXPORT" - // SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA ==> "DHE_DSS" - // SSL_RSA_WITH_3DES_EDE_CBC_SHA ==> "RSA" - - StringTokenizer st = new StringTokenizer(cipher.trim(), "_"); - if (st.hasMoreTokens()) { - st.nextToken(); // always skip first token - } - if (st.hasMoreTokens()) { - String tok = st.nextToken(); - StringBuffer buf = new StringBuffer(); - buf.append(tok); - if (st.hasMoreTokens()) { - tok = st.nextToken(); - while (!"WITH".equalsIgnoreCase(tok)) { - buf.append('_'); - buf.append(tok); - tok = st.nextToken(); - } - } - return buf.toString(); - } - throw new IllegalArgumentException("not a valid cipher: " + cipher); - } - - /** - * Utility method to make sure IP-literals don't trigger reverse-DNS lookups. - */ - public static InetAddress toInetAddress(String s) throws UnknownHostException { - byte[] ip = IPAddressParser.parseIPv4Literal(s); - if (ip == null) { - ip = IPAddressParser.parseIPv6Literal(s); - } - if (ip != null) { - // Strangely, this prevents Java's annoying SSL reverse-DNS lookup that it - // normally does, even with literal IP addresses. - return InetAddress.getByAddress(s, ip); - } else { - return InetAddress.getByName(s); - } - } - - public static void main(String[] args) throws Exception { - String s = "line1\n\rline2\n\rline3"; - ByteArrayInputStream in = new ByteArrayInputStream(s.getBytes()); - ByteArrayReadLine readLine = new ByteArrayReadLine(in); - String line = readLine.next(); - while (line != null) { - System.out.println(line); - line = readLine.next(); - } - - System.out.println("--------- test 2 ----------"); - - s = "line1\n\rline2\n\rline3\n\r\n\r"; - in = new ByteArrayInputStream(s.getBytes()); - readLine = new ByteArrayReadLine(in); - line = readLine.next(); - while (line != null) { - System.out.println(line); - line = readLine.next(); - } - - } - - -} http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/commons/ssl/util/ByteArrayReadLine.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/commons/ssl/util/ByteArrayReadLine.java b/kerby-pkix/src/main/java/org/apache/commons/ssl/util/ByteArrayReadLine.java deleted file mode 100644 index bf50398..0000000 --- a/kerby-pkix/src/main/java/org/apache/commons/ssl/util/ByteArrayReadLine.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.apache.commons.ssl.util; - -import java.io.ByteArrayInputStream; -import java.io.IOException; - -public class ByteArrayReadLine extends ReadLine { - - public ByteArrayReadLine(ByteArrayInputStream in) { - super(in); - } - - public String next() { - return next(1); - } - - public String next(int lines) { - try { - return super.next(lines); - } catch (IOException ioe) { - // impossible since we're using ByteArrayInputStream - throw new RuntimeException("impossible", ioe); - } - } - - public byte[] nextAsBytes() { - return nextAsBytes(1); - } - - public byte[] nextAsBytes(int lines) { - try { - return super.nextAsBytes(lines); - } catch (IOException ioe) { - // impossible since we're using ByteArrayInputStream - throw new RuntimeException("impossible", ioe); - } - } - -} http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/commons/ssl/util/IPAddressParser.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/commons/ssl/util/IPAddressParser.java b/kerby-pkix/src/main/java/org/apache/commons/ssl/util/IPAddressParser.java deleted file mode 100644 index b0da817..0000000 --- a/kerby-pkix/src/main/java/org/apache/commons/ssl/util/IPAddressParser.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * $HeadURL: http://juliusdavies.ca/svn/not-yet-commons-ssl/trunk/src/java/org/apache/commons/ssl/util/IPAddressParser.java $ - * $Revision: 121 $ - * $Date: 2007-11-13 21:26:57 -0800 (Tue, 13 Nov 2007) $ - * - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - */ -package org.apache.commons.ssl.util; - -/** - * Parses String representations of IPv4 and IPv6 addresses, and converts - * them to byte[]. Returns null if the supplied String is not a valid IP - * address. - *

- * IPv6 addresses are allowed to include square brackets (e.g., "[::a:b:c:d]"), - * but IPv4 addresses are not. This is to help in situation where an IPv6 - * literal address is encoded directly inside a URL (the square brackets allow - * the web client to separate the IPv6 address from its port, since the colon - * character is overloaded in that context). - */ -public class IPAddressParser { - - /** - * Converts the supplied IPv4 literal to byte[], or null if the - * IPv4 address was invalid. - * - * @param s Literal IPv4 address. - * @return byte[] array or null if the supplied IPv4 address was invalid. - */ - public static byte[] parseIPv4Literal(String s) { - s = s != null ? s.trim() : ""; - String[] toks = s.split("\\."); - byte[] ip = new byte[4]; - if (toks.length == 4) { - for (int i = 0; i < ip.length; i++) { - try { - int val = Integer.parseInt(toks[i]); - if (val < 0 || val > 255) { - return null; - } - ip[i] = (byte) val; - } catch (NumberFormatException nfe) { - return null; - } - } - return ip; - } - return null; - } - - /** - * Converts the supplied IPv6 literal to byte[], or null if the - * IPv6 address was invalid. - * - * @param s Literal IPv6 address. - * @return byte[] array or null if the supplied IPv6 address was invalid. - */ - public static byte[] parseIPv6Literal(String s) { - s = s != null ? s.trim() : ""; - if (s.length() > 0 && s.charAt(0) == '[' && s.charAt(s.length() - 1) == ']') { - s = s.substring(1, s.length() - 1).trim(); - } - int x = s.lastIndexOf(':'); - int y = s.indexOf('.'); - // Contains a dot! Look for IPv4 literal suffix. - if (x >= 0 && y > x) { - byte[] ip4Suffix = parseIPv4Literal(s.substring(x + 1)); - if (ip4Suffix == null) { - return null; - } - s = s.substring(0, x) + ":" + ip4ToHex(ip4Suffix); - } - - // Check that we only have a single occurence of "::". - x = s.indexOf("::"); - if (x >= 0) { - if (s.indexOf("::", x + 1) >= 0) { - return null; - } - } - - // This array helps us expand the "::" into the zeroes it represents. - String[] raw = new String[]{"0000", "0000", "0000", "0000", "0000", "0000", "0000", "0000"}; - if (s.indexOf("::") >= 0) { - String[] split = s.split("::", -1); - String[] prefix = splitOnColon(split[0]); - String[] suffix = splitOnColon(split[1]); - - // Make sure the "::" zero-expander has some room to expand! - if (prefix.length + suffix.length > 7) { - return null; - } - for (int i = 0; i < prefix.length; i++) { - raw[i] = prependZeroes(prefix[i]); - } - int startPos = raw.length - suffix.length; - for (int i = 0; i < suffix.length; i++) { - raw[startPos + i] = prependZeroes(suffix[i]); - } - } else { - // Okay, whew, no "::" zero-expander, but we still have to make sure - // each element contains 4 hex characters. - raw = splitOnColon(s); - if (raw.length != 8) { - return null; - } - for (int i = 0; i < raw.length; i++) { - raw[i] = prependZeroes(raw[i]); - } - } - - byte[] ip6 = new byte[16]; - int i = 0; - for (int j = 0; j < raw.length; j++) { - String tok = raw[j]; - if (tok.length() > 4) { - return null; - } - String prefix = tok.substring(0, 2); - String suffix = tok.substring(2, 4); - try { - ip6[i++] = (byte) Integer.parseInt(prefix, 16); - ip6[i++] = (byte) Integer.parseInt(suffix, 16); - } catch (NumberFormatException nfe) { - return null; - } - } - return ip6; - } - - private static String prependZeroes(String s) { - switch (s.length()) { - case 0: return "0000"; - case 1: return "000" + s; - case 2: return "00" + s; - case 3: return "0" + s; - default: return s; - } - } - - private static String[] splitOnColon(String s) { - if ("".equals(s)) { - return new String[]{}; - } else { - return s.split(":"); - } - } - - private static String ip4ToHex(byte[] b) { - return b2s(b[0]) + b2s(b[1]) + ":" + b2s(b[2]) + b2s(b[3]); - } - - private static String b2s(byte b) { - String s = Integer.toHexString(b >= 0 ? b : 256 + b); - if (s.length() < 2) { - s = "0" + s; - } - return s; - } -} http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/commons/ssl/util/PublicKeyDeriver.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/commons/ssl/util/PublicKeyDeriver.java b/kerby-pkix/src/main/java/org/apache/commons/ssl/util/PublicKeyDeriver.java deleted file mode 100644 index 1ff15a0..0000000 --- a/kerby-pkix/src/main/java/org/apache/commons/ssl/util/PublicKeyDeriver.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * $HeadURL: http://juliusdavies.ca/svn/not-yet-commons-ssl/trunk/src/java/org/apache/commons/ssl/Certificates.java $ - * $Revision: 121 $ - * $Date: 2007-11-13 21:26:57 -0800 (Tue, 13 Nov 2007) $ - * - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - */ -package org.apache.commons.ssl.util; - -import java.math.BigInteger; -import java.security.GeneralSecurityException; -import java.security.KeyException; -import java.security.KeyFactory; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.interfaces.DSAParams; -import java.security.interfaces.DSAPrivateKey; -import java.security.interfaces.RSAPrivateCrtKey; -import java.security.spec.DSAPublicKeySpec; -import java.security.spec.RSAPublicKeySpec; - -/** - * Utility class for deriving a public key from a given private key. - * - * @author Chad La Joie - * @since November 14th, 2007 - */ -public class PublicKeyDeriver { - - /** - * Utility method for deriving a public key from a given private key. - * - * @param key private key for which we need a public key (DSA or RSA). - * @return the corresponding public key - * @throws java.security.GeneralSecurityException if it didn't work - */ - public static PublicKey derivePublicKey(PrivateKey key) throws GeneralSecurityException { - if (key instanceof DSAPrivateKey) { - DSAPrivateKey dsaKey = (DSAPrivateKey) key; - DSAParams keyParams = dsaKey.getParams(); - BigInteger g = keyParams.getG(); - BigInteger p = keyParams.getP(); - BigInteger q = keyParams.getQ(); - BigInteger x = dsaKey.getX(); - BigInteger y = q.modPow(x, p); - DSAPublicKeySpec keySpec = new DSAPublicKeySpec(y, p, q, g); - return KeyFactory.getInstance("DSA").generatePublic(keySpec); - } else if (key instanceof RSAPrivateCrtKey) { - RSAPrivateCrtKey rsaKey = (RSAPrivateCrtKey) key; - BigInteger modulus = rsaKey.getModulus(); - BigInteger exponent = rsaKey.getPublicExponent(); - RSAPublicKeySpec keySpec = new RSAPublicKeySpec(modulus, exponent); - return KeyFactory.getInstance("RSA").generatePublic(keySpec); - } else { - throw new KeyException("Private key was not a DSA or RSA key"); - } - } -} - http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/commons/ssl/util/ReadLine.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/commons/ssl/util/ReadLine.java b/kerby-pkix/src/main/java/org/apache/commons/ssl/util/ReadLine.java deleted file mode 100644 index 55fc512..0000000 --- a/kerby-pkix/src/main/java/org/apache/commons/ssl/util/ReadLine.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.apache.commons.ssl.util; - -import java.io.IOException; -import java.io.InputStream; - -/** - * @author Julius Davies - * @author 23-Dec-2007 - */ -public class ReadLine { - - final InputStream in; - final byte[] bytes = new byte[8192]; - int pos = 0; - int avail = 0; - - public ReadLine(InputStream in) { - this.in = in; - } - - public String next() throws IOException { - return next(1); - } - - public String next(int lines) throws IOException { - if (lines < 1) { - lines = 1; - } - StringBuffer buf = new StringBuffer(128 * lines); - if (avail <= 0 || pos >= avail) { - pos = 0; - avail = in.read(bytes); - } - while (avail >= 0) { - while (pos < avail) { - char c = (char) bytes[pos++]; - switch (c) { - case '\n': - case '\r': - lines--; - if (lines < 1 && buf.length() > 0) { - return buf.toString(); - } - break; - default: - buf.append(c); - break; - } - } - pos = 0; - avail = in.read(bytes); - } - return buf.length() > 0 ? buf.toString() : null; - } - - public byte[] nextAsBytes() throws IOException { - return nextAsBytes(1); - } - - public byte[] nextAsBytes(int lines) throws IOException { - if (lines < 1) { - lines = 1; - } - byte[] buf = new byte[8192]; - int bufPos = 0; - if (avail <= 0 || pos >= avail) { - pos = 0; - avail = in.read(bytes); - } - while (avail >= 0) { - while (pos < avail) { - byte b = bytes[pos++]; - switch (b) { - case '\n': - case '\r': - lines--; - if (lines == 0 && bufPos > 0) { - return buf; - } - break; - default: - if (bufPos >= buf.length) { - byte[] moreBuff = new byte[buf.length * 2]; - System.arraycopy(buf, 0, moreBuff, 0, buf.length); - buf = moreBuff; - } - buf[bufPos++] = b; - break; - } - } - pos = 0; - avail = in.read(bytes); - } - return bufPos > 0 ? buf : null; - } - -} http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Attribute.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Attribute.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Attribute.java index f9a4615..bb5355d 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Attribute.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Attribute.java @@ -24,7 +24,9 @@ import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.type.Asn1ObjectIdentifier; import org.apache.kerby.asn1.type.Asn1SequenceType; import org.apache.kerby.x509.type.AttributeValues; -import static org.apache.kerby.cms.type.Attribute.MyEnum.*; + +import static org.apache.kerby.cms.type.Attribute.MyEnum.ATTR_TYPE; +import static org.apache.kerby.cms.type.Attribute.MyEnum.ATTR_VALUES; /** * Ref. RFC 5652 http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateInfoV1.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateInfoV1.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateInfoV1.java index bc01773..5c79fbd 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateInfoV1.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateInfoV1.java @@ -19,9 +19,9 @@ */ package org.apache.kerby.cms.type; +import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.type.Asn1BitString; -import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.type.Asn1Integer; import org.apache.kerby.asn1.type.Asn1SequenceType; import org.apache.kerby.x509.type.AlgorithmIdentifier; @@ -30,7 +30,16 @@ import org.apache.kerby.x509.type.AttCertValidityPeriod; import org.apache.kerby.x509.type.Attributes; import org.apache.kerby.x509.type.CertificateSerialNumber; import org.apache.kerby.x509.type.Extensions; -import static org.apache.kerby.cms.type.AttributeCertificateInfoV1.MyEnum.*; + +import static org.apache.kerby.cms.type.AttributeCertificateInfoV1.MyEnum.ATTRIBUTES; +import static org.apache.kerby.cms.type.AttributeCertificateInfoV1.MyEnum.ATTR_CERT_VALIDITY_PERIOD; +import static org.apache.kerby.cms.type.AttributeCertificateInfoV1.MyEnum.EXTENSIONS; +import static org.apache.kerby.cms.type.AttributeCertificateInfoV1.MyEnum.ISSUER; +import static org.apache.kerby.cms.type.AttributeCertificateInfoV1.MyEnum.ISSUER_UNIQUE_ID; +import static org.apache.kerby.cms.type.AttributeCertificateInfoV1.MyEnum.SERIAL_NUMBER; +import static org.apache.kerby.cms.type.AttributeCertificateInfoV1.MyEnum.SIGNATURE; +import static org.apache.kerby.cms.type.AttributeCertificateInfoV1.MyEnum.SUBJECT; +import static org.apache.kerby.cms.type.AttributeCertificateInfoV1.MyEnum.VERSION; /** * AttributeCertificateInfoV1 ::= SEQUENCE { http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV1.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV1.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV1.java index 8eaeebf..0bb3424 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV1.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV1.java @@ -19,13 +19,16 @@ */ package org.apache.kerby.cms.type; +import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.type.Asn1BitString; -import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.type.Asn1SequenceType; import org.apache.kerby.x509.type.AlgorithmIdentifier; import org.apache.kerby.x509.type.AttributeCertificateInfo; -import static org.apache.kerby.cms.type.AttributeCertificateV1.MyEnum.*; + +import static org.apache.kerby.cms.type.AttributeCertificateV1.MyEnum.ACI_INFO; +import static org.apache.kerby.cms.type.AttributeCertificateV1.MyEnum.SIGNATURE; +import static org.apache.kerby.cms.type.AttributeCertificateV1.MyEnum.SIGNATURE_ALGORITHM; /** * AttributeCertificateV1 ::= SEQUENCE { http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Certificate.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Certificate.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Certificate.java deleted file mode 100644 index 6635015..0000000 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Certificate.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.kerby.cms.type; - -import org.apache.kerby.asn1.EnumType; -import org.apache.kerby.asn1.type.Asn1BitString; -import org.apache.kerby.asn1.Asn1FieldInfo; -import org.apache.kerby.asn1.type.Asn1SequenceType; -import org.apache.kerby.x509.type.AlgorithmIdentifier; -import org.apache.kerby.x509.type.TBSCertificate; -import static org.apache.kerby.cms.type.Certificate.MyEnum.*; - -/** - *

- *  Certificate ::= SEQUENCE {
- *      tbsCertificate          TBSCertificate,
- *      signatureAlgorithm      AlgorithmIdentifier,
- *      signature               BIT STRING
- *  }
- * 
- */ -public class Certificate extends Asn1SequenceType { - protected enum MyEnum implements EnumType { - TBS_CERTIFICATE, - SIGNATURE_ALGORITHM, - SIGNATURE; - - @Override - public int getValue() { - return ordinal(); - } - - @Override - public String getName() { - return name(); - } - } - - static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] { - new Asn1FieldInfo(TBS_CERTIFICATE, TBSCertificate.class), - new Asn1FieldInfo(SIGNATURE_ALGORITHM, AlgorithmIdentifier.class), - new Asn1FieldInfo(SIGNATURE, Asn1BitString.class) - }; - - public Certificate() { - super(fieldInfos); - } - - public TBSCertificate getTBSCertificate() { - return getFieldAs(TBS_CERTIFICATE, TBSCertificate.class); - } - - public void setTbsCertificate(TBSCertificate tbsCertificate) { - setFieldAs(TBS_CERTIFICATE, tbsCertificate); - } - - public AlgorithmIdentifier getSignatureAlgorithm() { - return getFieldAs(SIGNATURE_ALGORITHM, AlgorithmIdentifier.class); - } - - public void setSignatureAlgorithm(AlgorithmIdentifier signatureAlgorithm) { - setFieldAs(SIGNATURE_ALGORITHM, signatureAlgorithm); - } - - public Asn1BitString getSignature() { - return getFieldAs(SIGNATURE, Asn1BitString.class); - } - - public void setSignature(Asn1BitString signature) { - setFieldAs(SIGNATURE, signature); - } -} http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateChoices.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateChoices.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateChoices.java index 0856534..7c306d7 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateChoices.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateChoices.java @@ -19,11 +19,17 @@ */ package org.apache.kerby.cms.type; -import org.apache.kerby.asn1.EnumType; -import org.apache.kerby.asn1.type.Asn1Choice; import org.apache.kerby.asn1.Asn1FieldInfo; +import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.ImplicitField; -import static org.apache.kerby.cms.type.CertificateChoices.MyEnum.*; +import org.apache.kerby.asn1.type.Asn1Choice; +import org.apache.kerby.x509.type.Certificate; + +import static org.apache.kerby.cms.type.CertificateChoices.MyEnum.CERTIFICATE; +import static org.apache.kerby.cms.type.CertificateChoices.MyEnum.EXTENDED_CERTIFICATE; +import static org.apache.kerby.cms.type.CertificateChoices.MyEnum.OTHER; +import static org.apache.kerby.cms.type.CertificateChoices.MyEnum.V1_ATTR_CERT; +import static org.apache.kerby.cms.type.CertificateChoices.MyEnum.V2_ATTR_CERT; /** * CertificateChoices ::= CHOICE { http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CompressedData.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CompressedData.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CompressedData.java index 6f36340..072ca7f 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CompressedData.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CompressedData.java @@ -23,7 +23,10 @@ import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.type.Asn1SequenceType; import org.apache.kerby.x509.type.AlgorithmIdentifier; -import static org.apache.kerby.cms.type.CompressedData.MyEnum.*; + +import static org.apache.kerby.cms.type.CompressedData.MyEnum.COMPRESSION_ALGORITHM; +import static org.apache.kerby.cms.type.CompressedData.MyEnum.ENCAP_CONTENT_INFO; +import static org.apache.kerby.cms.type.CompressedData.MyEnum.VERSION; /** * Ref. RFC 3274 http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java index 2627857..cefe646 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java @@ -19,14 +19,16 @@ */ package org.apache.kerby.cms.type; +import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; +import org.apache.kerby.asn1.ExplicitField; import org.apache.kerby.asn1.type.Asn1Any; -import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.type.Asn1ObjectIdentifier; import org.apache.kerby.asn1.type.Asn1SequenceType; import org.apache.kerby.asn1.type.Asn1Type; -import org.apache.kerby.asn1.ExplicitField; -import static org.apache.kerby.cms.type.ContentInfo.MyEnum.*; + +import static org.apache.kerby.cms.type.ContentInfo.MyEnum.CONTENT; +import static org.apache.kerby.cms.type.ContentInfo.MyEnum.CONTENT_TYPE; /** * Ref. RFC 5652 http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java index 17f9beb..d8506bc 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java @@ -21,11 +21,13 @@ package org.apache.kerby.cms.type; import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; +import org.apache.kerby.asn1.ExplicitField; import org.apache.kerby.asn1.type.Asn1ObjectIdentifier; import org.apache.kerby.asn1.type.Asn1OctetString; import org.apache.kerby.asn1.type.Asn1SequenceType; -import org.apache.kerby.asn1.ExplicitField; -import static org.apache.kerby.cms.type.EncapsulatedContentInfo.MyEnum.*; + +import static org.apache.kerby.cms.type.EncapsulatedContentInfo.MyEnum.CONTENT; +import static org.apache.kerby.cms.type.EncapsulatedContentInfo.MyEnum.CONTENT_TYPE; /** * EncapsulatedContentInfo ::= SEQUENCE { http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java index 44dc604..d63d550 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java @@ -22,7 +22,10 @@ package org.apache.kerby.cms.type; import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.type.Asn1SequenceType; -import static org.apache.kerby.cms.type.ExtendedCertificate.MyEnum.*; + +import static org.apache.kerby.cms.type.ExtendedCertificate.MyEnum.EXTENDED_CERTIFICATE_INFO; +import static org.apache.kerby.cms.type.ExtendedCertificate.MyEnum.SIGNATURE; +import static org.apache.kerby.cms.type.ExtendedCertificate.MyEnum.SIGNATURE_ALGORITHMS; /** * ExtendedCertificate ::= SEQUENCE { http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificateInfo.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificateInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificateInfo.java index b2223f8..91648be 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificateInfo.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificateInfo.java @@ -22,7 +22,10 @@ package org.apache.kerby.cms.type; import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.type.Asn1SequenceType; -import static org.apache.kerby.cms.type.ExtendedCertificateInfo.MyEnum.*; + +import static org.apache.kerby.cms.type.ExtendedCertificateInfo.MyEnum.ATTRIBUTES; +import static org.apache.kerby.cms.type.ExtendedCertificateInfo.MyEnum.CERTIFICATE; +import static org.apache.kerby.cms.type.ExtendedCertificateInfo.MyEnum.CMS_VERSION; /** * ExtendedCertificateInfo ::= SEQUENCE { http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/IssuerAndSerialNumber.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/IssuerAndSerialNumber.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/IssuerAndSerialNumber.java index 1c9173a..0fc33c2 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/IssuerAndSerialNumber.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/IssuerAndSerialNumber.java @@ -24,7 +24,9 @@ import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.type.Asn1Integer; import org.apache.kerby.asn1.type.Asn1SequenceType; import org.apache.kerby.x500.type.Name; -import static org.apache.kerby.cms.type.IssuerAndSerialNumber.MyEnum.*; + +import static org.apache.kerby.cms.type.IssuerAndSerialNumber.MyEnum.ISSUER; +import static org.apache.kerby.cms.type.IssuerAndSerialNumber.MyEnum.SERIAL_NUMBER; /** * Ref. RFC5652 http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherCertificateFormat.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherCertificateFormat.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherCertificateFormat.java index df77423..604109f 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherCertificateFormat.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherCertificateFormat.java @@ -19,13 +19,15 @@ */ package org.apache.kerby.cms.type; +import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.type.Asn1Any; -import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.type.Asn1ObjectIdentifier; import org.apache.kerby.asn1.type.Asn1SequenceType; import org.apache.kerby.asn1.type.Asn1Type; -import static org.apache.kerby.cms.type.OtherCertificateFormat.MyEnum.*; + +import static org.apache.kerby.cms.type.OtherCertificateFormat.MyEnum.OTHER_CERT; +import static org.apache.kerby.cms.type.OtherCertificateFormat.MyEnum.OTHER_CERT_FORMAT; /** * OtherCertificateFormat ::= SEQUENCE { http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRevocationInfoFormat.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRevocationInfoFormat.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRevocationInfoFormat.java index 5f1fa94..5602c01 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRevocationInfoFormat.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRevocationInfoFormat.java @@ -19,13 +19,15 @@ */ package org.apache.kerby.cms.type; +import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.type.Asn1Any; -import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.type.Asn1ObjectIdentifier; import org.apache.kerby.asn1.type.Asn1SequenceType; import org.apache.kerby.asn1.type.Asn1Type; -import static org.apache.kerby.cms.type.OtherRevocationInfoFormat.MyEnum.*; + +import static org.apache.kerby.cms.type.OtherRevocationInfoFormat.MyEnum.OTHER_REV_INFO; +import static org.apache.kerby.cms.type.OtherRevocationInfoFormat.MyEnum.OTHER_REV_INFO_FORMAT; /** * OtherRevocationInfoFormat ::= SEQUENCE { http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoice.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoice.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoice.java index 57be933..ebcd3ec 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoice.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoice.java @@ -19,13 +19,14 @@ */ package org.apache.kerby.cms.type; -import org.apache.kerby.asn1.EnumType; -import org.apache.kerby.asn1.type.Asn1Choice; import org.apache.kerby.asn1.Asn1FieldInfo; +import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.ImplicitField; +import org.apache.kerby.asn1.type.Asn1Choice; import org.apache.kerby.x509.type.CertificateList; -import static org.apache.kerby.cms.type.RevocationInfoChoice.MyEnum.*; +import static org.apache.kerby.cms.type.RevocationInfoChoice.MyEnum.CRL; +import static org.apache.kerby.cms.type.RevocationInfoChoice.MyEnum.OTHER; /** * RevocationInfoChoice ::= CHOICE { http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedData.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedData.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedData.java index 68dd37f..94e210b 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedData.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedData.java @@ -21,9 +21,15 @@ package org.apache.kerby.cms.type; import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; -import org.apache.kerby.asn1.type.Asn1SequenceType; import org.apache.kerby.asn1.ImplicitField; -import static org.apache.kerby.cms.type.SignedData.MyEnum.*; +import org.apache.kerby.asn1.type.Asn1SequenceType; + +import static org.apache.kerby.cms.type.SignedData.MyEnum.CERTIFICATES; +import static org.apache.kerby.cms.type.SignedData.MyEnum.CMS_VERSION; +import static org.apache.kerby.cms.type.SignedData.MyEnum.CRLS; +import static org.apache.kerby.cms.type.SignedData.MyEnum.DIGEST_ALGORITHMS; +import static org.apache.kerby.cms.type.SignedData.MyEnum.ENCAP_CONTENT_INFO; +import static org.apache.kerby.cms.type.SignedData.MyEnum.SIGNER_INFOS; /** * Ref. RFC 5652 http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerIdentifier.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerIdentifier.java index 9b2d859..38a173d 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerIdentifier.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerIdentifier.java @@ -19,12 +19,14 @@ */ package org.apache.kerby.cms.type; -import org.apache.kerby.asn1.EnumType; -import org.apache.kerby.asn1.type.Asn1Choice; import org.apache.kerby.asn1.Asn1FieldInfo; +import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.ExplicitField; +import org.apache.kerby.asn1.type.Asn1Choice; import org.apache.kerby.x509.type.SubjectKeyIdentifier; -import static org.apache.kerby.cms.type.SignerIdentifier.MyEnum.*; + +import static org.apache.kerby.cms.type.SignerIdentifier.MyEnum.ISSUER_AND_SERIAL_NUMBER; +import static org.apache.kerby.cms.type.SignerIdentifier.MyEnum.SUBJECT_KEY_IDENTIFIER; /** * Ref. RFC 5652 http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfo.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfo.java index 69dcd27..b55dc4e 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfo.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfo.java @@ -21,9 +21,16 @@ package org.apache.kerby.cms.type; import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; -import org.apache.kerby.asn1.type.Asn1SequenceType; import org.apache.kerby.asn1.ImplicitField; -import static org.apache.kerby.cms.type.SignerInfo.MyEnum.*; +import org.apache.kerby.asn1.type.Asn1SequenceType; + +import static org.apache.kerby.cms.type.SignerInfo.MyEnum.CMS_VERSION; +import static org.apache.kerby.cms.type.SignerInfo.MyEnum.DIGEST_ALGORITHM; +import static org.apache.kerby.cms.type.SignerInfo.MyEnum.SID; +import static org.apache.kerby.cms.type.SignerInfo.MyEnum.SIGNATURE; +import static org.apache.kerby.cms.type.SignerInfo.MyEnum.SIGNATURE_ALGORITHMS; +import static org.apache.kerby.cms.type.SignerInfo.MyEnum.SIGNED_ATTRS; +import static org.apache.kerby.cms.type.SignerInfo.MyEnum.UNSIGNED_ATTRS; /** * Ref. RFC 5652 http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Subject.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Subject.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Subject.java index 8779c8c..bbd4f6e 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Subject.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Subject.java @@ -19,13 +19,15 @@ */ package org.apache.kerby.cms.type; -import org.apache.kerby.asn1.EnumType; -import org.apache.kerby.asn1.type.Asn1Choice; import org.apache.kerby.asn1.Asn1FieldInfo; +import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.ExplicitField; +import org.apache.kerby.asn1.type.Asn1Choice; import org.apache.kerby.x509.type.GeneralNames; import org.apache.kerby.x509.type.IssuerSerial; -import static org.apache.kerby.cms.type.Subject.MyEnum.*; + +import static org.apache.kerby.cms.type.Subject.MyEnum.BASE_CERTIFICATE_ID; +import static org.apache.kerby.cms.type.Subject.MyEnum.SUBJECT_NAME; /** * subject CHOICE { http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x500/type/AttributeTypeAndValue.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x500/type/AttributeTypeAndValue.java b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/AttributeTypeAndValue.java index 2da8077..7ec8bee 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/x500/type/AttributeTypeAndValue.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/AttributeTypeAndValue.java @@ -19,13 +19,15 @@ */ package org.apache.kerby.x500.type; +import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.type.Asn1Any; -import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.type.Asn1ObjectIdentifier; import org.apache.kerby.asn1.type.Asn1SequenceType; import org.apache.kerby.asn1.type.Asn1Type; -import static org.apache.kerby.x500.type.AttributeTypeAndValue.MyEnum.*; + +import static org.apache.kerby.x500.type.AttributeTypeAndValue.MyEnum.TYPE; +import static org.apache.kerby.x500.type.AttributeTypeAndValue.MyEnum.VALUE; /** * AttributeTypeAndValue ::= SEQUENCE { http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x500/type/Name.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x500/type/Name.java b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/Name.java index 7e3060b..5263ee1 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/x500/type/Name.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/Name.java @@ -19,10 +19,11 @@ */ package org.apache.kerby.x500.type; +import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.type.Asn1Choice; -import org.apache.kerby.asn1.Asn1FieldInfo; -import static org.apache.kerby.x500.type.Name.MyEnum.*; + +import static org.apache.kerby.x500.type.Name.MyEnum.RDN_SEQUENCE; /** * http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AccessDescription.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AccessDescription.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AccessDescription.java index 4fd854f..0b8f909 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AccessDescription.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AccessDescription.java @@ -23,7 +23,9 @@ import org.apache.kerby.asn1.Asn1FieldInfo; import org.apache.kerby.asn1.EnumType; import org.apache.kerby.asn1.type.Asn1ObjectIdentifier; import org.apache.kerby.asn1.type.Asn1SequenceType; -import static org.apache.kerby.x509.type.AccessDescription.MyEnum.*; + +import static org.apache.kerby.x509.type.AccessDescription.MyEnum.ACCESS_LOCATION; +import static org.apache.kerby.x509.type.AccessDescription.MyEnum.ACCESS_METHOD; /** * http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertValidityPeriod.java ---------------------------------------------------------------------- diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertValidityPeriod.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertValidityPeriod.java index a281aea..c5d9bf4 100644 --- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertValidityPeriod.java +++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertValidityPeriod.java @@ -25,7 +25,8 @@ import org.apache.kerby.asn1.type.Asn1GeneralizedTime; import org.apache.kerby.asn1.type.Asn1SequenceType; import org.apache.kerby.asn1.type.Asn1UtcTime; -import static org.apache.kerby.x509.type.AttCertValidityPeriod.MyEnum.*; +import static org.apache.kerby.x509.type.AttCertValidityPeriod.MyEnum.NOT_AFTER; +import static org.apache.kerby.x509.type.AttCertValidityPeriod.MyEnum.NOT_BEFORE; /** *

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Attribute.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Attribute.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Attribute.java
index 772468b..b19edea 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Attribute.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Attribute.java
@@ -23,7 +23,9 @@ import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
-import static org.apache.kerby.x509.type.Attribute.MyEnum.*;
+
+import static org.apache.kerby.x509.type.Attribute.MyEnum.ATTR_TYPE;
+import static org.apache.kerby.x509.type.Attribute.MyEnum.ATTR_VALUES;
 
 /**
  * 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeCertificate.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeCertificate.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeCertificate.java
index 95df411..9470ae0 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeCertificate.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeCertificate.java
@@ -19,11 +19,14 @@
  */
 package org.apache.kerby.x509.type;
 
+import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1BitString;
-import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
-import static org.apache.kerby.x509.type.AttributeCertificate.MyEnum.*;
+
+import static org.apache.kerby.x509.type.AttributeCertificate.MyEnum.ACI_INFO;
+import static org.apache.kerby.x509.type.AttributeCertificate.MyEnum.SIGNATURE_ALGORITHM;
+import static org.apache.kerby.x509.type.AttributeCertificate.MyEnum.SIGNATURE_VALUE;
 
 /**
  * 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeCertificateInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeCertificateInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeCertificateInfo.java
index 3964560..55fc2f2 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeCertificateInfo.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeCertificateInfo.java
@@ -19,12 +19,21 @@
  */
 package org.apache.kerby.x509.type;
 
+import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1BitString;
-import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
-import static org.apache.kerby.x509.type.AttributeCertificateInfo.MyEnum.*;
+
+import static org.apache.kerby.x509.type.AttributeCertificateInfo.MyEnum.ATTRIBUTES;
+import static org.apache.kerby.x509.type.AttributeCertificateInfo.MyEnum.ATTR_CERT_VALIDITY_PERIOD;
+import static org.apache.kerby.x509.type.AttributeCertificateInfo.MyEnum.EXTENSIONS;
+import static org.apache.kerby.x509.type.AttributeCertificateInfo.MyEnum.HOLDER;
+import static org.apache.kerby.x509.type.AttributeCertificateInfo.MyEnum.ISSUER;
+import static org.apache.kerby.x509.type.AttributeCertificateInfo.MyEnum.ISSUER_UNIQUE_ID;
+import static org.apache.kerby.x509.type.AttributeCertificateInfo.MyEnum.SERIAL_NUMBER;
+import static org.apache.kerby.x509.type.AttributeCertificateInfo.MyEnum.SIGNATURE;
+import static org.apache.kerby.x509.type.AttributeCertificateInfo.MyEnum.VERSION;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AuthorityKeyIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AuthorityKeyIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AuthorityKeyIdentifier.java
index 3617bf8..1312666 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AuthorityKeyIdentifier.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AuthorityKeyIdentifier.java
@@ -21,9 +21,12 @@ package org.apache.kerby.x509.type;
 
 import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
-import org.apache.kerby.asn1.type.Asn1SequenceType;
 import org.apache.kerby.asn1.ImplicitField;
-import static org.apache.kerby.x509.type.AuthorityKeyIdentifier.MyEnum.*;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.x509.type.AuthorityKeyIdentifier.MyEnum.AUTHORITY_CERT_ISSUER;
+import static org.apache.kerby.x509.type.AuthorityKeyIdentifier.MyEnum.AUTHORITY_CERT_SERIAL_NUMBER;
+import static org.apache.kerby.x509.type.AuthorityKeyIdentifier.MyEnum.KEY_IDENTIFIER;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/BasicConstraints.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/BasicConstraints.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/BasicConstraints.java
index bbb4dd2..21aee8a 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/BasicConstraints.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/BasicConstraints.java
@@ -19,15 +19,17 @@
  */
 package org.apache.kerby.x509.type;
 
+import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1Boolean;
-import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
-import static org.apache.kerby.x509.type.BasicConstraints.MyEnum.*;
 
 import java.math.BigInteger;
 
+import static org.apache.kerby.x509.type.BasicConstraints.MyEnum.CA;
+import static org.apache.kerby.x509.type.BasicConstraints.MyEnum.PATH_LEN_CONSTRAINT;
+
 /**
  * 
  * BasicConstraints := SEQUENCE {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Certificate.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Certificate.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Certificate.java
index ef44524..1597f88 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Certificate.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Certificate.java
@@ -19,11 +19,14 @@
  */
 package org.apache.kerby.x509.type;
 
+import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1BitString;
-import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
-import static org.apache.kerby.x509.type.Certificate.MyEnum.*;
+
+import static org.apache.kerby.x509.type.Certificate.MyEnum.SIGNATURE;
+import static org.apache.kerby.x509.type.Certificate.MyEnum.SIGNATURE_ALGORITHM;
+import static org.apache.kerby.x509.type.Certificate.MyEnum.TBS_CERTIFICATE;
 
 /**
  * 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificateList.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificateList.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificateList.java
index 8f3ebab..a18f784 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificateList.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificateList.java
@@ -19,11 +19,14 @@
  */
 package org.apache.kerby.x509.type;
 
+import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1BitString;
-import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
-import static org.apache.kerby.x509.type.CertificateList.MyEnum.*;
+
+import static org.apache.kerby.x509.type.CertificateList.MyEnum.SIGNATURE_ALGORITHMS;
+import static org.apache.kerby.x509.type.CertificateList.MyEnum.SIGNATURE_VALUE;
+import static org.apache.kerby.x509.type.CertificateList.MyEnum.TBS_CERT_LIST;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificatePair.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificatePair.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificatePair.java
index 4463e68..db0bd4a 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificatePair.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificatePair.java
@@ -21,9 +21,11 @@ package org.apache.kerby.x509.type;
 
 import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
-import org.apache.kerby.asn1.type.Asn1SequenceType;
 import org.apache.kerby.asn1.ExplicitField;
-import static org.apache.kerby.x509.type.CertificatePair.MyEnum.*;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.x509.type.CertificatePair.MyEnum.FORWARD;
+import static org.apache.kerby.x509.type.CertificatePair.MyEnum.REVERSE;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DHParameter.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DHParameter.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DHParameter.java
index f5366c1..c5cfeee 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DHParameter.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DHParameter.java
@@ -4,10 +4,13 @@ import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
-import static org.apache.kerby.x509.type.DHParameter.MyEnum.*;
 
 import java.math.BigInteger;
 
+import static org.apache.kerby.x509.type.DHParameter.MyEnum.G;
+import static org.apache.kerby.x509.type.DHParameter.MyEnum.P;
+import static org.apache.kerby.x509.type.DHParameter.MyEnum.Q;
+
 public class DHParameter extends Asn1SequenceType {
     protected static enum MyEnum implements EnumType {
         P,

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DSAParameter.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DSAParameter.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DSAParameter.java
index 8b7d9b3..b7b39ad 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DSAParameter.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DSAParameter.java
@@ -23,10 +23,13 @@ import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
-import static org.apache.kerby.x509.type.DSAParameter.MyEnum.*;
 
 import java.math.BigInteger;
 
+import static org.apache.kerby.x509.type.DSAParameter.MyEnum.G;
+import static org.apache.kerby.x509.type.DSAParameter.MyEnum.P;
+import static org.apache.kerby.x509.type.DSAParameter.MyEnum.Q;
+
 public class DSAParameter extends Asn1SequenceType {
     protected enum MyEnum implements EnumType {
         P,

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DigestInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DigestInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DigestInfo.java
index 81fbefb..14c24c9 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DigestInfo.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DigestInfo.java
@@ -23,7 +23,9 @@ import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1OctetString;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
-import static org.apache.kerby.x509.type.DigestInfo.MyEnum.*;
+
+import static org.apache.kerby.x509.type.DigestInfo.MyEnum.DIGEST;
+import static org.apache.kerby.x509.type.DigestInfo.MyEnum.DIGEST_ALGORITHM;
 
 /**
  * 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DirectoryString.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DirectoryString.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DirectoryString.java
index 8008eec..c72062a 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DirectoryString.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DirectoryString.java
@@ -19,15 +19,20 @@
  */
 package org.apache.kerby.x509.type;
 
+import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1BmpString;
 import org.apache.kerby.asn1.type.Asn1Choice;
-import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1PrintableString;
 import org.apache.kerby.asn1.type.Asn1T61String;
 import org.apache.kerby.asn1.type.Asn1UniversalString;
 import org.apache.kerby.asn1.type.Asn1Utf8String;
-import static org.apache.kerby.x509.type.DirectoryString.MyEnum.*;
+
+import static org.apache.kerby.x509.type.DirectoryString.MyEnum.BMP_STRING;
+import static org.apache.kerby.x509.type.DirectoryString.MyEnum.PRINTABLE_STRING;
+import static org.apache.kerby.x509.type.DirectoryString.MyEnum.TELETEX_STRING;
+import static org.apache.kerby.x509.type.DirectoryString.MyEnum.UNIVERSAL_STRING;
+import static org.apache.kerby.x509.type.DirectoryString.MyEnum.UTF8_STRING;
 
 /**
  * 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DisplayText.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DisplayText.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DisplayText.java
index 887ceba..1409c21 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DisplayText.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DisplayText.java
@@ -19,14 +19,18 @@
  */
 package org.apache.kerby.x509.type;
 
+import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1BmpString;
 import org.apache.kerby.asn1.type.Asn1Choice;
-import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1IA5String;
 import org.apache.kerby.asn1.type.Asn1Utf8String;
 import org.apache.kerby.asn1.type.Asn1VisibleString;
-import static org.apache.kerby.x509.type.DisplayText.MyEnum.*;
+
+import static org.apache.kerby.x509.type.DisplayText.MyEnum.BMP_STRING;
+import static org.apache.kerby.x509.type.DisplayText.MyEnum.IA5_STRING;
+import static org.apache.kerby.x509.type.DisplayText.MyEnum.UTF8_STRING;
+import static org.apache.kerby.x509.type.DisplayText.MyEnum.VISIBLE_STRING;
 
 /**
  * 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DistributionPoint.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DistributionPoint.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DistributionPoint.java
index a6a7d0c..3cd23de 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DistributionPoint.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DistributionPoint.java
@@ -21,9 +21,12 @@ package org.apache.kerby.x509.type;
 
 import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
-import org.apache.kerby.asn1.type.Asn1SequenceType;
 import org.apache.kerby.asn1.ExplicitField;
-import static org.apache.kerby.x509.type.DistributionPoint.MyEnum.*;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.x509.type.DistributionPoint.MyEnum.CRL_ISSUER;
+import static org.apache.kerby.x509.type.DistributionPoint.MyEnum.DISTRIBUTION_POINT;
+import static org.apache.kerby.x509.type.DistributionPoint.MyEnum.REASONS;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DistributionPointName.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DistributionPointName.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DistributionPointName.java
index 975a02b..8add69d 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DistributionPointName.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DistributionPointName.java
@@ -19,12 +19,14 @@
  */
 package org.apache.kerby.x509.type;
 
-import org.apache.kerby.asn1.EnumType;
-import org.apache.kerby.asn1.type.Asn1Choice;
 import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.asn1.type.Asn1Choice;
 import org.apache.kerby.x500.type.RelativeDistinguishedName;
-import static org.apache.kerby.x509.type.DistributionPointName.MyEnum.*;
+
+import static org.apache.kerby.x509.type.DistributionPointName.MyEnum.FULL_NAME;
+import static org.apache.kerby.x509.type.DistributionPointName.MyEnum.NAME_RELATIVE_TO_CRL_ISSUER;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/EDIPartyName.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/EDIPartyName.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/EDIPartyName.java
index 65b711f..2d06a88 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/EDIPartyName.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/EDIPartyName.java
@@ -19,11 +19,13 @@
  */
 package org.apache.kerby.x509.type;
 
-import org.apache.kerby.asn1.EnumType;
-import org.apache.kerby.asn1.type.Asn1Choice;
 import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.ExplicitField;
-import static org.apache.kerby.x509.type.EDIPartyName.MyEnum.*;
+import org.apache.kerby.asn1.type.Asn1Choice;
+
+import static org.apache.kerby.x509.type.EDIPartyName.MyEnum.NAME_ASSIGNER;
+import static org.apache.kerby.x509.type.EDIPartyName.MyEnum.PARTY_NAME;
 
 /**
  * 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Extension.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Extension.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Extension.java
index 1769e60..f0f1f3f 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Extension.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Extension.java
@@ -19,13 +19,16 @@
  */
 package org.apache.kerby.x509.type;
 
+import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1Boolean;
-import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
 import org.apache.kerby.asn1.type.Asn1OctetString;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
-import static org.apache.kerby.x509.type.Extension.MyEnum.*;
+
+import static org.apache.kerby.x509.type.Extension.MyEnum.CRITICAL;
+import static org.apache.kerby.x509.type.Extension.MyEnum.EXTN_ID;
+import static org.apache.kerby.x509.type.Extension.MyEnum.EXTN_VALUE;
 
 /**
  * Ref. X.509 V3 extension

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralName.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralName.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralName.java
index 7f9217a..aa6dc55 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralName.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralName.java
@@ -30,7 +30,15 @@ import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
 import org.apache.kerby.asn1.type.Asn1OctetString;
 import org.apache.kerby.x500.type.Name;
 
-import static org.apache.kerby.x509.type.GeneralName.MyEnum.*;
+import static org.apache.kerby.x509.type.GeneralName.MyEnum.DIRECTORY_NAME;
+import static org.apache.kerby.x509.type.GeneralName.MyEnum.DNS_NAME;
+import static org.apache.kerby.x509.type.GeneralName.MyEnum.EDI_PARTY_NAME;
+import static org.apache.kerby.x509.type.GeneralName.MyEnum.IP_ADDRESS;
+import static org.apache.kerby.x509.type.GeneralName.MyEnum.OTHER_NAME;
+import static org.apache.kerby.x509.type.GeneralName.MyEnum.REGISTERED_ID;
+import static org.apache.kerby.x509.type.GeneralName.MyEnum.RFC822_NAME;
+import static org.apache.kerby.x509.type.GeneralName.MyEnum.UNIFORM_RESOURCE_IDENTIFIER;
+import static org.apache.kerby.x509.type.GeneralName.MyEnum.X400_ADDRESS;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtree.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtree.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtree.java
index fcf1dee..52f8654 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtree.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtree.java
@@ -21,10 +21,13 @@ package org.apache.kerby.x509.type;
 
 import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.ExplicitField;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
-import org.apache.kerby.asn1.ExplicitField;
-import static org.apache.kerby.x509.type.GeneralSubtree.MyEnum.*;
+
+import static org.apache.kerby.x509.type.GeneralSubtree.MyEnum.BASE;
+import static org.apache.kerby.x509.type.GeneralSubtree.MyEnum.MAXMUM;
+import static org.apache.kerby.x509.type.GeneralSubtree.MyEnum.MINIMUM;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Holder.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Holder.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Holder.java
index 05fde32..98b706c 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Holder.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Holder.java
@@ -21,9 +21,12 @@ package org.apache.kerby.x509.type;
 
 import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
-import org.apache.kerby.asn1.type.Asn1SequenceType;
 import org.apache.kerby.asn1.ExplicitField;
-import static org.apache.kerby.x509.type.Holder.MyEnum.*;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.x509.type.Holder.MyEnum.BASE_CERTIFICATE_ID;
+import static org.apache.kerby.x509.type.Holder.MyEnum.ENTITY_NAME;
+import static org.apache.kerby.x509.type.Holder.MyEnum.OBJECT_DIGEST_INFO;
 
 /**
  * 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntax.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntax.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntax.java
index d573255..b92c73b 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntax.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntax.java
@@ -21,9 +21,11 @@ package org.apache.kerby.x509.type;
 
 import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
-import org.apache.kerby.asn1.type.Asn1SequenceType;
 import org.apache.kerby.asn1.ExplicitField;
-import static org.apache.kerby.x509.type.IetfAttrSyntax.MyEnum.*;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.x509.type.IetfAttrSyntax.MyEnum.POLICY_AUTHORITY;
+import static org.apache.kerby.x509.type.IetfAttrSyntax.MyEnum.VALUES;
 
 /**
  * Ref. RFC3281

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/997c63b1/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntaxChoice.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntaxChoice.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntaxChoice.java
index c8d9e63..b2b4bcc 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntaxChoice.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntaxChoice.java
@@ -19,12 +19,15 @@
  */
 package org.apache.kerby.x509.type;
 
+import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1Choice;
-import org.apache.kerby.asn1.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
 import org.apache.kerby.asn1.type.Asn1OctetString;
-import static org.apache.kerby.x509.type.IetfAttrSyntaxChoice.MyEnum.*;
+
+import static org.apache.kerby.x509.type.IetfAttrSyntaxChoice.MyEnum.OCTETS;
+import static org.apache.kerby.x509.type.IetfAttrSyntaxChoice.MyEnum.OID;
+import static org.apache.kerby.x509.type.IetfAttrSyntaxChoice.MyEnum.UTF8;
 
 /**
  * Ref. RFC3281