You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pl...@apache.org on 2015/11/27 09:18:11 UTC

[01/17] directory-kerby git commit: DIRKRB-475 The decoded asn1 object with the wrong tagFlags.

Repository: directory-kerby
Updated Branches:
  refs/heads/pkinit-support b9485672c -> 67c2bb6e2


DIRKRB-475 The decoded asn1 object with the wrong tagFlags.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/5706da2e
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/5706da2e
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/5706da2e

Branch: refs/heads/pkinit-support
Commit: 5706da2ebb7cc5aea15dcb186efe2995de28f6af
Parents: c307970
Author: plusplusjiajia <ji...@intel.com>
Authored: Thu Nov 26 10:16:56 2015 +0800
Committer: plusplusjiajia <ji...@intel.com>
Committed: Thu Nov 26 10:16:56 2015 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java   | 3 ++-
 .../java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java     | 4 +++-
 .../src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java   | 3 ++-
 3 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5706da2e/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
index f0fbf35..305f986 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
@@ -209,9 +209,10 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
     protected void decode(LimitedByteBuffer content) throws IOException {
         int tag = readTag(content);
         int tagNo = readTagNo(content, tag);
+        int tagFlags = tag & 0xe0;
         int length = readLength(content);
 
-        decode(tag, tagNo, new LimitedByteBuffer(content, length));
+        decode(tagNo, tagNo, new LimitedByteBuffer(content, length));
     }
 
     public void decode(int tagFlags, int tagNo,

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5706da2e/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java b/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
index da6c7ce..8c005b4 100644
--- a/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
+++ b/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
@@ -19,8 +19,8 @@
  */
 package org.apache.kerby.kerberos.kerb.codec;
 
-import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.KrbCodec;
+import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.spec.base.CheckSum;
 import org.apache.kerby.kerberos.kerb.spec.base.CheckSumType;
 import org.junit.Test;
@@ -41,5 +41,7 @@ public class CodecTest {
         assertThat(restored).isNotNull();
         assertThat(restored.getCksumtype()).isEqualTo(mcs.getCksumtype());
         assertThat(mcs.getChecksum()).isEqualTo(restored.getChecksum());
+        assertThat(restored.tagNo()).isEqualTo(mcs.tagNo());
+        assertThat(restored.tagFlags()).isEqualTo(mcs.tagFlags());
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/5706da2e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
index fd3d4ba..4827961 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
@@ -67,6 +67,7 @@ public class KrbCodec {
         LimitedByteBuffer limitedBuffer = new LimitedByteBuffer(byteBuffer);
         int tag = AbstractAsn1Type.readTag(limitedBuffer);
         int tagNo = AbstractAsn1Type.readTagNo(limitedBuffer, tag);
+        int tagFlags = tag & 0xe0;
         int length = AbstractAsn1Type.readLength(limitedBuffer);
         LimitedByteBuffer valueBuffer = new LimitedByteBuffer(limitedBuffer, length);
 
@@ -89,7 +90,7 @@ public class KrbCodec {
         } else {
             throw new IOException("To be supported krb message type with tag: " + tag);
         }
-        msg.decode(tag, tagNo, valueBuffer);
+        msg.decode(tagFlags, tagNo, valueBuffer);
 
         return msg;
     }


[16/17] directory-kerby git commit: Removed unused x509 package.

Posted by pl...@apache.org.
Removed unused x509 package.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/af7deb64
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/af7deb64
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/af7deb64

Branch: refs/heads/pkinit-support
Commit: af7deb64e613d83339b49b5df97d84305f62cf7c
Parents: e00fa4e
Author: plusplusjiajia <ji...@intel.com>
Authored: Fri Nov 27 15:55:00 2015 +0800
Committer: plusplusjiajia <ji...@intel.com>
Committed: Fri Nov 27 15:55:00 2015 +0800

----------------------------------------------------------------------
 .../client/preauth/pkinit/PkinitPreauth.java    |  2 +-
 .../kerb/preauth/pkinit/PluginOpts.java         |  2 +-
 kerby-kerb/kerb-core/pom.xml                    |  5 ++
 .../spec/pa/pkinit/AlgorithmIdentifiers.java    |  2 +-
 .../kerberos/kerb/spec/pa/pkinit/AuthPack.java  |  2 +-
 .../kerb/spec/x509/AlgorithmIdentifier.java     | 64 --------------------
 .../kerb/spec/x509/SubjectPublicKeyInfo.java    | 61 -------------------
 7 files changed, 9 insertions(+), 129 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/af7deb64/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
index f8b8376..0a69a04 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
@@ -42,7 +42,7 @@ import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.DHNonce;
 import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.PaPkAsReq;
 import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.PkAuthenticator;
 import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.TrustedCertifiers;
-import org.apache.kerby.kerberos.kerb.spec.x509.SubjectPublicKeyInfo;
+import org.apache.kerby.x509.type.SubjectPublicKeyInfo;
 
 @SuppressWarnings("PMD")
 public class PkinitPreauth extends AbstractPreauthPlugin {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/af7deb64/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PluginOpts.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PluginOpts.java b/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PluginOpts.java
index 38295fa..7dd8768 100644
--- a/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PluginOpts.java
+++ b/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PluginOpts.java
@@ -22,7 +22,7 @@ package org.apache.kerby.kerberos.kerb.preauth.pkinit;
 import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
 import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.AlgorithmIdentifiers;
 import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.TrustedCertifiers;
-import org.apache.kerby.kerberos.kerb.spec.x509.AlgorithmIdentifier;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
 
 public class PluginOpts {
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/af7deb64/kerby-kerb/kerb-core/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/pom.xml b/kerby-kerb/kerb-core/pom.xml
index 1eb5140..dac1da5 100644
--- a/kerby-kerb/kerb-core/pom.xml
+++ b/kerby-kerb/kerb-core/pom.xml
@@ -32,6 +32,11 @@
       <artifactId>kerby-asn1</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.kerby</groupId>
+      <artifactId>kerby-pkix</artifactId>
+      <version>${project.version}</version>
+    </dependency>
 
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/af7deb64/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AlgorithmIdentifiers.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AlgorithmIdentifiers.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AlgorithmIdentifiers.java
index 2d1fa74..3a68fbb 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AlgorithmIdentifiers.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AlgorithmIdentifiers.java
@@ -20,7 +20,7 @@
 package org.apache.kerby.kerberos.kerb.spec.pa.pkinit;
 
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceOfType;
-import org.apache.kerby.kerberos.kerb.spec.x509.AlgorithmIdentifier;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
 
 /**
  trustedCertifiers       SEQUENCE OF AlgorithmIdentifier OPTIONAL,

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/af7deb64/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AuthPack.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AuthPack.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AuthPack.java
index c3e429a..b5e505d 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AuthPack.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AuthPack.java
@@ -22,7 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.pa.pkinit;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
-import org.apache.kerby.kerberos.kerb.spec.x509.SubjectPublicKeyInfo;
+import org.apache.kerby.x509.type.SubjectPublicKeyInfo;
 
 /**
  AuthPack ::= SEQUENCE {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/af7deb64/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/AlgorithmIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/AlgorithmIdentifier.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/AlgorithmIdentifier.java
deleted file mode 100644
index 6731a29..0000000
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/AlgorithmIdentifier.java
+++ /dev/null
@@ -1,64 +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.kerberos.kerb.spec.x509;
-
-
-import org.apache.kerby.asn1.type.Asn1Any;
-import org.apache.kerby.asn1.type.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.type.ExplicitField;
-
-/**
- AlgorithmIdentifier  ::=  SEQUENCE  {
-     algorithm               OBJECT IDENTIFIER,
-     parameters              ANY DEFINED BY algorithm OPTIONAL
- }
- */
-public class AlgorithmIdentifier extends Asn1SequenceType {
-    private static final int ALGORITHM = 0;
-    private static final int PARAMETERS = 1;
-
-    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new ExplicitField(ALGORITHM, -1, Asn1ObjectIdentifier.class),
-            new ExplicitField(PARAMETERS, -1, Asn1Any.class)
-    };
-
-    public AlgorithmIdentifier() {
-        super(fieldInfos);
-    }
-
-    public Asn1ObjectIdentifier getAlgorithm() {
-        return getFieldAs(ALGORITHM, Asn1ObjectIdentifier.class);
-    }
-
-    public void setAlgorithm(Asn1ObjectIdentifier algorithm) {
-        setFieldAs(ALGORITHM, algorithm);
-    }
-
-    public Asn1Type getParameters() {
-        return getFieldAsAny(PARAMETERS);
-    }
-
-    public void setParameters(Asn1Type parameters) {
-        setFieldAsAny(PARAMETERS, parameters);
-    }
-}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/af7deb64/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/SubjectPublicKeyInfo.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/SubjectPublicKeyInfo.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/SubjectPublicKeyInfo.java
deleted file mode 100644
index 28db296..0000000
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/SubjectPublicKeyInfo.java
+++ /dev/null
@@ -1,61 +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.kerberos.kerb.spec.x509;
-
-import org.apache.kerby.asn1.type.Asn1BitString;
-import org.apache.kerby.asn1.type.Asn1FieldInfo;
-import org.apache.kerby.asn1.type.Asn1SequenceType;
-import org.apache.kerby.asn1.type.ExplicitField;
-
-/**
- SubjectPublicKeyInfo  ::=  SEQUENCE  {
-     algorithm            AlgorithmIdentifier,
-     subjectPublicKey     BIT STRING
- }
- */
-public class SubjectPublicKeyInfo extends Asn1SequenceType {
-    private static final int ALGORITHM = 0;
-    private static final int SUBJECT_PUBLIC_KEY = 1;
-
-    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new ExplicitField(ALGORITHM, -1, AlgorithmIdentifier.class),
-            new ExplicitField(SUBJECT_PUBLIC_KEY, -1, Asn1BitString.class)
-    };
-
-    public SubjectPublicKeyInfo() {
-        super(fieldInfos);
-    }
-
-    public AlgorithmIdentifier getAlgorithm() {
-        return getFieldAs(ALGORITHM, AlgorithmIdentifier.class);
-    }
-
-    public void setAlgorithm(AlgorithmIdentifier algorithm) {
-        setFieldAs(ALGORITHM, algorithm);
-    }
-
-    public byte[] getSubjectPubKey() {
-        return getFieldAsOctets(SUBJECT_PUBLIC_KEY);
-    }
-
-    public void setSubjectPubKey(byte[] subjectPubKey) {
-        setFieldAs(SUBJECT_PUBLIC_KEY, new Asn1BitString(subjectPubKey));
-    }
-}


[14/17] directory-kerby git commit: DIRKRB-463 Cryptographic Message Syntax (CMS) support.

Posted by pl...@apache.org.
DIRKRB-463 Cryptographic Message Syntax (CMS) support.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/ac93a201
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/ac93a201
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/ac93a201

Branch: refs/heads/pkinit-support
Commit: ac93a2010fce13333c80047f4fbd48b529b74f9d
Parents: 93bcd6f
Author: plusplusjiajia <ji...@intel.com>
Authored: Fri Nov 27 15:15:56 2015 +0800
Committer: plusplusjiajia <ji...@intel.com>
Committed: Fri Nov 27 15:15:56 2015 +0800

----------------------------------------------------------------------
 kerby-pkix/pom.xml                              |   1 +
 .../org/apache/kerby/cms/type/Attribute.java    |  66 +++++++++
 .../cms/type/AttributeCertificateInfoV1.java    | 147 +++++++++++++++++++
 .../kerby/cms/type/AttributeCertificateV1.java  |  73 +++++++++
 .../kerby/cms/type/AttributeCertificateV2.java  |  29 ++++
 .../org/apache/kerby/cms/type/Certificate.java  |  76 ++++++++++
 .../kerby/cms/type/CertificateChoices.java      |  93 ++++++++++++
 .../apache/kerby/cms/type/CertificateList.java  |  77 ++++++++++
 .../apache/kerby/cms/type/CertificateSet.java   |  29 ++++
 .../org/apache/kerby/cms/type/CmsVersion.java   |  53 +++++++
 .../apache/kerby/cms/type/CompressedData.java   |  77 ++++++++++
 .../org/apache/kerby/cms/type/ContentInfo.java  |  69 +++++++++
 .../cms/type/DigestAlgorithmIdentifier.java     |  28 ++++
 .../cms/type/DigestAlgorithmIdentifiers.java    |  28 ++++
 .../kerby/cms/type/EncapsulatedContentInfo.java |  64 ++++++++
 .../kerby/cms/type/ExtendedCertificate.java     |  70 +++++++++
 .../kerby/cms/type/ExtendedCertificateInfo.java |  71 +++++++++
 .../kerby/cms/type/IssuerAndSerialNumber.java   |  66 +++++++++
 .../kerby/cms/type/OtherCertificateFormat.java  |  63 ++++++++
 .../cms/type/OtherRevocationInfoFormat.java     |  62 ++++++++
 .../cms/type/RelativeDistinguishedName.java     |  29 ++++
 .../kerby/cms/type/RevocationInfoChoice.java    |  60 ++++++++
 .../kerby/cms/type/RevocationInfoChoices.java   |  28 ++++
 .../org/apache/kerby/cms/type/Signature.java    |  28 ++++
 .../cms/type/SignatureAlgorithmIdentifier.java  |  28 ++++
 .../apache/kerby/cms/type/SignatureValue.java   |  28 ++++
 .../apache/kerby/cms/type/SignedAttributes.java |  28 ++++
 .../org/apache/kerby/cms/type/SignedData.java   | 108 ++++++++++++++
 .../apache/kerby/cms/type/SignerIdentifier.java |  66 +++++++++
 .../org/apache/kerby/cms/type/SignerInfo.java   | 119 +++++++++++++++
 .../org/apache/kerby/cms/type/SignerInfos.java  |  28 ++++
 .../java/org/apache/kerby/cms/type/Subject.java |  65 ++++++++
 .../kerby/cms/type/UnsignedAttributes.java      |  28 ++++
 33 files changed, 1885 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-pkix/pom.xml b/kerby-pkix/pom.xml
index 77abf62..3c3d5be 100644
--- a/kerby-pkix/pom.xml
+++ b/kerby-pkix/pom.xml
@@ -30,6 +30,7 @@
     <dependency>
       <groupId>org.apache.kerby</groupId>
       <artifactId>kerby-asn1</artifactId>
+      <version>${project.version}</version>
     </dependency>
   </dependencies>
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..cffd5ed
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Attribute.java
@@ -0,0 +1,66 @@
+/**
+ *  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.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.AttributeValues;
+
+/**
+ * Ref. RFC 5652
+ * <pre>
+ * Attribute ::= SEQUENCE {
+ *     attrType OBJECT IDENTIFIER,
+ *     attrValues SET OF AttributeValue
+ * }
+ * 
+ * AttributeValue ::= ANY
+ * </pre>
+ */
+public class Attribute extends Asn1SequenceType {
+    private static final int ATTR_TYPE = 0;
+    private static final int ATTR_VALUES = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+        new Asn1FieldInfo(ATTR_TYPE, Asn1ObjectIdentifier.class),
+        new Asn1FieldInfo(ATTR_VALUES, AttributeValues.class),
+    };
+
+    public Attribute() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getAttrType() {
+        return getFieldAs(ATTR_TYPE, Asn1ObjectIdentifier.class);
+    }
+
+    public void setAttrType(Asn1ObjectIdentifier attrType) {
+        setFieldAs(ATTR_TYPE, attrType);
+    }
+
+    public AttributeValues getAttrValues() {
+        return getFieldAs(ATTR_VALUES, AttributeValues.class);
+    }
+
+    public void setAttrValues(AttributeValues values) {
+        setFieldAs(ATTR_VALUES, values);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..9b6c395
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateInfoV1.java
@@ -0,0 +1,147 @@
+/**
+ *  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.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+import org.apache.kerby.x509.type.AttCertIssuer;
+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;
+
+/**
+ * AttributeCertificateInfoV1 ::= SEQUENCE {
+ *   version AttCertVersionV1 DEFAULT v1,
+ *   subject Subject,
+ *   issuer GeneralNames,
+ *   signature AlgorithmIdentifier,
+ *   serialNumber CertificateSerialNumber,
+ *   attCertValidityPeriod AttCertValidityPeriod,
+ *   attributes SEQUENCE OF Attribute,
+ *   issuerUniqueID UniqueIdentifier OPTIONAL,
+ *   extensions Extensions OPTIONAL
+ * }
+ *
+ * AttCertVersionV1 ::= INTEGER { v1(0) }
+ */
+public class AttributeCertificateInfoV1 extends Asn1SequenceType {
+
+    private static final int VERSION = 0;
+    private static final int SUBJECT = 1;
+    private static final int ISSUER = 2;
+    private static final int SIGNATURE = 3;
+    private static final int SERIAL_NUMBER = 4;
+    private static final int ATTR_CERT_VALIDITY_PERIOD = 5;
+    private static final int ATTRIBUTES = 6;
+    private static final int ISSUER_UNIQUE_ID = 7;
+    private static final int EXTENSIONS = 8;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(VERSION, Asn1Integer.class),
+            new Asn1FieldInfo(SUBJECT, Subject.class),
+            new Asn1FieldInfo(ISSUER, AttCertIssuer.class),
+            new Asn1FieldInfo(SIGNATURE, AlgorithmIdentifier.class),
+            new Asn1FieldInfo(SERIAL_NUMBER, CertificateSerialNumber.class),
+            new Asn1FieldInfo(ATTR_CERT_VALIDITY_PERIOD, AttCertValidityPeriod.class),
+            new Asn1FieldInfo(ATTRIBUTES, Attributes.class),
+            new Asn1FieldInfo(ISSUER_UNIQUE_ID, Asn1BitString.class),
+            new Asn1FieldInfo(EXTENSIONS, Extensions.class)
+    };
+
+    public AttributeCertificateInfoV1() {
+        super(fieldInfos);
+    }
+
+    public int getVersion() {
+        return getFieldAsInteger(VERSION);
+    }
+
+    public void setVersion(int version) {
+        setFieldAsInt(VERSION, version);
+    }
+
+    public Subject getSubject() {
+        return getFieldAs(SUBJECT, Subject.class);
+    }
+
+    public void setSubject(Subject subject) {
+        setFieldAs(SUBJECT, subject);
+    }
+
+    public AttCertIssuer getIssuer() {
+        return getFieldAs(ISSUER, AttCertIssuer.class);
+    }
+
+    public void setIssuer(AttCertIssuer attCertIssuer) {
+        setFieldAs(ISSUER, attCertIssuer);
+    }
+
+    public AlgorithmIdentifier getSignature() {
+        return getFieldAs(SIGNATURE, AlgorithmIdentifier.class);
+    }
+
+    public void setSignature(AlgorithmIdentifier signature) {
+        setFieldAs(SIGNATURE, signature);
+    }
+
+    public CertificateSerialNumber getSerialNumber() {
+        return getFieldAs(SERIAL_NUMBER, CertificateSerialNumber.class);
+    }
+
+    public void setSerialNumber(CertificateSerialNumber certificateSerialNumber) {
+        setFieldAs(SERIAL_NUMBER, certificateSerialNumber);
+    }
+
+    public AttCertValidityPeriod getAttrCertValidityPeriod() {
+        return getFieldAs(ATTR_CERT_VALIDITY_PERIOD, AttCertValidityPeriod.class);
+    }
+
+    public void setAttrCertValidityPeriod(AttCertValidityPeriod attrCertValidityPeriod) {
+        setFieldAs(ATTR_CERT_VALIDITY_PERIOD, attrCertValidityPeriod);
+    }
+
+    public Attributes getAttributes() {
+        return getFieldAs(ATTRIBUTES, Attributes.class);
+    }
+
+    public void setAttributes(Attributes attributes) {
+        setFieldAs(ATTRIBUTES, attributes);
+    }
+
+    public byte[] getIssuerUniqueID() {
+        return getFieldAs(ISSUER_UNIQUE_ID, Asn1BitString.class).getValue();
+    }
+
+    public void setIssuerUniqueId(byte[] issuerUniqueId) {
+        setFieldAs(ISSUER_UNIQUE_ID, new Asn1BitString(issuerUniqueId));
+    }
+
+    public Extensions getExtensions() {
+        return getFieldAs(EXTENSIONS, Extensions.class);
+    }
+
+    public void setExtensions(Extensions extensions) {
+        setFieldAs(EXTENSIONS, extensions);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..4556c39
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV1.java
@@ -0,0 +1,73 @@
+/**
+ *  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.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+import org.apache.kerby.x509.type.AttributeCertificateInfo;
+
+/**
+ * AttributeCertificateV1 ::= SEQUENCE {
+ *   acInfo AttributeCertificateInfoV1,
+ *   signatureAlgorithm AlgorithmIdentifier,
+ *   signature BIT STRING
+ * }
+ */
+public class AttributeCertificateV1 extends Asn1SequenceType {
+    private static final int ACI_INFO = 0;
+    private static final int SIGNATURE_ALGORITHM = 1;
+    private static final int SIGNATURE = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(ACI_INFO, AttributeCertificateInfoV1.class),
+            new Asn1FieldInfo(SIGNATURE_ALGORITHM, AlgorithmIdentifier.class),
+            new Asn1FieldInfo(SIGNATURE, Asn1BitString.class)
+    };
+
+    public AttributeCertificateV1(Asn1FieldInfo[] tags) {
+        super(tags);
+    }
+
+    public AttributeCertificateInfo getAcinfo() {
+        return getFieldAs(ACI_INFO, AttributeCertificateInfo.class);
+    }
+
+    public void setAciInfo(AttributeCertificateInfo aciInfo) {
+        setFieldAs(ACI_INFO, aciInfo);
+    }
+
+    public AlgorithmIdentifier getSignatureAlgorithm() {
+        return getFieldAs(SIGNATURE_ALGORITHM, AlgorithmIdentifier.class);
+    }
+
+    public void setSignatureAlgorithm(AlgorithmIdentifier signatureAlgorithm) {
+        setFieldAs(SIGNATURE_ALGORITHM, signatureAlgorithm);
+    }
+
+    public Asn1BitString getSignatureValue() {
+        return getFieldAs(SIGNATURE, Asn1BitString.class);
+    }
+
+    public void setSignatureValue(Asn1BitString signatureValue) {
+        setFieldAs(SIGNATURE, signatureValue);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV2.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV2.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV2.java
new file mode 100644
index 0000000..df21d03
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV2.java
@@ -0,0 +1,29 @@
+/**
+ *  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.x509.type.AttributeCertificate;
+
+/**
+ * AttributeCertificateV2 ::= AttributeCertificate
+ */
+public class AttributeCertificateV2 extends AttributeCertificate {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..53a570f
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Certificate.java
@@ -0,0 +1,76 @@
+/**
+ *  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.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+import org.apache.kerby.x509.type.TBSCertificate;
+
+/**
+ * <pre>
+ *  Certificate ::= SEQUENCE {
+ *      tbsCertificate          TBSCertificate,
+ *      signatureAlgorithm      AlgorithmIdentifier,
+ *      signature               BIT STRING
+ *  }
+ * </pre>
+ */
+public class Certificate extends Asn1SequenceType {
+
+    private static final int TBS_CERTIFICATE = 0;
+    private static final int SIGNATURE_ALGORITHM = 1;
+    private static final int SIGNATURE = 2;
+
+    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/ac93a201/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
new file mode 100644
index 0000000..cb6a601
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateChoices.java
@@ -0,0 +1,93 @@
+/**
+ *  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.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ImplicitField;
+
+/**
+ * CertificateChoices ::= CHOICE {
+ *   certificate Certificate,
+ *   extendedCertificate [0] IMPLICIT ExtendedCertificate,  -- Obsolete
+ *   v1AttrCert [1] IMPLICIT AttributeCertificateV1,        -- Obsolete
+ *   v2AttrCert [2] IMPLICIT AttributeCertificateV2,
+ *   other [3] IMPLICIT OtherCertificateFormat }
+ */
+public class CertificateChoices extends Asn1Choice {
+
+    private static final int CERTIFICATE = 0;
+    private static final int EXTENDED_CERTIFICATE = 1;
+    private static final int V1_ATTR_CERT = 2;
+    private static final int V2_ATTR_CERT = 3;
+    private static final int OTHER = 4;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(CERTIFICATE, Certificate.class),
+            new ImplicitField(EXTENDED_CERTIFICATE, 0, ExtendedCertificate.class),
+            new ImplicitField(V1_ATTR_CERT, 1, AttributeCertificateV1.class),
+            new ImplicitField(V2_ATTR_CERT, 2, AttributeCertificateV2.class),
+            new ImplicitField(OTHER, 3, OtherCertificateFormat.class),
+    };
+
+    public CertificateChoices() {
+        super(fieldInfos);
+    }
+
+    public Certificate getCertificate() {
+        return getFieldAs(CERTIFICATE, Certificate.class);
+    }
+
+    public void setCertificate(Certificate certificate) {
+        setFieldAs(CERTIFICATE, certificate);
+    }
+
+    public ExtendedCertificate getExtendedCertificate() {
+        return getFieldAs(EXTENDED_CERTIFICATE, ExtendedCertificate.class);
+    }
+
+    public void setExtendedCertificate(ExtendedCertificate extendedCertificate) {
+        setFieldAs(EXTENDED_CERTIFICATE, extendedCertificate);
+    }
+
+    public AttributeCertificateV1 getV1AttrCert() {
+        return getFieldAs(V1_ATTR_CERT, AttributeCertificateV1.class);
+    }
+
+    public void setV1AttrCert(AttributeCertificateV1 v1AttrCert) {
+        setFieldAs(V1_ATTR_CERT, v1AttrCert);
+    }
+
+    public AttributeCertificateV2 getV2AttrCert() {
+        return getFieldAs(V2_ATTR_CERT, AttributeCertificateV2.class);
+    }
+
+    public void setV2AttrCert(AttributeCertificateV2 v2AttrCert) {
+        setFieldAs(V2_ATTR_CERT, v2AttrCert);
+    }
+
+    public OtherCertificateFormat getOther() {
+        return getFieldAs(OTHER, OtherCertificateFormat.class);
+    }
+
+    public void setOther(OtherCertificateFormat other) {
+        setFieldAs(OTHER, other);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateList.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateList.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateList.java
new file mode 100644
index 0000000..a456f96
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateList.java
@@ -0,0 +1,77 @@
+/**
+ *  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.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+import org.apache.kerby.x509.type.TBSCertList;
+
+/**
+ * Ref. RFC-2459
+ *
+ * <pre>
+ * CertificateList  ::=  SEQUENCE  {
+ *      tbsCertList          TBSCertList,
+ *      signatureAlgorithm   AlgorithmIdentifier,
+ *      signatureValue       BIT STRING
+ * }
+ * </pre>
+ */
+public class CertificateList extends Asn1SequenceType {
+    private static final int TBS_CERT_LIST = 0;
+    private static final int SIGNATURE_ALGORITHMS = 1;
+    private static final int SIGNATURE_VALUE = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(TBS_CERT_LIST, TBSCertList.class),
+            new Asn1FieldInfo(SIGNATURE_ALGORITHMS, AlgorithmIdentifier.class),
+            new Asn1FieldInfo(SIGNATURE_VALUE, Asn1BitString.class)
+    };
+
+    public CertificateList() {
+        super(fieldInfos);
+    }
+
+    public TBSCertList getTBSCertList() {
+        return getFieldAs(TBS_CERT_LIST, TBSCertList.class);
+    }
+
+    public void setTBSCertList(TBSCertList tbsCertList) {
+        setFieldAs(TBS_CERT_LIST, tbsCertList);
+    }
+
+    public AlgorithmIdentifier getSignatureAlgorithm() {
+        return getFieldAs(SIGNATURE_ALGORITHMS, AlgorithmIdentifier.class);
+    }
+
+    public void setSignatureAlgorithms(AlgorithmIdentifier signatureAlgorithms) {
+        setFieldAs(SIGNATURE_ALGORITHMS, signatureAlgorithms);
+    }
+
+    public Asn1BitString getSignature() {
+        return getFieldAs(SIGNATURE_VALUE, Asn1BitString.class);
+    }
+
+    public void setSignatureValue(Asn1BitString signatureValue) {
+        setFieldAs(SIGNATURE_VALUE, signatureValue);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateSet.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateSet.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateSet.java
new file mode 100644
index 0000000..6fd36f9
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateSet.java
@@ -0,0 +1,29 @@
+/**
+ *  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.type.Asn1SetOf;
+
+/**
+ * CertificateSet ::= SET OF CertificateChoices
+ */
+public class CertificateSet extends Asn1SetOf<CertificateChoices> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CmsVersion.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CmsVersion.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CmsVersion.java
new file mode 100644
index 0000000..bde3992
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CmsVersion.java
@@ -0,0 +1,53 @@
+/**
+ *  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.type.Asn1EnumType;
+import org.apache.kerby.asn1.type.Asn1Integer;
+
+/**
+ * CMSVersion ::= INTEGER
+ * { v0(0), v1(1), v2(2), v3(3), v4(4), v5(5) }
+ */
+
+enum CmsVersionEnum implements Asn1EnumType {
+    V0,
+    V1,
+    V2,
+    V3,
+    V4,
+    V5;
+
+    @Override
+    public int getValue() {
+        return ordinal();
+    }
+}
+
+public class CmsVersion extends Asn1Integer {
+
+    public CmsVersion() {
+        this(CmsVersionEnum.V0);
+    }
+
+    public CmsVersion(CmsVersionEnum version) {
+        super(version.getValue());
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..f678173
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CompressedData.java
@@ -0,0 +1,77 @@
+/**
+ *  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.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+
+/** 
+ * Ref. RFC 3274
+ * 
+ * <pre>
+ * CompressedData ::= SEQUENCE {
+ *     version CMSVersion,
+ *     compressionAlgorithm CompressionAlgorithmIdentifier,
+ *     encapContentInfo EncapsulatedContentInfo
+ * }
+ * </pre>
+ */
+public class CompressedData extends Asn1SequenceType {
+
+    private static final int VERSION = 0;
+    private static final int COMPRESSION_ALGORITHM = 1;
+    private static final int ENCAP_CONTENT_INFO = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(VERSION, CmsVersion.class),
+            new Asn1FieldInfo(COMPRESSION_ALGORITHM, AlgorithmIdentifier.class),
+            new Asn1FieldInfo(ENCAP_CONTENT_INFO, EncapsulatedContentInfo.class)
+    };
+
+    public CompressedData() {
+        super(fieldInfos);
+    }
+
+    public CmsVersion getVersion() {
+        return getFieldAs(VERSION, CmsVersion.class);
+    }
+
+    public void setVersion(CmsVersion version) {
+        setFieldAs(VERSION, version);
+    }
+
+    public AlgorithmIdentifier getCompressionAlgorithm() {
+        return getFieldAs(COMPRESSION_ALGORITHM, AlgorithmIdentifier.class);
+    }
+
+    public void setCompressionAlgorithm(AlgorithmIdentifier compressionAlgorithm) {
+        setFieldAs(COMPRESSION_ALGORITHM, compressionAlgorithm);
+    }
+
+    public EncapsulatedContentInfo getEncapContentInfo() {
+        return getFieldAs(ENCAP_CONTENT_INFO, EncapsulatedContentInfo.class);
+    }
+
+    public void setEncapContentInfo(EncapsulatedContentInfo encapContentInfo) {
+        setFieldAs(ENCAP_CONTENT_INFO, encapContentInfo);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..8190ff1
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java
@@ -0,0 +1,69 @@
+/**
+ *  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.type.Asn1Any;
+import org.apache.kerby.asn1.type.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.type.ExplicitField;
+
+/**
+ * Ref. RFC 5652
+ *
+ * <pre>
+ * ContentInfo ::= SEQUENCE {
+ *     contentType ContentType,
+ *     content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL
+ * }
+ *
+ * ContentType ::= OBJECT IDENTIFIER
+ * </pre>
+ */
+public class ContentInfo extends Asn1SequenceType {
+    private static final int CONTENT_TYPE = 0;
+    private static final int CONTENT = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+        new Asn1FieldInfo(CONTENT_TYPE, Asn1ObjectIdentifier.class),
+        new ExplicitField(CONTENT, 0, Asn1Any.class),
+    };
+
+    public ContentInfo() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getContentType() {
+        return getFieldAs(CONTENT_TYPE, Asn1ObjectIdentifier.class);
+    }
+
+    public void setContentType(Asn1ObjectIdentifier contentType) {
+        setFieldAs(CONTENT_TYPE, contentType);
+    }
+
+    public Asn1Type getContent() {
+        return getFieldAsAny(CONTENT);
+    }
+
+    public void setContent(Asn1Type content) {
+        setFieldAsAny(CONTENT, content);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifier.java
new file mode 100644
index 0000000..8c0d11f
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifier.java
@@ -0,0 +1,28 @@
+/**
+ *  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.x509.type.AlgorithmIdentifier;
+
+/**
+ * DigestAlgorithmIdentifier ::= AlgorithmIdentifier
+ */
+public class DigestAlgorithmIdentifier extends AlgorithmIdentifier {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifiers.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifiers.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifiers.java
new file mode 100644
index 0000000..93c180d
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifiers.java
@@ -0,0 +1,28 @@
+/**
+ *  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.type.Asn1SetOf;
+
+/**
+ * DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
+ */
+public class DigestAlgorithmIdentifiers extends Asn1SetOf<DigestAlgorithmIdentifier> {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..02f1765
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java
@@ -0,0 +1,64 @@
+/**
+ *  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.type.Asn1FieldInfo;
+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.type.ExplicitField;
+
+/**
+ * EncapsulatedContentInfo ::= SEQUENCE {
+ *   eContentType ContentType,
+ *   eContent [0] EXPLICIT OCTET STRING OPTIONAL
+ * }
+ *
+ * ContentType ::= OBJECT IDENTIFIER
+ */
+public class EncapsulatedContentInfo extends Asn1SequenceType {
+    private static final int CONTENT_TYPE = 0;
+    private static final int CONTENT = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+            new Asn1FieldInfo(CONTENT_TYPE, Asn1ObjectIdentifier.class),
+            new ExplicitField(CONTENT, 0, Asn1OctetString.class)
+    };
+
+    public EncapsulatedContentInfo() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getContentType() {
+        return getFieldAs(CONTENT_TYPE, Asn1ObjectIdentifier.class);
+    }
+
+    public void setContentType(Asn1ObjectIdentifier contentType) {
+        setFieldAs(CONTENT_TYPE, contentType);
+    }
+
+    public byte[] getContent() {
+        return getFieldAsOctets(CONTENT);
+    }
+
+    public void setContent(byte[] content) {
+        setFieldAsOctets(CONTENT, content);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..6c5371d
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java
@@ -0,0 +1,70 @@
+/**
+ *  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.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * ExtendedCertificate ::= SEQUENCE {
+ *   extendedCertificateInfo ExtendedCertificateInfo,
+ *   signatureAlgorithm SignatureAlgorithmIdentifier,
+ *   signature Signature
+ * }
+ */
+public class ExtendedCertificate extends Asn1SequenceType {
+    private static final int EXTENDED_CERTIFICATE_INFO = 0;
+    private static final int SIGNATURE_ALGORITHMS = 1;
+    private static final int SIGNATURE = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(EXTENDED_CERTIFICATE_INFO, ExtendedCertificateInfo.class),
+            new Asn1FieldInfo(SIGNATURE_ALGORITHMS, SignatureAlgorithmIdentifier.class),
+            new Asn1FieldInfo(SIGNATURE, Signature.class)
+    };
+
+    public ExtendedCertificate() {
+        super(fieldInfos);
+    }
+
+    public ExtendedCertificateInfo getExtendedCertificateInfo() {
+        return getFieldAs(EXTENDED_CERTIFICATE_INFO, ExtendedCertificateInfo.class);
+    }
+
+    public void setCmsVersion(ExtendedCertificateInfo extendedCertificateInfo) {
+        setFieldAs(EXTENDED_CERTIFICATE_INFO, extendedCertificateInfo);
+    }
+
+    public SignatureAlgorithmIdentifier getSignatureAlgorithmIdentifier() {
+        return getFieldAs(SIGNATURE_ALGORITHMS, SignatureAlgorithmIdentifier.class);
+    }
+
+    public void setSignatureAlgorithmIdentifier(SignatureAlgorithmIdentifier signatureAlgorithmIdentifier) {
+        setFieldAs(SIGNATURE_ALGORITHMS, signatureAlgorithmIdentifier);
+    }
+
+    public Signature getSignature() {
+        return getFieldAs(SIGNATURE, Signature.class);
+    }
+
+    public void setSignature(Signature signature) {
+        setFieldAs(SIGNATURE, signature);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..49c8e04
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificateInfo.java
@@ -0,0 +1,71 @@
+/**
+ *  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.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * ExtendedCertificateInfo ::= SEQUENCE {
+ *   version CMSVersion,
+ *   certificate Certificate,
+ *   attributes UnauthAttributes
+ * }
+ */
+public class ExtendedCertificateInfo extends Asn1SequenceType {
+    private static final int CMS_VERSION = 0;
+    private static final int CERTIFICATE = 1;
+    private static final int ATTRIBUTES = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(CMS_VERSION, CmsVersion.class),
+            new Asn1FieldInfo(CERTIFICATE, SignatureAlgorithmIdentifier.class),
+            new Asn1FieldInfo(ATTRIBUTES, Signature.class)
+    };
+
+    public ExtendedCertificateInfo() {
+        super(fieldInfos);
+    }
+
+    public CmsVersion getCmsVersion() {
+        return getFieldAs(CMS_VERSION, CmsVersion.class);
+    }
+
+    public void setCmsVersion(CmsVersion version) {
+        setFieldAs(CMS_VERSION, version);
+    }
+
+    public SignatureAlgorithmIdentifier getCertificate() {
+        return getFieldAs(CERTIFICATE, SignatureAlgorithmIdentifier.class);
+    }
+
+    public void setCertificate(SignatureAlgorithmIdentifier signatureAlgorithmIdentifier) {
+        setFieldAs(CERTIFICATE, signatureAlgorithmIdentifier);
+    }
+
+    public Signature getAttributes() {
+        return getFieldAs(ATTRIBUTES, Signature.class);
+    }
+
+    public void setAttributes(Signature signature) {
+        setFieldAs(ATTRIBUTES, signature);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..a9a7135
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/IssuerAndSerialNumber.java
@@ -0,0 +1,66 @@
+/**
+ *  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.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x500.type.Name;
+
+/**
+ * Ref. RFC5652
+ * <pre>
+ * IssuerAndSerialNumber ::= SEQUENCE {
+ *     issuer Name,
+ *     serialNumber CertificateSerialNumber
+ * }
+ *
+ * CertificateSerialNumber ::= INTEGER  -- See RFC 5280
+ * </pre>
+ */
+public class IssuerAndSerialNumber extends Asn1SequenceType {
+    private static final int ISSUER = 0;
+    private static final int SERIAL_NUMBER = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+        new Asn1FieldInfo(ISSUER, Name.class),
+        new Asn1FieldInfo(SERIAL_NUMBER, Asn1Integer.class)
+    };
+
+    public IssuerAndSerialNumber() {
+        super(fieldInfos);
+    }
+
+    public Name getIssuer() {
+        return getFieldAs(ISSUER, Name.class);
+    }
+
+    public void setIssuer(Name name) {
+        setFieldAs(ISSUER, name);
+    }
+
+    public Asn1Integer getSerialNumber() {
+        return getFieldAs(SERIAL_NUMBER, Asn1Integer.class);
+    }
+
+    public void setSerialNumber(int serialNumber) {
+        setFieldAsInt(SERIAL_NUMBER, serialNumber);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..c206197
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherCertificateFormat.java
@@ -0,0 +1,63 @@
+/**
+ *  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.type.Asn1Any;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.Asn1Type;
+
+/**
+ * OtherCertificateFormat ::= SEQUENCE {
+ *   otherCertFormat OBJECT IDENTIFIER,
+ *   otherCert ANY DEFINED BY otherCertFormat
+ * }
+ */
+public class OtherCertificateFormat extends Asn1SequenceType {
+
+    private static final int OTHER_CERT_FORMAT = 0;
+    private static final int OTHER_CERT = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(OTHER_CERT_FORMAT, Asn1ObjectIdentifier.class),
+            new Asn1FieldInfo(OTHER_CERT, Asn1Any.class),
+    };
+
+    public OtherCertificateFormat() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getOtherCertFormat() {
+        return getFieldAs(OTHER_CERT_FORMAT, Asn1ObjectIdentifier.class);
+    }
+
+    public void setOtherCertFormat(Asn1ObjectIdentifier otherCertFormat) {
+        setFieldAs(OTHER_CERT_FORMAT, otherCertFormat);
+    }
+
+    public Asn1Type getOtherCert() {
+        return getFieldAsAny(OTHER_CERT);
+    }
+
+    public void setOtherCert(Asn1Type otherCert) {
+        setFieldAsAny(OTHER_CERT, otherCert);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..5110212
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRevocationInfoFormat.java
@@ -0,0 +1,62 @@
+/**
+ *  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.type.Asn1Any;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.Asn1Type;
+
+/**
+ * OtherRevocationInfoFormat ::= SEQUENCE {
+ *   otherRevInfoFormat OBJECT IDENTIFIER,
+ *   otherRevInfo ANY DEFINED BY otherRevInfoFormat
+ * }
+ */
+public class OtherRevocationInfoFormat extends Asn1SequenceType {
+    private static final int OTHER_REV_INFO_FORMAT = 0;
+    private static final int OTHER_REV_INFO = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(OTHER_REV_INFO_FORMAT, Asn1ObjectIdentifier.class),
+            new Asn1FieldInfo(OTHER_REV_INFO, Asn1Any.class)
+    };
+
+    public OtherRevocationInfoFormat() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getOtherRevInfoFormat() {
+        return getFieldAs(OTHER_REV_INFO_FORMAT, Asn1ObjectIdentifier.class);
+    }
+
+    public void setOtherRevInfoFormat(Asn1ObjectIdentifier otherRevInfoFormat) {
+        setFieldAs(OTHER_REV_INFO_FORMAT, otherRevInfoFormat);
+    }
+
+    public Asn1Type getOtherRevInfo() {
+        return getFieldAsAny(OTHER_REV_INFO);
+    }
+
+    public void setOtherRevInfo(Asn1Type otherRevInfo) {
+        setFieldAsAny(OTHER_REV_INFO, otherRevInfo);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RelativeDistinguishedName.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RelativeDistinguishedName.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RelativeDistinguishedName.java
new file mode 100644
index 0000000..34cee62
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RelativeDistinguishedName.java
@@ -0,0 +1,29 @@
+/**
+ *  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.type.Asn1SetOf;
+import org.apache.kerby.x500.type.AttributeTypeAndValue;
+
+/**
+ * RelativeDistinguishedName ::= SET SIZE (1..MAX) OF AttributeTypeAndValue
+ */
+public class RelativeDistinguishedName extends Asn1SetOf<AttributeTypeAndValue> {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..15e1b3d
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoice.java
@@ -0,0 +1,60 @@
+/**
+ *  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.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ImplicitField;
+
+/**
+ * RevocationInfoChoice ::= CHOICE {
+ *   crl CertificateList,
+ *   other [1] IMPLICIT OtherRevocationInfoFormat
+ * }
+ */
+public class RevocationInfoChoice extends Asn1Choice {
+    private static final int CRL = 0;
+    private static final int OTHER = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(CRL, CertificateList.class),
+            new ImplicitField(OTHER, 1, OtherRevocationInfoFormat.class)
+    };
+
+    public RevocationInfoChoice() {
+        super(fieldInfos);
+    }
+
+    public CertificateList getCRL() {
+        return getFieldAs(CRL, CertificateList.class);
+    }
+
+    public void setCRL(CertificateList crl) {
+        setFieldAs(CRL, crl);
+    }
+
+    public OtherRevocationInfoFormat getOther() {
+        return getFieldAs(OTHER, OtherRevocationInfoFormat.class);
+    }
+
+    public void setOther(OtherRevocationInfoFormat other) {
+        setFieldAs(OTHER, other);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoices.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoices.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoices.java
new file mode 100644
index 0000000..f8d0fd1
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoices.java
@@ -0,0 +1,28 @@
+/**
+ *  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.type.Asn1SetOf;
+
+/**
+ * RevocationInfoChoices ::= SET OF RevocationInfoChoice
+ */
+public class RevocationInfoChoices extends Asn1SetOf<RevocationInfoChoice> {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Signature.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Signature.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Signature.java
new file mode 100644
index 0000000..af5ab42
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Signature.java
@@ -0,0 +1,28 @@
+/**
+ *  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.type.Asn1BitString;
+
+/**
+ * Signature ::= BIT STRING
+ */
+public class Signature extends Asn1BitString {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureAlgorithmIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureAlgorithmIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureAlgorithmIdentifier.java
new file mode 100644
index 0000000..854ccb0
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureAlgorithmIdentifier.java
@@ -0,0 +1,28 @@
+/**
+ *  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.x509.type.AlgorithmIdentifier;
+
+/**
+ * SignatureAlgorithmIdentifier ::= AlgorithmIdentifier
+ */
+public class SignatureAlgorithmIdentifier extends AlgorithmIdentifier {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureValue.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureValue.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureValue.java
new file mode 100644
index 0000000..597ad40
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureValue.java
@@ -0,0 +1,28 @@
+/**
+ *  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.type.Asn1OctetString;
+
+/**
+ * SignatureValue ::= OCTET STRING
+ */
+public class SignatureValue extends Asn1OctetString {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedAttributes.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedAttributes.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedAttributes.java
new file mode 100644
index 0000000..f15c1a1
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedAttributes.java
@@ -0,0 +1,28 @@
+/**
+ *  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.type.Asn1SetOf;
+
+/**
+ * SignedAttributes ::= SET SIZE (1..MAX) OF Attribute
+ */
+public class SignedAttributes extends Asn1SetOf<Attribute> {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..ecf20eb
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedData.java
@@ -0,0 +1,108 @@
+/**
+ *  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.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ImplicitField;
+
+/**
+ * Ref. RFC 5652
+ * <pre>
+ * SignedData ::= SEQUENCE {
+ *     version CMSVersion,
+ *     digestAlgorithms DigestAlgorithmIdentifiers,
+ *     encapContentInfo EncapsulatedContentInfo,
+ *     certificates [0] IMPLICIT CertificateSet OPTIONAL,
+ *     crls [1] IMPLICIT RevocationInfoChoices OPTIONAL,
+ *     signerInfos SignerInfos
+ *   }
+ * </pre>
+ *
+ */
+public class SignedData extends Asn1SequenceType {
+    private static final int CMS_VERSION = 0;
+    private static final int DIGEST_ALGORITHMS = 1;
+    private static final int ENCAP_CONTENT_INFO = 2;
+    private static final int CERTIFICATES = 3;
+    private static final int CRLS = 4;
+    private static final int SIGNER_INFOS = 5;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+        new Asn1FieldInfo(CMS_VERSION, CmsVersion.class),
+        new Asn1FieldInfo(DIGEST_ALGORITHMS, DigestAlgorithmIdentifiers.class),
+        new Asn1FieldInfo(ENCAP_CONTENT_INFO, EncapsulatedContentInfo.class),
+        new ImplicitField(CERTIFICATES, 0, CertificateSet.class),
+        new ImplicitField(CRLS, 1, RevocationInfoChoices.class),
+        new Asn1FieldInfo(SIGNER_INFOS, SignerInfos.class)
+    };
+
+    public SignedData() {
+        super(fieldInfos);
+    }
+
+    public int getVersion() {
+        return getFieldAsInteger(CMS_VERSION);
+    }
+
+    public void setVersion(int version) {
+        setFieldAsInt(CMS_VERSION, version);
+    }
+
+    public DigestAlgorithmIdentifiers getDigestAlgorithms() {
+        return getFieldAs(DIGEST_ALGORITHMS, DigestAlgorithmIdentifiers.class);
+    }
+
+    public void setDigestAlgorithms(DigestAlgorithmIdentifiers digestAlgorithms) {
+        setFieldAs(DIGEST_ALGORITHMS, digestAlgorithms);
+    }
+
+    public EncapsulatedContentInfo getEncapContentInfo() {
+        return getFieldAs(ENCAP_CONTENT_INFO, EncapsulatedContentInfo.class);
+    }
+
+    public void setEncapContentInfo(EncapsulatedContentInfo contentInfo) {
+        setFieldAs(ENCAP_CONTENT_INFO, contentInfo);
+    }
+
+    public CertificateSet getCertificates() {
+        return getFieldAs(CERTIFICATES, CertificateSet.class);
+    }
+
+    public void setCertificates(CertificateSet certificates) {
+        setFieldAs(CERTIFICATES, certificates);
+    }
+
+    public RevocationInfoChoices getCrls() {
+        return getFieldAs(CRLS, RevocationInfoChoices.class);
+    }
+
+    public void setCrls(RevocationInfoChoices crls) {
+        setFieldAs(CRLS, crls);
+    }
+
+    public SignerInfos getSignerInfos() {
+        return getFieldAs(SIGNER_INFOS, SignerInfos.class);
+    }
+
+    public void setSignerInfos(SignerInfos signerInfos) {
+        setFieldAs(SIGNER_INFOS, signerInfos);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..c5668c8
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerIdentifier.java
@@ -0,0 +1,66 @@
+/**
+ *  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.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
+import org.apache.kerby.x509.type.SubjectKeyIdentifier;
+
+/**
+ * Ref. RFC 5652
+ * <pre>
+ * SignerIdentifier ::= CHOICE {
+ *     issuerAndSerialNumber IssuerAndSerialNumber,
+ *     subjectKeyIdentifier [0] SubjectKeyIdentifier 
+ * }
+ *
+ * SubjectKeyIdentifier ::= OCTET STRING
+ * </pre>
+ */
+public class SignerIdentifier extends Asn1Choice {
+    private static final int ISSUER_AND_SERIAL_NUMBER = 0;
+    private static final int SUBJECT_KEY_IDENTIFIER = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+        new Asn1FieldInfo(ISSUER_AND_SERIAL_NUMBER, IssuerAndSerialNumber.class),
+        new ExplicitField(SUBJECT_KEY_IDENTIFIER, 0, SubjectKeyIdentifier.class)
+    };
+
+    public SignerIdentifier() {
+        super(fieldInfos);
+    }
+
+    public IssuerAndSerialNumber getIssuerAndSerialNumber() {
+        return getFieldAs(ISSUER_AND_SERIAL_NUMBER, IssuerAndSerialNumber.class);
+    }
+
+    public void setIssuerAndSerialNumber(IssuerAndSerialNumber issuerAndSerialNumber) {
+        setFieldAs(ISSUER_AND_SERIAL_NUMBER, issuerAndSerialNumber);
+    }
+
+    public SubjectKeyIdentifier getSubjectKeyIdentifier() {
+        return getFieldAs(SUBJECT_KEY_IDENTIFIER, SubjectKeyIdentifier.class);
+    }
+
+    public void setSubjectKeyIdentifier(SubjectKeyIdentifier subjectKeyIdentifier) {
+        setFieldAs(SUBJECT_KEY_IDENTIFIER, subjectKeyIdentifier);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..879d73d
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfo.java
@@ -0,0 +1,119 @@
+/**
+ *  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.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ImplicitField;
+
+/**
+ * Ref. RFC 5652
+ *
+ * SignerInfo ::= SEQUENCE {
+ *     version            CMSVersion,
+ *     sid                SignerIdentifier,
+ *     digestAlgorithm    DigestAlgorithmIdentifier,
+ *     signedAttrs        [0] IMPLICIT SignedAttributes OPTIONAL,
+ *     signatureAlgorithm SignatureAlgorithmIdentifier,
+ *     signature          SignatureValue,
+ *     unsignedAttrs      [1] IMPLICIT UnsignedAttributes OPTIONAL
+ * }
+ *
+ * </pre>
+ */
+public class SignerInfo extends Asn1SequenceType {
+    private static final int CMS_VERSION = 0;
+    private static final int SID = 1;
+    private static final int DIGEST_ALGORITHM = 2;
+    private static final int SIGNED_ATTRS = 3;
+    private static final int SIGNATURE_ALGORITHMS = 4;
+    private static final int SIGNATURE = 5;
+    private static final int UNSIGNED_ATTRS = 6;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+        new Asn1FieldInfo(CMS_VERSION, CmsVersion.class),
+        new Asn1FieldInfo(SID, SignerIdentifier.class),
+        new Asn1FieldInfo(DIGEST_ALGORITHM, DigestAlgorithmIdentifier.class),
+        new ImplicitField(SIGNED_ATTRS, 0, SignedAttributes.class),
+        new Asn1FieldInfo(SIGNATURE_ALGORITHMS, SignatureAlgorithmIdentifier.class),
+        new Asn1FieldInfo(SIGNATURE, SignatureValue.class),
+        new ImplicitField(UNSIGNED_ATTRS, 1, UnsignedAttributes.class)
+    };
+
+    public SignerInfo() {
+        super(fieldInfos);
+    }
+
+    public int getCmsVersion() {
+        return getFieldAsInteger(CMS_VERSION);
+    }
+
+    public void setCmsVersion(int version) {
+        setFieldAsInt(CMS_VERSION, version);
+    }
+
+    public SignerIdentifier getSignerIdentifier() {
+        return getFieldAs(SID, SignerIdentifier.class);
+    }
+
+    public void setSignerIdentifier(SignerIdentifier signerIdentifier) {
+        setFieldAs(SID, signerIdentifier);
+    }
+
+    public DigestAlgorithmIdentifier getDigestAlgorithmIdentifier() {
+        return getFieldAs(DIGEST_ALGORITHM, DigestAlgorithmIdentifier.class);
+    }
+
+    public void setDigestAlgorithmIdentifier(DigestAlgorithmIdentifier digestAlgorithmIdentifier) {
+        setFieldAs(DIGEST_ALGORITHM, digestAlgorithmIdentifier);
+    }
+
+    public SignedAttributes getSignedAttributes() {
+        return getFieldAs(SIGNED_ATTRS, SignedAttributes.class);
+    }
+
+    public void setSignedAttributes(SignedAttributes signedAttributes) {
+        setFieldAs(SIGNED_ATTRS, signedAttributes);
+    }
+
+    public SignatureAlgorithmIdentifier getSignatureAlgorithmIdentifier() {
+        return getFieldAs(SIGNATURE_ALGORITHMS, SignatureAlgorithmIdentifier.class);
+    }
+
+    public void setSignatureAlgorithmIdentifier(SignatureAlgorithmIdentifier signatureAlgorithmIdentifier) {
+        setFieldAs(SIGNATURE_ALGORITHMS, signatureAlgorithmIdentifier);
+    }
+
+    public SignatureValue getSignatureValue() {
+        return getFieldAs(SIGNATURE, SignatureValue.class);
+    }
+
+    public void setSignatureValue(SignatureValue signatureValue) {
+        setFieldAs(SIGNATURE, signatureValue);
+    }
+
+    public UnsignedAttributes getUnsignedAttributes() {
+        return getFieldAs(UNSIGNED_ATTRS, UnsignedAttributes.class);
+    }
+
+    public void setUnsignedAttributes(UnsignedAttributes unsignedAttributes) {
+        setFieldAs(UNSIGNED_ATTRS, unsignedAttributes);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfos.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfos.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfos.java
new file mode 100644
index 0000000..4474e1a
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfos.java
@@ -0,0 +1,28 @@
+/**
+ *  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.type.Asn1SetOf;
+
+/**
+ * SignerInfos ::= SET OF SignerInfo
+ */
+public class SignerInfos extends Asn1SetOf<SignerInfo> {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/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
new file mode 100644
index 0000000..a59690b
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Subject.java
@@ -0,0 +1,65 @@
+/**
+ *  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.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
+import org.apache.kerby.x509.type.GeneralNames;
+import org.apache.kerby.x509.type.IssuerSerial;
+
+/**
+ * subject CHOICE {
+ *   baseCertificateID [0] IssuerSerial,
+ *     -- associated with a Public Key Certificate
+ *   subjectName [1] GeneralNames
+ *     -- associated with a name
+ * },
+ *
+ */
+public class Subject extends Asn1Choice {
+    private static final int BASE_CERTIFICATE_ID = 0;
+    private static final int SUBJECT_NAME = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+            new ExplicitField(BASE_CERTIFICATE_ID, IssuerSerial.class),
+            new ExplicitField(SUBJECT_NAME, GeneralNames.class)
+    };
+
+    public Subject() {
+        super(fieldInfos);
+    }
+
+    public IssuerSerial getBaseCertificateID() {
+        return getFieldAs(BASE_CERTIFICATE_ID, IssuerSerial.class);
+    }
+
+    public void setBaseCertificateID(IssuerSerial baseCertificateID) {
+        setFieldAs(BASE_CERTIFICATE_ID, baseCertificateID);
+    }
+
+    public GeneralNames getSubjectName() {
+        return getFieldAs(SUBJECT_NAME, GeneralNames.class);
+    }
+
+    public void setSubjectName(GeneralNames subjectName) {
+        setFieldAs(SUBJECT_NAME, subjectName);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/UnsignedAttributes.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/UnsignedAttributes.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/UnsignedAttributes.java
new file mode 100644
index 0000000..4eecd35
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/UnsignedAttributes.java
@@ -0,0 +1,28 @@
+/**
+ *  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.type.Asn1SetOf;
+
+/**
+ * UnsignedAttributes ::= SET SIZE (1..MAX) OF Attribute
+ */
+public class UnsignedAttributes extends Asn1SetOf<Attribute> {
+}


[09/17] directory-kerby git commit: Added some javadoc

Posted by pl...@apache.org.
Added some javadoc


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/4d4be896
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/4d4be896
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/4d4be896

Branch: refs/heads/pkinit-support
Commit: 4d4be896d4e08cee1af88218210056ed32dde65d
Parents: a8a0769
Author: Kai Zheng <ka...@intel.com>
Authored: Fri Nov 27 13:33:26 2015 +0800
Committer: Kai Zheng <ka...@intel.com>
Committed: Fri Nov 27 13:33:26 2015 +0800

----------------------------------------------------------------------
 .../apache/kerby/asn1/type/Asn1FieldInfo.java   | 29 +++++++++++++++++++-
 .../apache/kerby/asn1/type/ExplicitField.java   | 13 +++++++++
 .../apache/kerby/asn1/type/ImplicitField.java   | 13 +++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/4d4be896/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1FieldInfo.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1FieldInfo.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1FieldInfo.java
index 3c844e1..fb3c885 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1FieldInfo.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1FieldInfo.java
@@ -21,17 +21,33 @@ package org.apache.kerby.asn1.type;
 
 import org.apache.kerby.asn1.TaggingOption;
 
+/**
+ * Representing a field in a ASN1 collection or choice.
+ */
 public class Asn1FieldInfo {
     private int index;
-    private int tagNo;
+    private int tagNo = -1; // Indicate a non-tagged field
     private boolean isImplicit;
     private Class<? extends Asn1Type> type;
 
+    /**
+     * Constructor for a tagged field, the tagNo being the same of index.
+     * @param index
+     * @param type
+     * @param isImplicit
+     */
     public Asn1FieldInfo(int index, Class<? extends Asn1Type> type,
                          boolean isImplicit) {
         this(index, index, type, isImplicit);
     }
 
+    /**
+     * Constructor for a tagged field.
+     * @param index
+     * @param tagNo
+     * @param type
+     * @param isImplicit
+     */
     public Asn1FieldInfo(int index, int tagNo, Class<? extends Asn1Type> type,
                          boolean isImplicit) {
         this.index = index;
@@ -40,6 +56,17 @@ public class Asn1FieldInfo {
         this.isImplicit = isImplicit;
     }
 
+    /**
+     * Constructor for a non-tagged field.
+     * @param index
+     * @param type
+     */
+    public Asn1FieldInfo(int index, Class<? extends Asn1Type> type) {
+        this.index = index;
+        this.type = type;
+        this.tagNo = -1; // Indicate a non-tagged field
+    }
+
     public boolean isTagged() {
         return tagNo != -1;
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/4d4be896/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ExplicitField.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ExplicitField.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ExplicitField.java
index 7628fdc..abb42ce 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ExplicitField.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ExplicitField.java
@@ -19,12 +19,25 @@
  */
 package org.apache.kerby.asn1.type;
 
+/**
+ * Representing an explicitly tagged field in a ASN1 collection or choice.
+ */
 public class ExplicitField extends Asn1FieldInfo {
 
+    /**
+     * Constructor for an explicitly tagged field.
+     * @param index
+     * @param type
+     */
     public ExplicitField(int index, int tagNo, Class<? extends Asn1Type> type) {
         super(index, tagNo, type, false);
     }
 
+    /**
+     * Constructor for an explicitly tagged field, the tagNo being the same of index.
+     * @param index
+     * @param type
+     */
     public ExplicitField(int index, Class<? extends Asn1Type> type) {
         super(index, index, type, false);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/4d4be896/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ImplicitField.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ImplicitField.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ImplicitField.java
index 128df68..b64bc4f 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ImplicitField.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ImplicitField.java
@@ -19,12 +19,25 @@
  */
 package org.apache.kerby.asn1.type;
 
+/**
+ * Representing an implicitly tagged field in a ASN1 collection or choice.
+ */
 public class ImplicitField extends Asn1FieldInfo {
 
+    /**
+     * Constructor for an implicitly tagged field.
+     * @param index
+     * @param type
+     */
     public ImplicitField(int index, int tagNo, Class<? extends Asn1Type> type) {
         super(index, tagNo, type, true);
     }
 
+    /**
+     * Constructor for an implicitly tagged field, the tagNo being the same of index.
+     * @param index
+     * @param type
+     */
     public ImplicitField(int index, Class<? extends Asn1Type> type) {
         super(index, index, type, true);
     }


[07/17] directory-kerby git commit: DIRKRB-476 Allow to define explicit and implicit fields more easily for collection types

Posted by pl...@apache.org.
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/ReplyKeyPack.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/ReplyKeyPack.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/ReplyKeyPack.java
index 77f133b..406a4df 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/ReplyKeyPack.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/ReplyKeyPack.java
@@ -20,6 +20,7 @@
 package org.apache.kerby.kerberos.kerb.spec.pa.pkinit;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 import org.apache.kerby.kerberos.kerb.spec.base.CheckSum;
 import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
@@ -35,8 +36,8 @@ public class ReplyKeyPack extends KrbSequenceType {
     private static final int AS_CHECKSUM = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(REPLY_KEY, EncryptionKey.class),
-            new Asn1FieldInfo(AS_CHECKSUM, CheckSum.class)
+            new ExplicitField(REPLY_KEY, EncryptionKey.class),
+            new ExplicitField(AS_CHECKSUM, CheckSum.class)
     };
 
     public ReplyKeyPack() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/PaTokenChallenge.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/PaTokenChallenge.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/PaTokenChallenge.java
index 77810bc..5f70174 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/PaTokenChallenge.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/PaTokenChallenge.java
@@ -20,6 +20,7 @@
 package org.apache.kerby.kerberos.kerb.spec.pa.token;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 /**
@@ -31,7 +32,7 @@ public class PaTokenChallenge extends KrbSequenceType {
     private static final int TOKENINFOS = 0;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(TOKENINFOS, TokenInfos.class)
+            new ExplicitField(TOKENINFOS, TokenInfos.class)
     };
 
     public PaTokenChallenge() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/PaTokenRequest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/PaTokenRequest.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/PaTokenRequest.java
index 969f4db..8add888 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/PaTokenRequest.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/PaTokenRequest.java
@@ -20,6 +20,7 @@
 package org.apache.kerby.kerberos.kerb.spec.pa.token;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 import org.apache.kerby.kerberos.kerb.spec.base.KrbToken;
 
@@ -34,8 +35,8 @@ public class PaTokenRequest extends KrbSequenceType {
     private static final int TOKEN = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(TOKEN_INFO, TokenInfo.class),
-            new Asn1FieldInfo(TOKEN, KrbToken.class)
+            new ExplicitField(TOKEN_INFO, TokenInfo.class),
+            new ExplicitField(TOKEN, KrbToken.class)
     };
 
     public PaTokenRequest() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenInfo.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenInfo.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenInfo.java
index 12abfef..ff56f13 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenInfo.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenInfo.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.pa.token;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1OctetString;
 import org.apache.kerby.asn1.type.Asn1Utf8String;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 /**
@@ -35,8 +36,8 @@ public class TokenInfo extends KrbSequenceType {
     private static final int TOKEN_VENDOR = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(FLAGS, Asn1OctetString.class, true),
-            new Asn1FieldInfo(TOKEN_VENDOR, Asn1Utf8String.class),
+            new ExplicitField(FLAGS, Asn1OctetString.class),
+            new ExplicitField(TOKEN_VENDOR, Asn1Utf8String.class),
     };
 
     public TokenInfo() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/EncTicketPart.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/EncTicketPart.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/EncTicketPart.java
index df19da1..0fe3bcb 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/EncTicketPart.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/EncTicketPart.java
@@ -20,6 +20,7 @@
 package org.apache.kerby.kerberos.kerb.spec.ticket;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosString;
 import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
 import org.apache.kerby.kerberos.kerb.spec.KrbAppSequenceType;
@@ -61,17 +62,17 @@ public class EncTicketPart extends KrbAppSequenceType {
     private static final int AUTHORIZATION_DATA = 10;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(FLAGS, 0, TicketFlags.class),
-            new Asn1FieldInfo(KEY, 1, EncryptionKey.class),
-            new Asn1FieldInfo(CREALM, 2, KerberosString.class),
-            new Asn1FieldInfo(CNAME, 3, PrincipalName.class),
-            new Asn1FieldInfo(TRANSITED, 4, TransitedEncoding.class),
-            new Asn1FieldInfo(AUTHTIME, 5, KerberosTime.class),
-            new Asn1FieldInfo(STARTTIME, 6, KerberosTime.class),
-            new Asn1FieldInfo(ENDTIME, 7, KerberosTime.class),
-            new Asn1FieldInfo(ENDTIME, 8, KerberosTime.class),
-            new Asn1FieldInfo(CADDR, 9, HostAddresses.class),
-            new Asn1FieldInfo(AUTHORIZATION_DATA, 10, AuthorizationData.class)
+            new ExplicitField(FLAGS, 0, TicketFlags.class),
+            new ExplicitField(KEY, 1, EncryptionKey.class),
+            new ExplicitField(CREALM, 2, KerberosString.class),
+            new ExplicitField(CNAME, 3, PrincipalName.class),
+            new ExplicitField(TRANSITED, 4, TransitedEncoding.class),
+            new ExplicitField(AUTHTIME, 5, KerberosTime.class),
+            new ExplicitField(STARTTIME, 6, KerberosTime.class),
+            new ExplicitField(ENDTIME, 7, KerberosTime.class),
+            new ExplicitField(ENDTIME, 8, KerberosTime.class),
+            new ExplicitField(CADDR, 9, HostAddresses.class),
+            new ExplicitField(AUTHORIZATION_DATA, 10, AuthorizationData.class)
     };
 
     public EncTicketPart() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/Ticket.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/Ticket.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/Ticket.java
index 75213f1..a660210 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/Ticket.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/Ticket.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.ticket;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.KrbConstant;
 import org.apache.kerby.kerberos.kerb.spec.KerberosString;
 import org.apache.kerby.kerberos.kerb.spec.KrbAppSequenceType;
@@ -45,10 +46,10 @@ public class Ticket extends KrbAppSequenceType {
     private static final int ENC_PART = 3;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(TKT_VNO, 0, Asn1Integer.class),
-            new Asn1FieldInfo(REALM, 1, KerberosString.class),
-            new Asn1FieldInfo(SNAME, 2, PrincipalName.class),
-            new Asn1FieldInfo(ENC_PART, 3, EncryptedData.class)
+            new ExplicitField(TKT_VNO, 0, Asn1Integer.class),
+            new ExplicitField(REALM, 1, KerberosString.class),
+            new ExplicitField(SNAME, 2, PrincipalName.class),
+            new ExplicitField(ENC_PART, 3, EncryptedData.class)
     };
 
     public Ticket() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/AlgorithmIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/AlgorithmIdentifier.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/AlgorithmIdentifier.java
index 7ee86c6..6731a29 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/AlgorithmIdentifier.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/AlgorithmIdentifier.java
@@ -25,6 +25,7 @@ import org.apache.kerby.asn1.type.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.type.ExplicitField;
 
 /**
  AlgorithmIdentifier  ::=  SEQUENCE  {
@@ -37,8 +38,8 @@ public class AlgorithmIdentifier extends Asn1SequenceType {
     private static final int PARAMETERS = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(ALGORITHM, -1, Asn1ObjectIdentifier.class),
-            new Asn1FieldInfo(PARAMETERS, -1, Asn1Any.class)
+            new ExplicitField(ALGORITHM, -1, Asn1ObjectIdentifier.class),
+            new ExplicitField(PARAMETERS, -1, Asn1Any.class)
     };
 
     public AlgorithmIdentifier() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/SubjectPublicKeyInfo.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/SubjectPublicKeyInfo.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/SubjectPublicKeyInfo.java
index 499104e..28db296 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/SubjectPublicKeyInfo.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/x509/SubjectPublicKeyInfo.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.x509;
 import org.apache.kerby.asn1.type.Asn1BitString;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
 
 /**
  SubjectPublicKeyInfo  ::=  SEQUENCE  {
@@ -34,8 +35,8 @@ public class SubjectPublicKeyInfo extends Asn1SequenceType {
     private static final int SUBJECT_PUBLIC_KEY = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(ALGORITHM, -1, AlgorithmIdentifier.class),
-            new Asn1FieldInfo(SUBJECT_PUBLIC_KEY, -1, Asn1BitString.class)
+            new ExplicitField(ALGORITHM, -1, AlgorithmIdentifier.class),
+            new ExplicitField(SUBJECT_PUBLIC_KEY, -1, Asn1BitString.class)
     };
 
     public SubjectPublicKeyInfo() {


[15/17] directory-kerby git commit: Fixed some checking styles

Posted by pl...@apache.org.
Fixed some checking styles


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/e00fa4ec
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/e00fa4ec
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/e00fa4ec

Branch: refs/heads/pkinit-support
Commit: e00fa4ec1430a1cda37d554a13405f8f47ed9760
Parents: ac93a20
Author: Kai Zheng <ka...@intel.com>
Authored: Fri Nov 27 15:18:46 2015 +0800
Committer: Kai Zheng <ka...@intel.com>
Committed: Fri Nov 27 15:18:46 2015 +0800

----------------------------------------------------------------------
 .../org/apache/kerby/x500/type/RDNSequence.java | 21 +++++++++++++++++++-
 .../x500/type/RelativeDistinguishedName.java    |  1 -
 .../kerby/x509/type/AccessDescription.java      |  3 ---
 .../kerby/x509/type/AlgorithmIdentifier.java    |  7 +++++--
 .../apache/kerby/x509/type/AttCertIssuer.java   |  4 +++-
 .../apache/kerby/x509/type/DirectoryString.java |  2 +-
 .../org/apache/kerby/x509/type/GeneralName.java |  2 +-
 .../apache/kerby/x509/type/GeneralSubtrees.java |  2 +-
 .../kerby/x509/type/PolicyQualifierId.java      | 13 +-----------
 .../org/apache/kerby/x509/type/TargetCert.java  |  2 +-
 10 files changed, 33 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e00fa4ec/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RDNSequence.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RDNSequence.java b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RDNSequence.java
index f61e56b..6172725 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RDNSequence.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RDNSequence.java
@@ -1,3 +1,22 @@
+/**
+ *  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.x500.type;
 
 import org.apache.kerby.asn1.type.Asn1SequenceOf;
@@ -5,5 +24,5 @@ import org.apache.kerby.asn1.type.Asn1SequenceOf;
 /**
  * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
  */
-public class RDNSequence extends Asn1SequenceOf<RelativeDistinguishedName>{
+public class RDNSequence extends Asn1SequenceOf<RelativeDistinguishedName> {
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e00fa4ec/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RelativeDistinguishedName.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RelativeDistinguishedName.java b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RelativeDistinguishedName.java
index 7b2dceb..e18b022 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RelativeDistinguishedName.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RelativeDistinguishedName.java
@@ -20,7 +20,6 @@
 package org.apache.kerby.x500.type;
 
 import org.apache.kerby.asn1.type.Asn1SetOf;
-import org.apache.kerby.x500.type.AttributeTypeAndValue;
 
 /**
  * RelativeDistinguishedName ::= SET SIZE (1..MAX) OF AttributeTypeAndValue

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e00fa4ec/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 1ef91fd..5c40b48 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
@@ -33,9 +33,6 @@ import org.apache.kerby.asn1.type.Asn1SequenceType;
  * </pre>
  */
 public class AccessDescription extends Asn1SequenceType {
-    public final static String id_ad_caIssuers = "1.3.6.1.5.5.7.48.2";
-    public final static String id_ad_ocsp = "1.3.6.1.5.5.7.48.1";
-
     private static final int ACCESS_METHOD = 0;
     private static final int ACCESS_LOCATION = 1;
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e00fa4ec/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AlgorithmIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AlgorithmIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AlgorithmIdentifier.java
index 3ce7736..c5c1329 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AlgorithmIdentifier.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AlgorithmIdentifier.java
@@ -19,8 +19,11 @@
  */
 package org.apache.kerby.x509.type;
 
-
-import org.apache.kerby.asn1.type.*;
+import org.apache.kerby.asn1.type.Asn1Any;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.Asn1Type;
 
 /**
  * AlgorithmIdentifier  ::=  SEQUENCE  {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e00fa4ec/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertIssuer.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertIssuer.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertIssuer.java
index 0fbef5c..1120b39 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertIssuer.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertIssuer.java
@@ -19,7 +19,9 @@
  */
 package org.apache.kerby.x509.type;
 
-import org.apache.kerby.asn1.type.*;
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e00fa4ec/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 7a623ff..dfc6fd8 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
@@ -38,7 +38,7 @@ import org.apache.kerby.asn1.type.Asn1Utf8String;
  * }
  * </pre>
  */
-public class DirectoryString extends Asn1Choice{
+public class DirectoryString extends Asn1Choice {
 
     private static final int TELETEX_STRING = 0;
     private static final int PRINTABLE_STRING = 1;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e00fa4ec/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 4d93d9b..17581af 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
@@ -106,7 +106,7 @@ public class GeneralName extends Asn1Choice {
     }
 
     public Name getDirectoryName() {
-        return getFieldAs(DIRECTORY_NAME,Name.class);
+        return getFieldAs(DIRECTORY_NAME, Name.class);
     }
 
     public void setDirectoryName(Name directoryName) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e00fa4ec/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtrees.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtrees.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtrees.java
index 267d22d..89520a5 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtrees.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtrees.java
@@ -21,5 +21,5 @@ package org.apache.kerby.x509.type;
 
 import org.apache.kerby.asn1.type.Asn1SequenceOf;
 
-public class GeneralSubtrees extends Asn1SequenceOf<GeneralSubtree>{
+public class GeneralSubtrees extends Asn1SequenceOf<GeneralSubtree> {
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e00fa4ec/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierId.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierId.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierId.java
index b8895ef..b2d30e1 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierId.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierId.java
@@ -30,17 +30,6 @@ import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
  *       OBJECT IDENTIFIER (id-qt-cps | id-qt-unotice)
  * </pre>
  */
-public class PolicyQualifierId extends Asn1ObjectIdentifier
-{
-   private static final String id_qt = "1.3.6.1.5.5.7.2";
+public class PolicyQualifierId extends Asn1ObjectIdentifier {
 
-   private PolicyQualifierId(String id) 
-      {
-         super(id);
-      }
-   
-   public static final PolicyQualifierId id_qt_cps =
-       new PolicyQualifierId(id_qt + ".1");
-   public static final PolicyQualifierId id_qt_unotice =
-       new PolicyQualifierId(id_qt + ".2");
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e00fa4ec/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TargetCert.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TargetCert.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TargetCert.java
index b79fe3f..e630e08 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TargetCert.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TargetCert.java
@@ -29,7 +29,7 @@ import org.apache.kerby.asn1.type.Asn1SequenceType;
  *   certDigestInfo       ObjectDigestInfo OPTIONAL
  * }
  */
-public class TargetCert extends Asn1SequenceType{
+public class TargetCert extends Asn1SequenceType {
     private static final int TARGET_CERTIFICATE = 0;
     private static final int TARGET_NAME = 1;
     private static final int CERT_DIGEST_INFO = 2;


[13/17] directory-kerby git commit: DIRKRB-473. Initially added X509 ASN1 types

Posted by pl...@apache.org.
DIRKRB-473. Initially added X509 ASN1 types


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/93bcd6fe
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/93bcd6fe
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/93bcd6fe

Branch: refs/heads/pkinit-support
Commit: 93bcd6fe561fe1a246a97cb00e9257282e02b098
Parents: 0cac182
Author: Kai Zheng <ka...@intel.com>
Authored: Fri Nov 27 14:49:52 2015 +0800
Committer: Kai Zheng <ka...@intel.com>
Committed: Fri Nov 27 14:49:52 2015 +0800

----------------------------------------------------------------------
 kerby-pkix/pom.xml                              |  36 +++++
 .../kerby/x500/type/AttributeTypeAndValue.java  |  63 ++++++++
 .../java/org/apache/kerby/x500/type/Name.java   |  49 ++++++
 .../org/apache/kerby/x500/type/RDNSequence.java |   9 ++
 .../x500/type/RelativeDistinguishedName.java    |  29 ++++
 .../kerby/x509/type/AccessDescription.java      |  66 ++++++++
 .../kerby/x509/type/AlgorithmIdentifier.java    |  59 +++++++
 .../apache/kerby/x509/type/AttCertIssuer.java   |  61 ++++++++
 .../kerby/x509/type/AttCertValidityPeriod.java  |  62 ++++++++
 .../org/apache/kerby/x509/type/Attribute.java   |  62 ++++++++
 .../kerby/x509/type/AttributeCertificate.java   |  73 +++++++++
 .../x509/type/AttributeCertificateInfo.java     | 145 +++++++++++++++++
 .../apache/kerby/x509/type/AttributeValues.java |  27 ++++
 .../org/apache/kerby/x509/type/Attributes.java  |  43 +++++
 .../x509/type/AuthorityInformationAccess.java   |  41 +++++
 .../kerby/x509/type/AuthorityKeyIdentifier.java |  80 ++++++++++
 .../kerby/x509/type/BasicConstraints.java       |  69 +++++++++
 .../apache/kerby/x509/type/CRLDistPoint.java    |  31 ++++
 .../org/apache/kerby/x509/type/CRLNumber.java   |  31 ++++
 .../org/apache/kerby/x509/type/CRLReason.java   |  66 ++++++++
 .../apache/kerby/x509/type/CertPolicyId.java    |  31 ++++
 .../org/apache/kerby/x509/type/Certificate.java |  73 +++++++++
 .../apache/kerby/x509/type/CertificateList.java |  75 +++++++++
 .../apache/kerby/x509/type/CertificatePair.java |  64 ++++++++
 .../kerby/x509/type/CertificatePolicies.java    |  32 ++++
 .../x509/type/CertificateSerialNumber.java      |  26 ++++
 .../apache/kerby/x509/type/DSAParameter.java    |  66 ++++++++
 .../org/apache/kerby/x509/type/DigestInfo.java  |  62 ++++++++
 .../kerby/x509/type/DigestedObjectType.java     |  53 +++++++
 .../apache/kerby/x509/type/DirectoryString.java | 100 ++++++++++++
 .../org/apache/kerby/x509/type/DisplayText.java |  87 +++++++++++
 .../kerby/x509/type/DistributionPoint.java      |  74 +++++++++
 .../kerby/x509/type/DistributionPointName.java  |  64 ++++++++
 .../apache/kerby/x509/type/EDIPartyName.java    |  62 ++++++++
 .../kerby/x509/type/ExtendedKeyUsage.java       |  31 ++++
 .../org/apache/kerby/x509/type/Extension.java   |  77 +++++++++
 .../org/apache/kerby/x509/type/Extensions.java  |  37 +++++
 .../org/apache/kerby/x509/type/GeneralName.java | 147 ++++++++++++++++++
 .../apache/kerby/x509/type/GeneralNames.java    |  26 ++++
 .../apache/kerby/x509/type/GeneralSubtree.java  |  77 +++++++++
 .../apache/kerby/x509/type/GeneralSubtrees.java |  25 +++
 .../java/org/apache/kerby/x509/type/Holder.java |  78 ++++++++++
 .../apache/kerby/x509/type/IetfAttrSyntax.java  |  69 +++++++++
 .../kerby/x509/type/IetfAttrSyntaxChoice.java   |  78 ++++++++++
 .../kerby/x509/type/IetfAttrSyntaxChoices.java  |  26 ++++
 .../apache/kerby/x509/type/IssuerSerial.java    |  73 +++++++++
 .../x509/type/IssuingDistributionPoint.java     | 107 +++++++++++++
 .../apache/kerby/x509/type/KeyIdentifier.java   |  32 ++++
 .../apache/kerby/x509/type/KeyPurposeId.java    |  36 +++++
 .../org/apache/kerby/x509/type/KeyUsage.java    |  62 ++++++++
 .../apache/kerby/x509/type/NameConstraints.java |  60 +++++++
 .../apache/kerby/x509/type/NoticeNumbers.java   |  31 ++++
 .../apache/kerby/x509/type/NoticeReference.java |  63 ++++++++
 .../kerby/x509/type/ObjectDigestInfo.java       |  93 +++++++++++
 .../org/apache/kerby/x509/type/OtherName.java   |  66 ++++++++
 .../kerby/x509/type/PolicyConstraints.java      |  67 ++++++++
 .../kerby/x509/type/PolicyInformation.java      |  61 ++++++++
 .../apache/kerby/x509/type/PolicyMapping.java   |  62 ++++++++
 .../apache/kerby/x509/type/PolicyMappings.java  |  34 ++++
 .../kerby/x509/type/PolicyQualifierId.java      |  46 ++++++
 .../kerby/x509/type/PolicyQualifierInfo.java    |  66 ++++++++
 .../kerby/x509/type/PolicyQualifierInfos.java   |  31 ++++
 .../kerby/x509/type/PrivateKeyUsagePeriod.java  |  63 ++++++++
 .../org/apache/kerby/x509/type/ReasonFlags.java |  61 ++++++++
 .../kerby/x509/type/RevokedCertificate.java     |  75 +++++++++
 .../kerby/x509/type/RevokedCertificates.java    |  38 +++++
 .../org/apache/kerby/x509/type/RoleSyntax.java  |  63 ++++++++
 .../x509/type/SubjectDirectoryAttributes.java   |  39 +++++
 .../kerby/x509/type/SubjectKeyIdentifier.java   |  32 ++++
 .../kerby/x509/type/SubjectPublicKeyInfo.java   |  60 +++++++
 .../org/apache/kerby/x509/type/TBSCertList.java | 128 +++++++++++++++
 .../apache/kerby/x509/type/TBSCertificate.java  | 155 +++++++++++++++++++
 .../java/org/apache/kerby/x509/type/Target.java |  74 +++++++++
 .../org/apache/kerby/x509/type/TargetCert.java  |  70 +++++++++
 .../kerby/x509/type/TargetInformation.java      |  34 ++++
 .../org/apache/kerby/x509/type/Targets.java     |  45 ++++++
 .../java/org/apache/kerby/x509/type/Time.java   |  66 ++++++++
 .../org/apache/kerby/x509/type/UserNotice.java  |  63 ++++++++
 .../java/org/apache/kerby/x509/type/V2Form.java |  77 +++++++++
 pom.xml                                         |   1 +
 80 files changed, 4776 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-pkix/pom.xml b/kerby-pkix/pom.xml
new file mode 100644
index 0000000..77abf62
--- /dev/null
+++ b/kerby-pkix/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed 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. See accompanying LICENSE file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <parent>
+    <groupId>org.apache.kerby</groupId>
+    <artifactId>kerby-all</artifactId>
+    <version>1.0.0-RC2-SNAPSHOT</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>kerby-pkix</artifactId>
+  <name>Kerby PKIX Project</name>
+  <description>Kerby PKIX Project</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.kerby</groupId>
+      <artifactId>kerby-asn1</artifactId>
+    </dependency>
+  </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..21e314b
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/AttributeTypeAndValue.java
@@ -0,0 +1,63 @@
+/**
+ *  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.x500.type;
+
+import org.apache.kerby.asn1.type.Asn1Any;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.Asn1Type;
+
+/**
+ * AttributeTypeAndValue ::= SEQUENCE {
+ *     type  OBJECT IDENTIFIER,
+ *     value ANY
+ * }
+ */
+public class AttributeTypeAndValue extends Asn1SequenceType {
+
+    private static final int TYPE = 0;
+    private static final int VALUE = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+            new Asn1FieldInfo(TYPE, Asn1ObjectIdentifier.class, true),
+            new Asn1FieldInfo(VALUE, Asn1Any.class, true)
+    };
+
+    public AttributeTypeAndValue() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getType() {
+        return getFieldAs(TYPE, Asn1ObjectIdentifier.class);
+    }
+
+    public void setType(Asn1ObjectIdentifier type) {
+        setFieldAs(TYPE, type);
+    }
+
+    public Asn1Type getAttributeValue() {
+        return getFieldAsAny(VALUE);
+    }
+
+    public void setAttributeValue(Asn1Type value) {
+        setFieldAsAny(VALUE, value);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..280082d
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/Name.java
@@ -0,0 +1,49 @@
+/**
+ *  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.x500.type;
+
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+
+/**
+ *
+ * <pre>
+ *     Name ::= CHOICE { RDNSequence }
+ * </pre>
+ */
+public class Name extends Asn1Choice {
+    private static final int RDN_SEQUENCE = 0;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+        new Asn1FieldInfo(RDN_SEQUENCE, RDNSequence.class),
+    };
+
+    public Name() {
+        super(fieldInfos);
+    }
+
+    public RDNSequence getName() {
+        return getFieldAs(RDN_SEQUENCE, RDNSequence.class);
+    }
+
+    public void setName(RDNSequence name) {
+        setFieldAs(RDN_SEQUENCE, name);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RDNSequence.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RDNSequence.java b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RDNSequence.java
new file mode 100644
index 0000000..f61e56b
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RDNSequence.java
@@ -0,0 +1,9 @@
+package org.apache.kerby.x500.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+/**
+ * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
+ */
+public class RDNSequence extends Asn1SequenceOf<RelativeDistinguishedName>{
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RelativeDistinguishedName.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RelativeDistinguishedName.java b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RelativeDistinguishedName.java
new file mode 100644
index 0000000..7b2dceb
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x500/type/RelativeDistinguishedName.java
@@ -0,0 +1,29 @@
+/**
+ *  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.x500.type;
+
+import org.apache.kerby.asn1.type.Asn1SetOf;
+import org.apache.kerby.x500.type.AttributeTypeAndValue;
+
+/**
+ * RelativeDistinguishedName ::= SET SIZE (1..MAX) OF AttributeTypeAndValue
+ */
+public class RelativeDistinguishedName extends Asn1SetOf<AttributeTypeAndValue> {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..1ef91fd
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AccessDescription.java
@@ -0,0 +1,66 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ *
+ * <pre>
+ * AccessDescription  ::=  SEQUENCE {
+ *       accessMethod          OBJECT IDENTIFIER,
+ *       accessLocation        GeneralName
+ *  }
+ * </pre>
+ */
+public class AccessDescription extends Asn1SequenceType {
+    public final static String id_ad_caIssuers = "1.3.6.1.5.5.7.48.2";
+    public final static String id_ad_ocsp = "1.3.6.1.5.5.7.48.1";
+
+    private static final int ACCESS_METHOD = 0;
+    private static final int ACCESS_LOCATION = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(ACCESS_METHOD, Asn1ObjectIdentifier.class),
+        new Asn1FieldInfo(ACCESS_LOCATION, GeneralName.class)
+    };
+
+    public AccessDescription() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getAccessMethod() {
+        return getFieldAs(ACCESS_METHOD, Asn1ObjectIdentifier.class);
+    }
+
+    public void setAccessMethod(Asn1ObjectIdentifier accessMethod) {
+        setFieldAs(ACCESS_METHOD, accessMethod);
+    }
+
+    public GeneralName getAccessLocation() {
+        return getFieldAs(ACCESS_LOCATION, GeneralName.class);
+    }
+
+    public void setAccessLocation(GeneralName accessLocation) {
+        setFieldAs(ACCESS_LOCATION, accessLocation);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AlgorithmIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AlgorithmIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AlgorithmIdentifier.java
new file mode 100644
index 0000000..3ce7736
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AlgorithmIdentifier.java
@@ -0,0 +1,59 @@
+/**
+ *  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.x509.type;
+
+
+import org.apache.kerby.asn1.type.*;
+
+/**
+ * AlgorithmIdentifier  ::=  SEQUENCE  {
+ *    algorithm               OBJECT IDENTIFIER,
+ *    parameters              ANY DEFINED BY algorithm OPTIONAL
+ * }
+ */
+public class AlgorithmIdentifier extends Asn1SequenceType {
+    private static final int ALGORITHM = 0;
+    private static final int PARAMETERS = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(ALGORITHM, Asn1ObjectIdentifier.class),
+            new Asn1FieldInfo(PARAMETERS, Asn1Any.class)
+    };
+
+    public AlgorithmIdentifier() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getAlgorithm() {
+        return getFieldAs(ALGORITHM, Asn1ObjectIdentifier.class);
+    }
+
+    public void setAlgorithm(Asn1ObjectIdentifier algorithm) {
+        setFieldAs(ALGORITHM, algorithm);
+    }
+
+    public Asn1Type getParameters() {
+        return getFieldAsAny(PARAMETERS);
+    }
+
+    public void setParameters(Asn1Type parameters) {
+        setFieldAsAny(PARAMETERS, parameters);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertIssuer.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertIssuer.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertIssuer.java
new file mode 100644
index 0000000..0fbef5c
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertIssuer.java
@@ -0,0 +1,61 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.*;
+
+/**
+ *
+ * <pre>
+ *  AttCertIssuer ::= CHOICE {
+ *       v1Form   GeneralNames,  -- MUST NOT be used in this profile
+ *       v2Form   [0] V2Form     -- v2 only
+ *  }
+ * </pre>
+ */
+public class AttCertIssuer extends Asn1Choice {
+    private static final int V1_FORM = 0;
+    private static final int V2_FORM = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(V1_FORM, GeneralNames.class),
+        new ExplicitField(V2_FORM, 0, V2Form.class)
+    };
+
+    public AttCertIssuer() {
+        super(fieldInfos);
+    }
+
+    public GeneralNames getV1Form() {
+        return getFieldAs(V1_FORM, GeneralNames.class);
+    }
+
+    public void setV1Form(GeneralNames v1Form) {
+        setFieldAs(V1_FORM, v1Form);
+    }
+
+    public V2Form getV2Form() {
+        return getFieldAs(V2_FORM, V2Form.class);
+    }
+
+    public void setV2Form(V2Form v2Form) {
+        setFieldAs(V2_FORM, v2Form);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..20b2b9e
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttCertValidityPeriod.java
@@ -0,0 +1,62 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1GeneralizedTime;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * <pre>
+ *  AttCertValidityPeriod  ::= SEQUENCE {
+ *       notBeforeTime  GeneralizedTime,
+ *       notAfterTime   GeneralizedTime
+ *  }
+ * </pre>
+ */
+public class AttCertValidityPeriod extends Asn1SequenceType {
+    private static final int NOT_BEFORE = 0;
+    private static final int NOT_AFTER = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(NOT_BEFORE, Asn1GeneralizedTime.class),
+        new Asn1FieldInfo(NOT_AFTER, Asn1GeneralizedTime.class)
+    };
+
+    public AttCertValidityPeriod() {
+        super(fieldInfos);
+    }
+
+    public Asn1GeneralizedTime getNotBeforeTime() {
+        return getFieldAs(NOT_BEFORE, Asn1GeneralizedTime.class);
+    }
+
+    public void setNotBeforeTime(Asn1GeneralizedTime notBeforeTime) {
+        setFieldAs(NOT_BEFORE, notBeforeTime);
+    }
+
+    public Asn1GeneralizedTime getNotAfterTime() {
+        return getFieldAs(NOT_AFTER, Asn1GeneralizedTime.class);
+    }
+
+    public void setNotAfterTime(Asn1GeneralizedTime notAfterTime) {
+        setFieldAs(NOT_AFTER, notAfterTime);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..36fb541
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Attribute.java
@@ -0,0 +1,62 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * <pre>
+ * Attribute ::= SEQUENCE {
+ *     attrType OBJECT IDENTIFIER,
+ *     attrValues SET OF AttributeValue
+ * }
+ * </pre>
+ */
+public class Attribute extends Asn1SequenceType {
+    private static final int ATTR_TYPE = 0;
+    private static final int ATTR_VALUES = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(ATTR_TYPE, Asn1ObjectIdentifier.class),
+        new Asn1FieldInfo(ATTR_VALUES, AttributeValues.class)
+    };
+
+    public Attribute() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getAttrType() {
+        return getFieldAs(ATTR_TYPE, Asn1ObjectIdentifier.class);
+    }
+
+    public void setAttrType(Asn1ObjectIdentifier attrType) {
+        setFieldAs(ATTR_TYPE, attrType);
+    }
+
+    public AttributeValues getAttrValues() {
+        return getFieldAs(ATTR_VALUES, AttributeValues.class);
+    }
+
+    public void setAttrValues(AttributeValues attrValues) {
+        setFieldAs(ATTR_VALUES, attrValues);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..db7b342
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeCertificate.java
@@ -0,0 +1,73 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * <pre>
+ *  AttributeCertificate ::= SEQUENCE {
+ *       acinfo               AttributeCertificateInfo,
+ *       signatureAlgorithm   AlgorithmIdentifier,
+ *       signatureValue       BIT STRING
+ *  }
+ * </pre>
+ */
+public class AttributeCertificate extends Asn1SequenceType {
+    private static final int ACI_INFO = 0;
+    private static final int SIGNATURE_ALGORITHM = 1;
+    private static final int SIGNATURE_VALUE = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(ACI_INFO, AttributeCertificateInfo.class),
+        new Asn1FieldInfo(SIGNATURE_ALGORITHM, AlgorithmIdentifier.class),
+        new Asn1FieldInfo(SIGNATURE_VALUE, Asn1BitString.class)
+    };
+
+    public AttributeCertificate() {
+        super(fieldInfos);
+    }
+
+    public AttributeCertificateInfo getAcinfo() {
+        return getFieldAs(ACI_INFO, AttributeCertificateInfo.class);
+    }
+
+    public void setAciInfo(AttributeCertificateInfo aciInfo) {
+        setFieldAs(ACI_INFO, aciInfo);
+    }
+
+    public AlgorithmIdentifier getSignatureAlgorithm() {
+        return getFieldAs(SIGNATURE_ALGORITHM, AlgorithmIdentifier.class);
+    }
+
+    public void setSignatureAlgorithm(AlgorithmIdentifier signatureAlgorithm) {
+        setFieldAs(SIGNATURE_ALGORITHM, signatureAlgorithm);
+    }
+
+    public Asn1BitString getSignatureValue() {
+        return getFieldAs(SIGNATURE_VALUE, Asn1BitString.class);
+    }
+
+    public void setSignatureValue(Asn1BitString signatureValue) {
+        setFieldAs(SIGNATURE_VALUE, signatureValue);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..a3c1a62
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeCertificateInfo.java
@@ -0,0 +1,145 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ *
+ * <pre>
+ *  AttributeCertificateInfo ::= SEQUENCE {
+ *       version              AttCertVersion -- version is v2,
+ *       holder               Holder,
+ *       issuer               AttCertIssuer,
+ *       signature            AlgorithmIdentifier,
+ *       serialNumber         CertificateSerialNumber,
+ *       attrCertValidityPeriod   AttCertValidityPeriod,
+ *       attributes           SEQUENCE OF Attribute,
+ *       issuerUniqueID       UniqueIdentifier OPTIONAL,
+ *       extensions           Extensions OPTIONAL
+ *  }
+ *
+ *  AttCertVersion ::= INTEGER { v2(1) }
+ *
+ *  UniqueIdentifier  ::=  BIT STRING
+ * </pre>
+ */
+public class AttributeCertificateInfo extends Asn1SequenceType {
+    private static final int VERSION = 0;
+    private static final int HOLDER = 1;
+    private static final int ISSUER = 2;
+    private static final int SIGNATURE = 3;
+    private static final int SERIAL_NUMBER = 4;
+    private static final int ATTR_CERT_VALIDITY_PERIOD = 5;
+    private static final int ATTRIBUTES = 6;
+    private static final int ISSUER_UNIQUE_ID = 7;
+    private static final int EXTENSIONS = 8;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(VERSION, Asn1Integer.class),
+        new Asn1FieldInfo(HOLDER, Holder.class),
+        new Asn1FieldInfo(ISSUER, AttCertIssuer.class),
+        new Asn1FieldInfo(SIGNATURE, AlgorithmIdentifier.class),
+        new Asn1FieldInfo(SERIAL_NUMBER, CertificateSerialNumber.class),
+        new Asn1FieldInfo(ATTR_CERT_VALIDITY_PERIOD, AttCertValidityPeriod.class),
+        new Asn1FieldInfo(ATTRIBUTES, Attributes.class),
+        new Asn1FieldInfo(ISSUER_UNIQUE_ID, Asn1BitString.class),
+        new Asn1FieldInfo(EXTENSIONS, Extensions.class)
+    };
+
+    public AttributeCertificateInfo() {
+        super(fieldInfos);
+    }
+
+    public int getVersion() {
+        return getFieldAsInteger(VERSION);
+    }
+
+    public void setVersion(int version) {
+        setFieldAsInt(VERSION, version);
+    }
+
+    public Holder getHolder() {
+        return getFieldAs(HOLDER, Holder.class);
+    }
+
+    public void setHolder(Holder holder) {
+        setFieldAs(HOLDER, holder);
+    }
+
+    public AttCertIssuer getIssuer() {
+        return getFieldAs(ISSUER, AttCertIssuer.class);
+    }
+
+    public void setIssuer(AttCertIssuer attCertIssuer) {
+        setFieldAs(ISSUER, attCertIssuer);
+    }
+
+    public AlgorithmIdentifier getSignature() {
+        return getFieldAs(SIGNATURE, AlgorithmIdentifier.class);
+    }
+
+    public void setSignature(AlgorithmIdentifier signature) {
+        setFieldAs(SIGNATURE, signature);
+    }
+
+    public CertificateSerialNumber getSerialNumber() {
+        return getFieldAs(SERIAL_NUMBER, CertificateSerialNumber.class);
+    }
+
+    public void setSerialNumber(CertificateSerialNumber certificateSerialNumber) {
+        setFieldAs(SERIAL_NUMBER, certificateSerialNumber);
+    }
+
+    public AttCertValidityPeriod getAttrCertValidityPeriod() {
+        return getFieldAs(ATTR_CERT_VALIDITY_PERIOD, AttCertValidityPeriod.class);
+    }
+
+    public void setAttrCertValidityPeriod(AttCertValidityPeriod attrCertValidityPeriod) {
+        setFieldAs(ATTR_CERT_VALIDITY_PERIOD, attrCertValidityPeriod);
+    }
+
+    public Attributes getAttributes() {
+        return getFieldAs(ATTRIBUTES, Attributes.class);
+    }
+
+    public void setAttributes(Attributes attributes) {
+        setFieldAs(ATTRIBUTES, attributes);
+    }
+
+    public byte[] getIssuerUniqueID() {
+        return getFieldAs(ISSUER_UNIQUE_ID, Asn1BitString.class).getValue();
+    }
+
+    public void setIssuerUniqueId(byte[] issuerUniqueId) {
+        setFieldAs(ISSUER_UNIQUE_ID, new Asn1BitString(issuerUniqueId));
+    }
+
+    public Extensions getExtensions() {
+        return getFieldAs(EXTENSIONS, Extensions.class);
+    }
+
+    public void setExtensions(Extensions extensions) {
+        setFieldAs(EXTENSIONS, extensions);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeValues.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeValues.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeValues.java
new file mode 100644
index 0000000..f407856
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AttributeValues.java
@@ -0,0 +1,27 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SetOf;
+import org.apache.kerby.asn1.type.Asn1Type;
+
+public class AttributeValues extends Asn1SetOf<Asn1Type> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Attributes.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Attributes.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Attributes.java
new file mode 100644
index 0000000..c63b7fc
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Attributes.java
@@ -0,0 +1,43 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+/**
+ * Ref. RFC 3039
+ *
+ * <pre>
+ *     SubjectDirectoryAttributes ::= Attributes
+ *     Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
+ *     Attribute ::= SEQUENCE {
+ *       type AttributeType
+ *       values SET OF AttributeValue
+ *     }
+ *
+ *     AttributeType ::= OBJECT IDENTIFIER
+ *     AttributeValue ::= ANY DEFINED BY AttributeType
+ * </pre>
+ *
+ * @see org.bouncycastle.asn1.x500.style.BCStyle for AttributeType ObjectIdentifiers.
+ */
+public class Attributes extends Asn1SequenceOf<Attribute> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AuthorityInformationAccess.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AuthorityInformationAccess.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AuthorityInformationAccess.java
new file mode 100644
index 0000000..1719304
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AuthorityInformationAccess.java
@@ -0,0 +1,41 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+/**
+ *
+ * <pre>
+ * id-pe-authorityInfoAccess OBJECT IDENTIFIER ::= { id-pe 1 }
+ *
+ * AuthorityInfoAccessSyntax  ::=
+ *      SEQUENCE SIZE (1..MAX) OF AccessDescription
+ * AccessDescription  ::=  SEQUENCE {
+ *       accessMethod          OBJECT IDENTIFIER,
+ *       accessLocation        GeneralName
+ * }
+ *
+ * </pre>
+ */
+public class AuthorityInformationAccess
+    extends Asn1SequenceOf<AccessDescription> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..e289fc8
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/AuthorityKeyIdentifier.java
@@ -0,0 +1,80 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ImplicitField;
+
+/**
+ *
+ * <pre>
+ * id-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::=  { id-ce 35 }
+ *
+ *   AuthorityKeyIdentifier ::= SEQUENCE {
+ *        keyIdentifier             [0] IMPLICIT KeyIdentifier           OPTIONAL,
+ *        authorityCertIssuer       [1] IMPLICIT GeneralNames            OPTIONAL,
+ *        authorityCertSerialNumber [2] IMPLICIT CertificateSerialNumber OPTIONAL
+ *      }
+ *
+ *   KeyIdentifier ::= OCTET STRING
+ * </pre>
+ *
+ */
+public class AuthorityKeyIdentifier extends Asn1SequenceType {
+    private static final int KEY_IDENTIFIER = 0;
+    private static final int AUTHORITY_CERT_ISSUER = 1;
+    private static final int AUTHORITY_CERT_SERIAL_NUMBER = 2;
+
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new ImplicitField(KEY_IDENTIFIER, KeyIdentifier.class),
+        new ImplicitField(AUTHORITY_CERT_ISSUER, GeneralNames.class),
+        new ImplicitField(AUTHORITY_CERT_SERIAL_NUMBER, CertificateSerialNumber.class)
+    };
+
+    public AuthorityKeyIdentifier() {
+        super(fieldInfos);
+    }
+
+    public KeyIdentifier getKeyIdentifier() {
+        return getFieldAs(KEY_IDENTIFIER, KeyIdentifier.class);
+    }
+
+    public void setKeyIdentifier(KeyIdentifier keyIdentifier) {
+        setFieldAs(KEY_IDENTIFIER, keyIdentifier);
+    }
+
+    public GeneralNames getAuthorityCertIssuer() {
+        return getFieldAs(AUTHORITY_CERT_ISSUER, GeneralNames.class);
+    }
+
+    public void setAuthorityCertIssuer(GeneralNames authorityCertIssuer) {
+        setFieldAs(AUTHORITY_CERT_ISSUER, authorityCertIssuer);
+    }
+    
+    public CertificateSerialNumber getAuthorityCertSerialNumber() {
+        return getFieldAs(AUTHORITY_CERT_SERIAL_NUMBER, CertificateSerialNumber.class);
+    }
+
+    public void setAuthorityCertSerialNumber(CertificateSerialNumber authorityCertSerialNumber) {
+        setFieldAs(AUTHORITY_CERT_SERIAL_NUMBER, authorityCertSerialNumber);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..d4b0ad0
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/BasicConstraints.java
@@ -0,0 +1,69 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Boolean;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import java.math.BigInteger;
+
+/**
+ * <pre>
+ * BasicConstraints := SEQUENCE {
+ *    cA                  BOOLEAN DEFAULT FALSE,
+ *    pathLenConstraint   INTEGER (0..MAX) OPTIONAL
+ * }
+ * </pre>
+ */
+public class BasicConstraints extends Asn1SequenceType {
+    private static final int CA = 0;
+    private static final int PATH_LEN_CONSTRAINT = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(CA, Asn1Boolean.class),
+        new Asn1FieldInfo(PATH_LEN_CONSTRAINT, Asn1Integer.class)
+    };
+
+    public BasicConstraints() {
+        super(fieldInfos);
+    }
+
+    public boolean isCA() {
+        return false;
+    }
+
+    public boolean getCA() {
+        return getFieldAs(CA, Asn1Boolean.class).getValue();
+    }
+
+    public void setCA(Asn1Boolean isCA) {
+        setFieldAs(CA, isCA);
+    }
+
+    public BigInteger getPathLenConstraint() {
+        return getFieldAs(PATH_LEN_CONSTRAINT, Asn1Integer.class).getValue();
+    }
+
+    public void setPathLenConstraint(Asn1Integer pathLenConstraint) {
+        setFieldAs(PATH_LEN_CONSTRAINT, pathLenConstraint);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CRLDistPoint.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CRLDistPoint.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CRLDistPoint.java
new file mode 100644
index 0000000..d926404
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CRLDistPoint.java
@@ -0,0 +1,31 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+/**
+ * <pre>
+ * CRLDistPoint ::= SEQUENCE SIZE {1..MAX} OF DistributionPoint
+ * </pre>
+ */
+public class CRLDistPoint extends Asn1SequenceOf<DistributionPoint> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CRLNumber.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CRLNumber.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CRLNumber.java
new file mode 100644
index 0000000..745679b
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CRLNumber.java
@@ -0,0 +1,31 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Integer;
+
+/**
+ * <pre>
+ * CRLNumber::= INTEGER(0..MAX)
+ * </pre>
+ */
+public class CRLNumber extends Asn1Integer {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CRLReason.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CRLReason.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CRLReason.java
new file mode 100644
index 0000000..1596b8a
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CRLReason.java
@@ -0,0 +1,66 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1EnumType;
+import org.apache.kerby.asn1.type.Asn1Enumerated;
+
+/**
+ *
+ * <pre>
+ * CRLReason ::= ENUMERATED {
+ *  unspecified             (0),
+ *  keyCompromise           (1),
+ *  cACompromise            (2),
+ *  affiliationChanged      (3),
+ *  superseded              (4),
+ *  cessationOfOperation    (5),
+ *  certificateHold         (6),
+ *  removeFromCRL           (8),
+ *  privilegeWithdrawn      (9),
+ *  aACompromise           (10)
+ * }
+ * </pre>
+ */
+
+enum CRLReasonEnum implements Asn1EnumType {
+    UNSPECIFIED,
+    KEY_COMPROMISE,
+    CA_COMPROMISE,
+    AFFILIATION_CHANGED,
+    SUPERSEDED,
+    CESSATION_OF_OPERATION,
+    CERTIFICATE_HOLD,
+    REMOVE_FROM_CRL,
+    PRIVILEGE_WITH_DRAWN,
+    AA_COMPROMISE;
+
+    @Override
+    public int getValue() {
+        return ordinal();
+    }
+}
+
+public class CRLReason extends Asn1Enumerated<CRLReasonEnum> {
+    @Override
+    public Asn1EnumType[] getAllEnumValues() {
+        return CRLReasonEnum.values();
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertPolicyId.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertPolicyId.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertPolicyId.java
new file mode 100644
index 0000000..dc97c32
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertPolicyId.java
@@ -0,0 +1,31 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+
+/**
+ * <pre>
+ *     CertPolicyId ::= OBJECT IDENTIFIER
+ * </pre>
+ */
+public class CertPolicyId extends Asn1ObjectIdentifier {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..53dc285
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Certificate.java
@@ -0,0 +1,73 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * <pre>
+ *  Certificate ::= SEQUENCE {
+ *      tbsCertificate          TBSCertificate,
+ *      signatureAlgorithm      AlgorithmIdentifier,
+ *      signature               BIT STRING
+ *  }
+ * </pre>
+ */
+public class Certificate extends Asn1SequenceType {
+    private static final int TBS_CERTIFICATE = 0;
+    private static final int SIGNATURE_ALGORITHM = 1;
+    private static final int SIGNATURE = 2;
+
+    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/93bcd6fe/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
new file mode 100644
index 0000000..b9ea948
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificateList.java
@@ -0,0 +1,75 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ *
+ * RFC-2459:
+ * <pre>
+ * CertificateList  ::=  SEQUENCE  {
+ *      tbsCertList          TBSCertList,
+ *      signatureAlgorithm   AlgorithmIdentifier,
+ *      signatureValue       BIT STRING
+ * }
+ * </pre>
+ */
+public class CertificateList extends Asn1SequenceType {
+    private static final int TBS_CERT_LIST = 0;
+    private static final int SIGNATURE_ALGORITHMS = 1;
+    private static final int SIGNATURE_VALUE = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(TBS_CERT_LIST, TBSCertList.class),
+        new Asn1FieldInfo(SIGNATURE_ALGORITHMS, AlgorithmIdentifier.class),
+        new Asn1FieldInfo(SIGNATURE_VALUE, Asn1BitString.class)
+    };
+
+    public CertificateList() {
+        super(fieldInfos);
+    }
+
+    public TBSCertList getTBSCertList() {
+        return getFieldAs(TBS_CERT_LIST, TBSCertList.class);
+    }
+
+    public void setTBSCertList(TBSCertList tbsCertList) {
+        setFieldAs(TBS_CERT_LIST, tbsCertList);
+    }
+
+    public AlgorithmIdentifier getSignatureAlgorithm() {
+        return getFieldAs(SIGNATURE_ALGORITHMS, AlgorithmIdentifier.class);
+    }
+
+    public void setSignatureAlgorithms(AlgorithmIdentifier signatureAlgorithms) {
+        setFieldAs(SIGNATURE_ALGORITHMS, signatureAlgorithms);
+    }
+
+    public Asn1BitString getSignature() {
+        return getFieldAs(SIGNATURE_VALUE, Asn1BitString.class);
+    }
+
+    public void setSignatureValue(Asn1BitString signatureValue) {
+        setFieldAs(SIGNATURE_VALUE, signatureValue);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..9a9c0db
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificatePair.java
@@ -0,0 +1,64 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ *
+ * <pre>
+ *       CertificatePair ::= SEQUENCE {
+ *         forward        [0]    Certificate OPTIONAL,
+ *         reverse        [1]    Certificate OPTIONAL,
+ *             -- at least one of the pair shall be present --
+ *       }
+ * </pre>
+ */
+public class CertificatePair extends Asn1SequenceType {
+    private static final int FORWARD = 0;
+    private static final int REVERSE = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new ExplicitField(FORWARD, Certificate.class),
+        new ExplicitField(REVERSE, Certificate.class)
+    };
+
+    public CertificatePair() {
+        super(fieldInfos);
+    }
+
+    public Certificate getForward() {
+        return getFieldAs(FORWARD, Certificate.class);
+    }
+
+    public void setForward(Certificate forward) {
+        setFieldAs(FORWARD, forward);
+    }
+
+    public Certificate getReverse() {
+        return getFieldAs(REVERSE, Certificate.class);
+    }
+
+    public void setReverse(Certificate reverse) {
+        setFieldAs(REVERSE, reverse);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificatePolicies.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificatePolicies.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificatePolicies.java
new file mode 100644
index 0000000..92663c5
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificatePolicies.java
@@ -0,0 +1,32 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+/**
+ *
+ * <pre>
+ * CertificatePolicies ::= SEQUENCE SIZE {1..MAX} OF PolicyInformation
+ * </pre>
+ */
+public class CertificatePolicies extends Asn1SequenceOf<PolicyInformation> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificateSerialNumber.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificateSerialNumber.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificateSerialNumber.java
new file mode 100644
index 0000000..a2f06f3
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/CertificateSerialNumber.java
@@ -0,0 +1,26 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Integer;
+
+public class CertificateSerialNumber extends Asn1Integer {
+}
+

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..3183d9f
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DSAParameter.java
@@ -0,0 +1,66 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import java.math.BigInteger;
+
+public class DSAParameter extends Asn1SequenceType {
+    private static final int P = 0;
+    private static final int Q = 1;
+    private static final int G = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(P, Asn1Integer.class),
+        new Asn1FieldInfo(Q, Asn1Integer.class),
+        new Asn1FieldInfo(G, Asn1Integer.class)
+    };
+
+    public DSAParameter() {
+        super(fieldInfos);
+    }
+
+    public BigInteger getP() {
+        return getFieldAs(P, Asn1Integer.class).getValue();
+    }
+
+    public void setP(BigInteger p) {
+        setFieldAs(P, new Asn1Integer(p));
+    }
+
+    public BigInteger getQ() {
+        return getFieldAs(Q, Asn1Integer.class).getValue();
+    }
+
+    public void setQ(BigInteger q) {
+        setFieldAs(Q, new Asn1Integer(q));
+    }
+
+    public BigInteger getG() {
+        return getFieldAs(G, Asn1Integer.class).getValue();
+    }
+
+    public void setG(BigInteger g) {
+        setFieldAs(G, new Asn1Integer(g));
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..1f0ddec
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DigestInfo.java
@@ -0,0 +1,62 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * <pre>
+ * DigestInfo::=SEQUENCE{
+ *          digestAlgorithm  AlgorithmIdentifier,
+ *          digest OCTET STRING
+ * }
+ * </pre>
+ */
+public class DigestInfo extends Asn1SequenceType {
+    private static final int DIGEST_ALGORITHM = 0;
+    private static final int DIGEST = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(DIGEST_ALGORITHM, AlgorithmIdentifier.class),
+        new Asn1FieldInfo(DIGEST, Asn1OctetString.class)
+    };
+
+    public DigestInfo() {
+        super(fieldInfos);
+    }
+
+    public AlgorithmIdentifier getAlgorithmId() {
+        return getFieldAs(DIGEST_ALGORITHM, AlgorithmIdentifier.class);
+    }
+
+    public void setDigestAlgorithm(AlgorithmIdentifier digestAlgorithm) {
+        setFieldAs(DIGEST_ALGORITHM, digestAlgorithm);
+    }
+
+    public byte[] getDigest() {
+        return getFieldAsOctets(DIGEST);
+    }
+
+    public void setDigest(byte[] digest) {
+        setFieldAsOctets(DIGEST, digest);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DigestedObjectType.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DigestedObjectType.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DigestedObjectType.java
new file mode 100644
index 0000000..e67c503
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DigestedObjectType.java
@@ -0,0 +1,53 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1EnumType;
+import org.apache.kerby.asn1.type.Asn1Enumerated;
+
+/**
+ *
+ * <pre>
+ *         digestedObjectType  ENUMERATED {
+ *                 publicKey            (0),
+ *                 publicKeyCert        (1),
+ *                 otherObjectTypes     (2)
+ *         }
+ *   
+ * </pre>
+ * 
+ */
+enum DigestedObjectEnum implements Asn1EnumType {
+    PUBLIC_KEY,
+    PUBLIC_KEY_CERT,
+    OTHER_OBJECT_TYPES;
+
+    @Override
+    public int getValue() {
+        return ordinal();
+    }
+}
+
+public class DigestedObjectType extends Asn1Enumerated<DigestedObjectEnum> {
+    @Override
+    public Asn1EnumType[] getAllEnumValues() {
+        return DigestedObjectEnum.values();
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..7a623ff
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DirectoryString.java
@@ -0,0 +1,100 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1BmpString;
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.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;
+
+/**
+ * <pre>
+ *  DirectoryString ::= CHOICE {
+ *    teletexString               TeletexString (SIZE (1..MAX)),
+ *    printableString             PrintableString (SIZE (1..MAX)),
+ *    universalString             UniversalString (SIZE (1..MAX)),
+ *    utf8String                  UTF8String (SIZE (1..MAX)),
+ *    bmpString                   BMPString (SIZE (1..MAX))
+ * }
+ * </pre>
+ */
+public class DirectoryString extends Asn1Choice{
+
+    private static final int TELETEX_STRING = 0;
+    private static final int PRINTABLE_STRING = 1;
+    private static final int UNIVERSAL_STRING = 2;
+    private static final int UTF8_STRING = 3;
+    private static final int BMP_STRING = 4;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+            new Asn1FieldInfo(TELETEX_STRING, Asn1T61String.class),
+            new Asn1FieldInfo(PRINTABLE_STRING, Asn1PrintableString.class),
+            new Asn1FieldInfo(UNIVERSAL_STRING, Asn1UniversalString.class),
+            new Asn1FieldInfo(UTF8_STRING, Asn1Utf8String.class),
+            new Asn1FieldInfo(BMP_STRING, Asn1BmpString.class)
+    };
+
+    public DirectoryString() {
+        super(fieldInfos);
+    }
+
+    public Asn1T61String getTeletexString() {
+        return getFieldAs(TELETEX_STRING, Asn1T61String.class);
+    }
+
+    public void setTeletexString(Asn1T61String teletexString) {
+        setFieldAs(TELETEX_STRING, teletexString);
+    }
+
+    public Asn1PrintableString getPrintableString() {
+        return getFieldAs(PRINTABLE_STRING, Asn1PrintableString.class);
+    }
+
+    public void setPrintableString(Asn1PrintableString printableString) {
+        setFieldAs(PRINTABLE_STRING, printableString);
+    }
+
+    public Asn1UniversalString getUniversalString() {
+        return getFieldAs(UNIVERSAL_STRING, Asn1UniversalString.class);
+    }
+
+    public void setUniversalString(Asn1UniversalString universalString) {
+        setFieldAs(UNIVERSAL_STRING, universalString);
+    }
+
+    public Asn1Utf8String getUtf8String() {
+        return getFieldAs(UTF8_STRING, Asn1Utf8String.class);
+    }
+
+    public void setUtf8String(Asn1Utf8String utf8String) {
+        setFieldAs(UTF8_STRING, utf8String);
+    }
+
+    public Asn1BmpString getBmpString() {
+        return getFieldAs(BMP_STRING, Asn1BmpString.class);
+    }
+
+    public void setBmpString(Asn1BmpString bmpString) {
+        setFieldAs(BMP_STRING, bmpString);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..bb99ead
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DisplayText.java
@@ -0,0 +1,87 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1BmpString;
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1IA5String;
+import org.apache.kerby.asn1.type.Asn1Utf8String;
+import org.apache.kerby.asn1.type.Asn1VisibleString;
+
+/**
+ * <pre>
+ * DisplayText ::= CHOICE {
+ *      ia5String        IA5String      (SIZE (1..200)),
+ *      visibleString    VisibleString  (SIZE (1..200)),
+ *      bmpString        BMPString      (SIZE (1..200)),
+ *      utf8String       UTF8String     (SIZE (1..200))
+ *  }
+ * </pre>
+ */
+public class DisplayText extends Asn1Choice {
+   private static final int IA5_STRING = 0;
+   private static final int VISIBLE_STRING = 1;
+   private static final int BMP_STRING = 2;
+   private static final int UTF8_STRING = 3;
+
+   static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+           new Asn1FieldInfo(IA5_STRING, Asn1IA5String.class),
+           new Asn1FieldInfo(VISIBLE_STRING, Asn1VisibleString.class),
+           new Asn1FieldInfo(BMP_STRING, Asn1BmpString.class),
+           new Asn1FieldInfo(UTF8_STRING, Asn1BmpString.class)
+   };
+
+   public DisplayText() {
+      super(fieldInfos);
+   }
+
+   public Asn1IA5String getIA5String() {
+      return getFieldAs(IA5_STRING, Asn1IA5String.class);
+   }
+
+   public void setIA5String(Asn1IA5String ia5String) {
+      setFieldAs(IA5_STRING, ia5String);
+   }
+
+   public Asn1VisibleString getVisibleString() {
+      return getFieldAs(VISIBLE_STRING, Asn1VisibleString.class);
+   }
+
+   public void setVisibleString(Asn1VisibleString visibleString) {
+      setFieldAs(VISIBLE_STRING, visibleString);
+   }
+
+   public Asn1BmpString getBmpString() {
+      return getFieldAs(BMP_STRING, Asn1BmpString.class);
+   }
+
+   public void setBmpString(Asn1BmpString bmpString) {
+      setFieldAs(BMP_STRING, bmpString);
+   }
+
+   public Asn1Utf8String getUtf8String() {
+      return getFieldAs(UTF8_STRING, Asn1Utf8String.class);
+   }
+
+   public void setUtf8String(Asn1Utf8String utf8String) {
+      setFieldAs(UTF8_STRING, utf8String);
+   }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..7a70f65
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DistributionPoint.java
@@ -0,0 +1,74 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ *
+ * <pre>
+ * DistributionPoint ::= SEQUENCE {
+ *      distributionPoint [0] DistributionPointName OPTIONAL,
+ *      reasons           [1] ReasonFlags OPTIONAL,
+ *      cRLIssuer         [2] GeneralNames OPTIONAL
+ * }
+ * </pre>
+ */
+public class DistributionPoint extends Asn1SequenceType {
+    private static final int DISTRIBUTION_POINT = 0;
+    private static final int REASONS = 1;
+    private static final int CRL_ISSUER = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new ExplicitField(DISTRIBUTION_POINT, DistributionPointName.class),
+        new ExplicitField(REASONS, ReasonFlags.class),
+        new ExplicitField(CRL_ISSUER, GeneralNames.class)
+    };
+
+    public DistributionPoint() {
+        super(fieldInfos);
+    }
+
+    public DistributionPointName getDistributionPoint() {
+        return getFieldAs(DISTRIBUTION_POINT, DistributionPointName.class);
+    }
+
+    public void setDistributionPoint(DistributionPointName distributionPoint) {
+        setFieldAs(DISTRIBUTION_POINT, distributionPoint);
+    }
+
+    public ReasonFlags getReasons() {
+        return getFieldAs(REASONS, ReasonFlags.class);
+    }
+
+    public void setReasons(ReasonFlags reasons) {
+        setFieldAs(REASONS, reasons);
+    }
+
+    public GeneralNames getCRLIssuer() {
+        return getFieldAs(CRL_ISSUER, GeneralNames.class);
+    }
+
+    public void setCRLIssuer(GeneralNames crlIssuer) {
+        setFieldAs(CRL_ISSUER, crlIssuer);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..0dc0579
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/DistributionPointName.java
@@ -0,0 +1,64 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
+import org.apache.kerby.x500.type.RelativeDistinguishedName;
+
+/**
+ *
+ * <pre>
+ * DistributionPointName ::= CHOICE {
+ *     fullName                 [0] GeneralNames,
+ *     nameRelativeToCRLIssuer  [1] RDN
+ * }
+ * </pre>
+ */
+public class DistributionPointName extends Asn1Choice {
+    private static final int FULL_NAME = 0;
+    private static final int NAME_RELATIVE_TO_CRL_ISSUER = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new ExplicitField(FULL_NAME, GeneralNames.class),
+        new ExplicitField(NAME_RELATIVE_TO_CRL_ISSUER, RelativeDistinguishedName.class)
+    };
+
+    public DistributionPointName() {
+        super(fieldInfos);
+    }
+
+    public GeneralNames getFullName() {
+        return getFieldAs(FULL_NAME, GeneralNames.class);
+    }
+
+    public void setFullName(GeneralNames fullName) {
+        setFieldAs(FULL_NAME, fullName);
+    }
+
+    public RelativeDistinguishedName getNameRelativeToCRLIssuer() {
+        return getFieldAs(NAME_RELATIVE_TO_CRL_ISSUER, RelativeDistinguishedName.class);
+    }
+
+    public void setNameRelativeToCrlIssuer(RelativeDistinguishedName nameRelativeToCrlIssuer) {
+        setFieldAs(NAME_RELATIVE_TO_CRL_ISSUER, nameRelativeToCrlIssuer);
+    }
+}


[04/17] directory-kerby git commit: Use StandardCharsets.UTF_8 to avoid handling of UnsupportedEncodingException

Posted by pl...@apache.org.
Use StandardCharsets.UTF_8 to avoid handling of UnsupportedEncodingException


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/b7a062e6
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/b7a062e6
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/b7a062e6

Branch: refs/heads/pkinit-support
Commit: b7a062e606ff40dda2f2003a16fa528096e7bc05
Parents: 8194b21
Author: Stefan Seelmann <ma...@stefan-seelmann.de>
Authored: Thu Nov 26 07:52:09 2015 +0100
Committer: Stefan Seelmann <ma...@stefan-seelmann.de>
Committed: Thu Nov 26 07:52:26 2015 +0100

----------------------------------------------------------------------
 .../org/apache/kerby/config/IniConfigLoader.java  |  4 ++--
 .../kerberos/kerb/integration/test/Transport.java |  4 ++--
 .../kerb/integration/test/gss/GssAppClient.java   |  4 ++--
 .../kerb/integration/test/gss/GssAppServer.java   |  4 ++--
 .../kerb/integration/test/jaas/TokenCache.java    |  6 +++---
 .../kerb/integration/test/sasl/SaslAppClient.java |  8 ++++----
 .../kerb/integration/test/sasl/SaslAppServer.java |  4 ++--
 .../kerb/crypto/cksum/HmacMd5Rc4CheckSum.java     |  4 ++--
 .../kerberos/kerb/crypto/enc/KeKiCmacEnc.java     |  4 ++--
 .../kerberos/kerb/crypto/enc/KeKiHmacSha1Enc.java |  4 ++--
 .../kerby/kerberos/kerb/crypto/fast/FastUtil.java |  4 ++--
 .../kerb/crypto/key/AbstractKeyMaker.java         | 18 ++++++------------
 .../kerberos/kerb/crypto/key/AesKeyMaker.java     |  8 +-------
 .../kerb/crypto/key/CamelliaKeyMaker.java         |  8 +-------
 .../kerby/kerberos/kerb/crypto/util/Rc4.java      |  4 ++--
 .../kerby/kerberos/kerb/KrbInputStream.java       |  4 ++--
 .../kerby/kerberos/kerb/KrbOutputStream.java      |  4 ++--
 .../kerberos/provider/token/JwtTokenDecoder.java  |  4 ++--
 .../kerberos/provider/token/JwtTokenEncoder.java  |  4 ++--
 .../kerby/kerberos/tool/token/TokenCache.java     |  6 +++---
 .../src/main/java/org/apache/kerby/util/Utf8.java | 14 +++-----------
 21 files changed, 49 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-config/src/main/java/org/apache/kerby/config/IniConfigLoader.java
----------------------------------------------------------------------
diff --git a/kerby-config/src/main/java/org/apache/kerby/config/IniConfigLoader.java b/kerby-config/src/main/java/org/apache/kerby/config/IniConfigLoader.java
index 69e58ab..5c673b2 100644
--- a/kerby-config/src/main/java/org/apache/kerby/config/IniConfigLoader.java
+++ b/kerby-config/src/main/java/org/apache/kerby/config/IniConfigLoader.java
@@ -23,7 +23,7 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 public class IniConfigLoader extends ConfigLoader {
     private static final String COMMENT_SYMBOL = "#";
@@ -40,7 +40,7 @@ public class IniConfigLoader extends ConfigLoader {
         currentConfig = config;
 
         InputStream is = (InputStream) resource.getResource();
-        BufferedReader reader = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
+        BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
 
         String line;
         while ((line = reader.readLine()) != null) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/Transport.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/Transport.java b/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/Transport.java
index 5aa7151..50bad1a 100644
--- a/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/Transport.java
+++ b/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/Transport.java
@@ -24,7 +24,7 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 import java.net.ServerSocket;
 import java.net.Socket;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 public class Transport {
 
@@ -130,7 +130,7 @@ public class Transport {
         }
 
         public Message(String header, byte[] body) {
-            this.header = header.getBytes(Charset.forName("UTF-8"));
+            this.header = header.getBytes(StandardCharsets.UTF_8);
             this.body = body;
         }
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/gss/GssAppClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/gss/GssAppClient.java b/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/gss/GssAppClient.java
index fd5b4a2..278f294 100644
--- a/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/gss/GssAppClient.java
+++ b/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/gss/GssAppClient.java
@@ -29,7 +29,7 @@ import org.ietf.jgss.GSSName;
 import org.ietf.jgss.MessageProp;
 import org.ietf.jgss.Oid;
 
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 public class GssAppClient extends AppClient {
     private String clientPrincipal;
@@ -94,7 +94,7 @@ public class GssAppClient extends AppClient {
             System.out.println("Mutual authentication took place!");
         }
 
-        byte[] messageBytes = "Hello There!\0".getBytes(Charset.forName("UTF-8"));
+        byte[] messageBytes = "Hello There!\0".getBytes(StandardCharsets.UTF_8);
         MessageProp prop =  new MessageProp(0, true);
         token = context.wrap(messageBytes, 0, messageBytes.length, prop);
         System.out.println("Will send wrap token of size " + token.length);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/gss/GssAppServer.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/gss/GssAppServer.java b/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/gss/GssAppServer.java
index 5130a1a..84ffff2 100644
--- a/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/gss/GssAppServer.java
+++ b/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/gss/GssAppServer.java
@@ -29,7 +29,7 @@ import org.ietf.jgss.GSSName;
 import org.ietf.jgss.MessageProp;
 import org.ietf.jgss.Oid;
 
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 public class GssAppServer extends AppServer {
     private String serverPrincipal;
@@ -94,7 +94,7 @@ public class GssAppServer extends AppServer {
         MessageProp prop = new MessageProp(0, false);
         byte[] token = conn.recvToken();
         byte[] bytes = context.unwrap(token, 0, token.length, prop);
-        String str = new String(bytes, Charset.forName("UTF-8"));
+        String str = new String(bytes, StandardCharsets.UTF_8);
         System.out.println("Received data \""
                 + str + "\" of length " + str.length());
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/jaas/TokenCache.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/jaas/TokenCache.java b/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/jaas/TokenCache.java
index 6051cdb..e398407 100644
--- a/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/jaas/TokenCache.java
+++ b/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/jaas/TokenCache.java
@@ -29,7 +29,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Writer;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 /**
  * This class provides APIs for converting token cache file with token string.
@@ -62,7 +62,7 @@ public class TokenCache {
         String token = null;
         try {
             BufferedReader reader = new BufferedReader(
-                    new InputStreamReader(new FileInputStream(cacheFile), Charset.forName("UTF-8")));
+                    new InputStreamReader(new FileInputStream(cacheFile), StandardCharsets.UTF_8));
             String line = reader.readLine();
             reader.close();
             if (line != null) {
@@ -84,7 +84,7 @@ public class TokenCache {
         File cacheFile = getDefaultTokenCache();
 
         try {
-            Writer writer = new FileWriterWithEncoding(cacheFile, Charset.forName("UTF-8"));
+            Writer writer = new FileWriterWithEncoding(cacheFile, StandardCharsets.UTF_8);
             writer.write(token);
             writer.flush();
             writer.close();

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/sasl/SaslAppClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/sasl/SaslAppClient.java b/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/sasl/SaslAppClient.java
index a20076a..2509df9 100644
--- a/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/sasl/SaslAppClient.java
+++ b/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/sasl/SaslAppClient.java
@@ -25,7 +25,7 @@ import org.apache.kerby.kerberos.kerb.integration.test.Transport;
 import javax.security.sasl.Sasl;
 import javax.security.sasl.SaslClient;
 import java.io.IOException;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -81,7 +81,7 @@ public class SaslAppClient extends AppClient {
 
         System.out.println("Context Established! ");
 
-        token = "Hello There!\0".getBytes(Charset.forName("UTF-8"));
+        token = "Hello There!\0".getBytes(StandardCharsets.UTF_8);
         System.out.println("Will send wrap token of size " + token.length);
 
         conn.sendToken(token);
@@ -92,14 +92,14 @@ public class SaslAppClient extends AppClient {
 
     private boolean isOK(Transport.Message msg) {
         if (msg.header != null) {
-            return new String(msg.header, Charset.forName("UTF-8")).equals("OK");
+            return new String(msg.header, StandardCharsets.UTF_8).equals("OK");
         }
         return false;
     }
 
     private boolean isContinue(Transport.Message msg) {
         if (msg.header != null) {
-            return new String(msg.header, Charset.forName("UTF-8")).equals("CONT");
+            return new String(msg.header, StandardCharsets.UTF_8).equals("CONT");
         }
         return false;
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/sasl/SaslAppServer.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/sasl/SaslAppServer.java b/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/sasl/SaslAppServer.java
index 4b4833c..f769d5e 100644
--- a/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/sasl/SaslAppServer.java
+++ b/kerby-kerb/integration-test/src/main/java/org/apache/kerby/kerberos/kerb/integration/test/sasl/SaslAppServer.java
@@ -30,7 +30,7 @@ import javax.security.sasl.Sasl;
 import javax.security.sasl.SaslException;
 import javax.security.sasl.SaslServer;
 import java.io.IOException;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -100,7 +100,7 @@ public class SaslAppServer extends AppServer {
     protected void doWith(SaslServer ss, Map<String, Object> props,
                           Transport.Connection conn) throws IOException, Exception {
         byte[] token = conn.recvToken();
-        String str = new String(token, Charset.forName("UTF-8"));
+        String str = new String(token, StandardCharsets.UTF_8);
         System.out.println("Received data \""
                 + str + "\" of length " + str.length());
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java
index 787ec26..f584915 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/cksum/HmacMd5Rc4CheckSum.java
@@ -25,7 +25,7 @@ import org.apache.kerby.kerberos.kerb.crypto.cksum.provider.Md5Provider;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.spec.base.CheckSumType;
 
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 public class HmacMd5Rc4CheckSum extends AbstractKeyedCheckSumTypeHandler {
 
@@ -57,7 +57,7 @@ public class HmacMd5Rc4CheckSum extends AbstractKeyedCheckSumTypeHandler {
     protected byte[] doChecksumWithKey(byte[] data, int start, int len,
                                        byte[] key, int usage) throws KrbException {
 
-        byte[] signKey = "signaturekey".getBytes(Charset.forName("UTF-8"));
+        byte[] signKey = "signaturekey".getBytes(StandardCharsets.UTF_8);
         byte[] newSignKey = new byte[signKey.length + 1];
         System.arraycopy(signKey, 0, newSignKey, 0, signKey.length);
         byte[] ksign = Hmac.hmac(hashProvider(), key, newSignKey);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiCmacEnc.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiCmacEnc.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiCmacEnc.java
index 2ee020a..022d5df 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiCmacEnc.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiCmacEnc.java
@@ -25,7 +25,7 @@ import org.apache.kerby.kerberos.kerb.crypto.util.Cmac;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.spec.base.EncryptionType;
 
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 public abstract class KeKiCmacEnc extends KeKiEnc {
 
@@ -48,7 +48,7 @@ public abstract class KeKiCmacEnc extends KeKiEnc {
 
     @Override
     public byte[] prf(byte[] key, byte[] seed) throws KrbException {
-        byte[] prfConst = "prf".getBytes(Charset.forName("UTF-8"));
+        byte[] prfConst = "prf".getBytes(StandardCharsets.UTF_8);
         byte[] kp;
         if (EncryptionHandler.getEncHandler(this.eType()).prfSize() != encProvider().blockSize()) {
             return null;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiHmacSha1Enc.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiHmacSha1Enc.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiHmacSha1Enc.java
index a2823a2..6cf1563 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiHmacSha1Enc.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/enc/KeKiHmacSha1Enc.java
@@ -24,7 +24,7 @@ import org.apache.kerby.kerberos.kerb.crypto.util.Hmac;
 import org.apache.kerby.kerberos.kerb.crypto.cksum.HashProvider;
 import org.apache.kerby.kerberos.kerb.KrbException;
 
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 public abstract class KeKiHmacSha1Enc extends KeKiEnc {
 
@@ -38,7 +38,7 @@ public abstract class KeKiHmacSha1Enc extends KeKiEnc {
 
     @Override
     public byte[] prf(byte[] key, byte[] seed) throws KrbException {
-        byte[] prfConst = "prf".getBytes(Charset.forName("UTF-8"));
+        byte[] prfConst = "prf".getBytes(StandardCharsets.UTF_8);
         int cksumSize = (hashProvider().hashSize() / encProvider().blockSize()) * encProvider().blockSize();
         byte[] cksum = new byte[cksumSize];
         byte[] kp;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/fast/FastUtil.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/fast/FastUtil.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/fast/FastUtil.java
index 4644791..461d789 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/fast/FastUtil.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/fast/FastUtil.java
@@ -23,7 +23,7 @@ import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.crypto.EncryptionHandler;
 import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
 
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 /**
  * Implementing FAST (RFC6113) armor key related algorithms.
@@ -48,7 +48,7 @@ public class FastUtil {
         int prfSize = EncryptionHandler.getEncHandler(key.getKeyType()).prfSize();
         int iterations = keyBytesLen / prfSize;
         prfInbuf[0] = 1;
-        System.arraycopy(pepper.getBytes(Charset.forName("UTF-8")), 0, prfInbuf, 1, pepper.length());
+        System.arraycopy(pepper.getBytes(StandardCharsets.UTF_8), 0, prfInbuf, 1, pepper.length());
         if (keyBytesLen % prfSize != 0) {
             iterations++;
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AbstractKeyMaker.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AbstractKeyMaker.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AbstractKeyMaker.java
index fe0275e..d7bd35d 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AbstractKeyMaker.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AbstractKeyMaker.java
@@ -23,12 +23,11 @@ import org.apache.kerby.kerberos.kerb.crypto.util.BytesUtil;
 import org.apache.kerby.kerberos.kerb.crypto.enc.EncryptProvider;
 import org.apache.kerby.kerberos.kerb.KrbException;
 
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 public abstract class AbstractKeyMaker implements KeyMaker {
 
-    static final byte[] KERBEROS_CONSTANT = "kerberos".getBytes(Charset.forName("UTF-8"));
+    static final byte[] KERBEROS_CONSTANT = "kerberos".getBytes(StandardCharsets.UTF_8);
 
     private EncryptProvider encProvider;
 
@@ -47,11 +46,7 @@ public abstract class AbstractKeyMaker implements KeyMaker {
         System.arraycopy(password.toCharArray(), 0, chars, 0, password.length());
         System.arraycopy(salt.toCharArray(), 0, chars, password.length(), salt.length());
 
-        try {
-            return new String(chars).getBytes("UTF-8");
-        } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException("Character decoding failed", e);
-        }
+        return new String(chars).getBytes(StandardCharsets.UTF_8);
     }
 
     protected static int getIterCount(byte[] param, int defCount) {
@@ -67,11 +62,10 @@ public abstract class AbstractKeyMaker implements KeyMaker {
         return iterCount;
     }
 
-    protected static byte[] getSaltBytes(String salt, String pepper)
-            throws UnsupportedEncodingException {
-        byte[] saltBytes = salt.getBytes("UTF-8");
+    protected static byte[] getSaltBytes(String salt, String pepper) {
+        byte[] saltBytes = salt.getBytes(StandardCharsets.UTF_8);
         if (pepper != null && !pepper.isEmpty()) {
-            byte[] pepperBytes = pepper.getBytes("UTF-8");
+            byte[] pepperBytes = pepper.getBytes(StandardCharsets.UTF_8);
             int len = saltBytes.length;
             len += 1 + pepperBytes.length;
             byte[] results = new byte[len];

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AesKeyMaker.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AesKeyMaker.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AesKeyMaker.java
index c3a72a3..31c5895 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AesKeyMaker.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/AesKeyMaker.java
@@ -23,7 +23,6 @@ import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.crypto.util.Pbkdf;
 import org.apache.kerby.kerberos.kerb.crypto.enc.provider.AesProvider;
 
-import java.io.UnsupportedEncodingException;
 import java.security.GeneralSecurityException;
 
 public class AesKeyMaker extends DkKeyMaker {
@@ -41,12 +40,7 @@ public class AesKeyMaker extends DkKeyMaker {
     public byte[] str2key(String string, String salt, byte[] param) throws KrbException {
         int iterCount = getIterCount(param, 4096);
 
-        byte[] saltBytes = null;
-        try {
-            saltBytes = getSaltBytes(salt, null);
-        } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException(e);
-        }
+        byte[] saltBytes = getSaltBytes(salt, null);
 
         int keySize = encProvider().keySize();
         byte[] random;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/CamelliaKeyMaker.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/CamelliaKeyMaker.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/CamelliaKeyMaker.java
index dbdb7f7..292842f 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/CamelliaKeyMaker.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/key/CamelliaKeyMaker.java
@@ -25,7 +25,6 @@ import org.apache.kerby.kerberos.kerb.crypto.util.Pbkdf;
 import org.apache.kerby.kerberos.kerb.crypto.enc.provider.CamelliaProvider;
 import org.apache.kerby.kerberos.kerb.KrbException;
 
-import java.io.UnsupportedEncodingException;
 import java.security.GeneralSecurityException;
 
 public class CamelliaKeyMaker extends DkKeyMaker {
@@ -43,12 +42,7 @@ public class CamelliaKeyMaker extends DkKeyMaker {
     public byte[] str2key(String string, String salt, byte[] param) throws KrbException {
         int iterCount = getIterCount(param, 32768);
 
-        byte[] saltBytes = null;
-        try {
-            saltBytes = getSaltBytes(salt, getPepper());
-        } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException(e);
-        }
+        byte[] saltBytes = getSaltBytes(salt, getPepper());
 
         int keySize = encProvider().keySize();
         byte[] random;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Rc4.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Rc4.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Rc4.java
index 5a800c6..8213cdf 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Rc4.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/util/Rc4.java
@@ -19,14 +19,14 @@
  */
 package org.apache.kerby.kerberos.kerb.crypto.util;
 
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 /**
  * Ref. MIT krb5 enc_rc4.c
  */
 public class Rc4 {
 
-    private static final byte[] L40 = "fortybits".getBytes(Charset.forName("UTF-8"));
+    private static final byte[] L40 = "fortybits".getBytes(StandardCharsets.UTF_8);
 
     public static byte[] getSalt(int usage, boolean exportable) {
         int newUsage = convertUsage(usage);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbInputStream.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbInputStream.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbInputStream.java
index 40f5324..b523505 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbInputStream.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbInputStream.java
@@ -27,7 +27,7 @@ import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
 import java.io.DataInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 public abstract class KrbInputStream extends DataInputStream {
     public KrbInputStream(InputStream in) {
@@ -55,7 +55,7 @@ public abstract class KrbInputStream extends DataInputStream {
     public String readCountedString() throws IOException {
         byte[] countedOctets = readCountedOctets();
         // ASCII
-        return new String(countedOctets, Charset.forName("UTF-8"));
+        return new String(countedOctets, StandardCharsets.UTF_8);
     }
 
     public byte[] readCountedOctets() throws IOException {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbOutputStream.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbOutputStream.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbOutputStream.java
index bf67ba4..b1ea2c4 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbOutputStream.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/KrbOutputStream.java
@@ -26,7 +26,7 @@ import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 public abstract class KrbOutputStream extends DataOutputStream {
     public KrbOutputStream(OutputStream out) {
@@ -50,7 +50,7 @@ public abstract class KrbOutputStream extends DataOutputStream {
     }
 
     public void writeCountedString(String string) throws IOException {
-        byte[] data = string != null ? string.getBytes(Charset.forName("UTF-8")) : null; // ASCII
+        byte[] data = string != null ? string.getBytes(StandardCharsets.UTF_8) : null; // ASCII
 
         writeCountedOctets(data);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenDecoder.java
----------------------------------------------------------------------
diff --git a/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenDecoder.java b/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenDecoder.java
index 7c34bf1..8aad479 100644
--- a/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenDecoder.java
+++ b/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenDecoder.java
@@ -38,7 +38,7 @@ import org.apache.kerby.kerberos.kerb.provider.TokenDecoder;
 import org.apache.kerby.kerberos.kerb.spec.base.AuthToken;
 
 import java.io.IOException;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.security.PrivateKey;
 import java.security.PublicKey;
 import java.security.interfaces.ECPublicKey;
@@ -62,7 +62,7 @@ public class JwtTokenDecoder implements TokenDecoder {
      */
     @Override
     public AuthToken decodeFromBytes(byte[] content) throws IOException {
-        String tokenStr = new String(content, Charset.forName("UTF-8"));
+        String tokenStr = new String(content, StandardCharsets.UTF_8);
 
         return decodeFromString(tokenStr);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenEncoder.java
----------------------------------------------------------------------
diff --git a/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenEncoder.java b/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenEncoder.java
index 0d129f4..03ebdcf 100644
--- a/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenEncoder.java
+++ b/kerby-provider/token-provider/src/main/java/org/apache/kerby/kerberos/provider/token/JwtTokenEncoder.java
@@ -41,7 +41,7 @@ import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.provider.TokenEncoder;
 import org.apache.kerby.kerberos.kerb.spec.base.AuthToken;
 
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.security.PrivateKey;
 import java.security.PublicKey;
 import java.security.interfaces.ECPrivateKey;
@@ -66,7 +66,7 @@ public class JwtTokenEncoder implements TokenEncoder {
     @Override
     public byte[] encodeAsBytes(AuthToken token) throws KrbException {
         String tokenStr = encodeAsString(token);
-        return tokenStr.getBytes(Charset.forName("UTF-8"));
+        return tokenStr.getBytes(StandardCharsets.UTF_8);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenCache.java
----------------------------------------------------------------------
diff --git a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenCache.java b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenCache.java
index 1235b8f..e8c5a2c 100644
--- a/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenCache.java
+++ b/kerby-tool/client-tool/src/main/java/org/apache/kerby/kerberos/tool/token/TokenCache.java
@@ -29,7 +29,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Writer;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 public class TokenCache {
     private static final String DEFAULT_TOKEN_CACHE_PATH = ".tokenauth";
@@ -53,7 +53,7 @@ public class TokenCache {
         String token = null;
         try {
             BufferedReader reader = new BufferedReader(
-                    new InputStreamReader(new FileInputStream(cacheFile), Charset.forName("UTF-8")));
+                    new InputStreamReader(new FileInputStream(cacheFile), StandardCharsets.UTF_8));
             String line = reader.readLine();
             reader.close();
             if (line != null) {
@@ -70,7 +70,7 @@ public class TokenCache {
         File cacheFile = getDefaultTokenCache();
 
         try {
-            Writer writer = new FileWriterWithEncoding(cacheFile, Charset.forName("UTF-8"));
+            Writer writer = new FileWriterWithEncoding(cacheFile, StandardCharsets.UTF_8);
             writer.write(token);
             writer.flush();
             writer.close();

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b7a062e6/kerby-util/src/main/java/org/apache/kerby/util/Utf8.java
----------------------------------------------------------------------
diff --git a/kerby-util/src/main/java/org/apache/kerby/util/Utf8.java b/kerby-util/src/main/java/org/apache/kerby/util/Utf8.java
index 4952665..4e57234 100644
--- a/kerby-util/src/main/java/org/apache/kerby/util/Utf8.java
+++ b/kerby-util/src/main/java/org/apache/kerby/util/Utf8.java
@@ -19,24 +19,16 @@
  */
 package org.apache.kerby.util;
 
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 
 public final class Utf8 {
     private Utf8() { }
 
     public static String toString(byte[] bytes) {
-        try {
-            return new String(bytes, "UTF-8");
-        } catch (UnsupportedEncodingException uee) {
-            throw new RuntimeException("UTF8 unavailable", uee);
-        }
+        return new String(bytes, StandardCharsets.UTF_8);
     }
 
     public static byte[] toBytes(String s) {
-        try {
-            return s.getBytes("UTF-8");
-        } catch (UnsupportedEncodingException uee) {
-            throw new RuntimeException("UTF8 unavailable", uee);
-        }
+        return s.getBytes(StandardCharsets.UTF_8);
     }
 }


[12/17] directory-kerby git commit: DIRKRB-473. Initially added X509 ASN1 types

Posted by pl...@apache.org.
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..b908b85
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/EDIPartyName.java
@@ -0,0 +1,62 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ * <pre>
+ * EDIPartyName ::= SEQUENCE {
+ *      nameAssigner            [0]     DirectoryString OPTIONAL,
+ *      partyName               [1]     DirectoryString
+ * }
+ * </pre>
+ */
+public class EDIPartyName extends Asn1Choice {
+    private static final int NAME_ASSIGNER = 0;
+    private static final int PARTY_NAME = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+            new ExplicitField(NAME_ASSIGNER, DirectoryString.class),
+            new ExplicitField(PARTY_NAME, DirectoryString.class)
+    };
+
+    public EDIPartyName() {
+        super(fieldInfos);
+    }
+
+    public DirectoryString getNameAssigner() {
+        return getFieldAs(NAME_ASSIGNER, DirectoryString.class);
+    }
+
+    public void setNameAssigner(DirectoryString nameAssigner) {
+        setFieldAs(NAME_ASSIGNER, nameAssigner);
+    }
+
+    public DirectoryString getPartyName() {
+        return getFieldAs(PARTY_NAME, DirectoryString.class);
+    }
+
+    public void setPartyName(DirectoryString partyName) {
+        setFieldAs(PARTY_NAME, partyName);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/ExtendedKeyUsage.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/ExtendedKeyUsage.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/ExtendedKeyUsage.java
new file mode 100644
index 0000000..71ad7c9
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/ExtendedKeyUsage.java
@@ -0,0 +1,31 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+/**
+ * <pre>
+ *      extendedKeyUsage ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
+ * </pre>
+ */
+public class ExtendedKeyUsage extends Asn1SequenceOf<KeyPurposeId> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..2275f43
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Extension.java
@@ -0,0 +1,77 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Boolean;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * Ref. X.509 V3 extension
+ * <pre>
+ *     Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension
+ *
+ *     Extension         ::=   SEQUENCE {
+ *        extnId            EXTENSION.&amp;id ({ExtensionSet}),
+ *        critical          BOOLEAN DEFAULT FALSE,
+ *        extnValue         OCTET STRING }
+ * </pre>
+ */
+public class Extension extends Asn1SequenceType {
+    private static final int EXTN_ID = 0;
+    private static final int CRITICAL = 1;
+    private static final int EXTN_VALUE = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(EXTN_ID, Asn1ObjectIdentifier.class),
+        new Asn1FieldInfo(CRITICAL, Asn1Boolean.class),
+        new Asn1FieldInfo(EXTN_VALUE, Asn1OctetString.class)
+    };
+
+    public Extension() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getExtnId() {
+        return getFieldAs(EXTN_ID, Asn1ObjectIdentifier.class);
+    }
+
+    public void setExtnId(Asn1ObjectIdentifier extnId) {
+        setFieldAs(EXTN_ID, extnId);
+    }
+
+    public boolean getCritical() {
+        return getFieldAs(CRITICAL, Asn1Boolean.class).getValue();
+    }
+
+    public void setCritical(boolean critical) {
+        setFieldAs(CRITICAL, new Asn1Boolean(critical));
+    }
+
+    public byte[] getExtnValue() {
+        return getFieldAsOctets(EXTN_VALUE);
+    }
+
+    public void setValue(byte[] value) {
+        setFieldAsOctets(EXTN_VALUE, value);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Extensions.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Extensions.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Extensions.java
new file mode 100644
index 0000000..535e78c
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Extensions.java
@@ -0,0 +1,37 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+/**
+ * <pre>
+ *     Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension
+ *
+ *     Extension         ::=   SEQUENCE {
+ *        extnId            EXTENSION.&amp;id ({ExtensionSet}),
+ *        critical          BOOLEAN DEFAULT FALSE,
+ *        extnValue         OCTET STRING
+ *     }
+ * </pre>
+ */
+public class Extensions extends Asn1SequenceOf<Extension> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..4d93d9b
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralName.java
@@ -0,0 +1,147 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1IA5String;
+import org.apache.kerby.asn1.type.Asn1Item;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
+import org.apache.kerby.x500.type.Name;
+
+/**
+ *
+ * <pre>
+ * GeneralName ::= CHOICE {
+ *      otherName                       [0]     OtherName,
+ *      rfc822Name                      [1]     IA5String,
+ *      dNSName                         [2]     IA5String,
+ *      x400Address                     [3]     ORAddress,
+ *      directoryName                   [4]     Name,
+ *      ediPartyName                    [5]     EDIPartyName,
+ *      uniformResourceIdentifier       [6]     IA5String,
+ *      iPAddress                       [7]     OCTET STRING,
+ *      registeredID                    [8]     OBJECT IDENTIFIER
+ *  }
+ * </pre>
+ */
+public class GeneralName extends Asn1Choice {
+
+    private static final int OTHER_NAME = 0;
+    private static final int RFC822_NAME = 1;
+    private static final int DNS_NAME = 2;
+    private static final int X400_ADDRESS = 3;
+    private static final int DIRECTORY_NAME = 4;
+    private static final int EDI_PARTY_NAME = 5;
+    private static final int UNIFORM_RESOURCE_IDENTIFIER = 6;
+    private static final int IP_ADDRESS = 7;
+    private static final int REGISTERED_ID = 8;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new ExplicitField(OTHER_NAME, OtherName.class),
+        new ExplicitField(RFC822_NAME, Asn1IA5String.class),
+        new ExplicitField(DNS_NAME, Asn1IA5String.class),
+        // ORAddress is to be defined.
+        new ExplicitField(X400_ADDRESS, Asn1Item.class),
+        new ExplicitField(DIRECTORY_NAME, Name.class),
+        new ExplicitField(EDI_PARTY_NAME, EDIPartyName.class),
+        new ExplicitField(UNIFORM_RESOURCE_IDENTIFIER, Asn1IA5String.class),
+        new ExplicitField(IP_ADDRESS, Asn1OctetString.class),
+        new ExplicitField(REGISTERED_ID, Asn1ObjectIdentifier.class)
+    };
+
+    public GeneralName() {
+        super(fieldInfos);
+    }
+
+    public OtherName getOtherName() {
+        return getFieldAs(OTHER_NAME, OtherName.class);
+    }
+
+    public void setOtherName(OtherName otherName) {
+        setFieldAs(OTHER_NAME, otherName);
+    }
+
+    public Asn1IA5String getRfc822Name() {
+        return getFieldAs(RFC822_NAME, Asn1IA5String.class);
+    }
+
+    public void setRfc822Name(Asn1IA5String rfc822Name) {
+        setFieldAs(RFC822_NAME, rfc822Name);
+    }
+
+    public Asn1IA5String getDNSName() {
+        return getFieldAs(DNS_NAME, Asn1IA5String.class);
+    }
+
+    public void setDNSName(Asn1IA5String dnsName) {
+        setFieldAs(DNS_NAME, dnsName);
+    }
+
+    public Asn1Item getX400Address() {
+        return getFieldAs(X400_ADDRESS, Asn1Item.class);
+    }
+
+    public void setX400Address(Asn1Item x400Address) {
+        setFieldAs(X400_ADDRESS, x400Address);
+    }
+
+    public Name getDirectoryName() {
+        return getFieldAs(DIRECTORY_NAME,Name.class);
+    }
+
+    public void setDirectoryName(Name directoryName) {
+        setFieldAs(DIRECTORY_NAME, directoryName);
+    }
+
+    public EDIPartyName getEdiPartyName() {
+        return getFieldAs(EDI_PARTY_NAME, EDIPartyName.class);
+    }
+
+    public void setEdiPartyName(EDIPartyName ediPartyName) {
+        setFieldAs(EDI_PARTY_NAME, ediPartyName);
+    }
+
+    public Asn1IA5String getUniformResourceIdentifier() {
+        return getFieldAs(UNIFORM_RESOURCE_IDENTIFIER, Asn1IA5String.class);
+    }
+
+    public void setUniformResourceIdentifier(Asn1IA5String uniformResourceIdentifier) {
+        setFieldAs(UNIFORM_RESOURCE_IDENTIFIER, uniformResourceIdentifier);
+    }
+
+    public Asn1OctetString getIPAddress() {
+        return getFieldAs(IP_ADDRESS, Asn1OctetString.class);
+    }
+
+    public void setIpAddress(Asn1OctetString ipAddress) {
+        setFieldAs(IP_ADDRESS, ipAddress);
+    }
+
+    public Asn1ObjectIdentifier getRegisteredID() {
+        return getFieldAs(REGISTERED_ID, Asn1ObjectIdentifier.class);
+    }
+
+    public void setRegisteredID(Asn1ObjectIdentifier registeredID) {
+        setFieldAs(REGISTERED_ID, registeredID);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralNames.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralNames.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralNames.java
new file mode 100644
index 0000000..87a8027
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralNames.java
@@ -0,0 +1,26 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+public class GeneralNames extends Asn1SequenceOf<GeneralName> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..91cacba
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtree.java
@@ -0,0 +1,77 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ *
+ * Ref. RFC 3280.
+ * <pre>
+ *       GeneralSubtree ::= SEQUENCE {
+ *         base                    GeneralName,
+ *         minimum         [0]     BaseDistance DEFAULT 0,
+ *         maximum         [1]     BaseDistance OPTIONAL 
+ *       }
+ * </pre>
+ * 
+ */
+public class GeneralSubtree extends Asn1SequenceType {
+    private static final int BASE = 0;
+    private static final int MINIMUM = 1;
+    private static final int MAXMUM = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(BASE, GeneralName.class),
+        new ExplicitField(MINIMUM, 0, Asn1Integer.class),
+        new ExplicitField(MAXMUM, 1, Asn1Integer.class)
+    };
+
+    public GeneralSubtree() {
+        super(fieldInfos);
+    }
+
+    public GeneralName getBase() {
+        return getFieldAs(BASE, GeneralName.class);
+    }
+
+    public void setBase(GeneralName base) {
+        setFieldAs(BASE, base);
+    }
+
+    public int getMinimum() {
+        return getFieldAsInteger(MINIMUM);
+    }
+
+    public void setMinimum(int minimum) {
+        setFieldAsInt(MINIMUM, minimum);
+    }
+
+    public int getMaximum() {
+        return getFieldAsInteger(MAXMUM);
+    }
+
+    public void setMaxmum(int maxmum) {
+        setFieldAsInt(MAXMUM, maxmum);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtrees.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtrees.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtrees.java
new file mode 100644
index 0000000..267d22d
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/GeneralSubtrees.java
@@ -0,0 +1,25 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+public class GeneralSubtrees extends Asn1SequenceOf<GeneralSubtree>{
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..abc8d45
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Holder.java
@@ -0,0 +1,78 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ * <pre>
+ *            Holder ::= SEQUENCE {
+ *                  baseCertificateID   [0] IssuerSerial OPTIONAL,
+ *                           -- the issuer and serial number of
+ *                           -- the holder's Public Key Certificate
+ *                  entityName          [1] GeneralNames OPTIONAL,
+ *                           -- the name of the claimant or role
+ *                  objectDigestInfo    [2] ObjectDigestInfo OPTIONAL
+ *                           -- used to directly authenticate the holder,
+ *                           -- for example, an executable
+ *            }
+ * </pre>
+ */
+public class Holder extends Asn1SequenceType {
+    private static final int BASE_CERTIFICATE_ID = 0;
+    private static final int ENTITY_NAME = 1;
+    private static final int OBJECT_DIGEST_INFO = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new ExplicitField(BASE_CERTIFICATE_ID, IssuerSerial.class),
+        new ExplicitField(ENTITY_NAME, GeneralNames.class),
+        new ExplicitField(OBJECT_DIGEST_INFO, ObjectDigestInfo.class)
+    };
+
+    public Holder() {
+        super(fieldInfos);
+    }
+
+    public IssuerSerial getBaseCertificateID() {
+        return getFieldAs(BASE_CERTIFICATE_ID, IssuerSerial.class);
+    }
+
+    public void setBaseCertificateId(IssuerSerial baseCertificateId) {
+        setFieldAs(BASE_CERTIFICATE_ID, baseCertificateId);
+    }
+
+    public GeneralNames getEntityName() {
+        return getFieldAs(ENTITY_NAME, GeneralNames.class);
+    }
+
+    public void setEntityName(GeneralNames entityName) {
+        setFieldAs(ENTITY_NAME, entityName);
+    }
+
+    public ObjectDigestInfo getObjectDigestInfo() {
+        return getFieldAs(OBJECT_DIGEST_INFO, ObjectDigestInfo.class);
+    }
+
+    public void setObjectDigestInfo(ObjectDigestInfo objectDigestInfo) {
+        setFieldAs(OBJECT_DIGEST_INFO, objectDigestInfo);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..ada014b
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntax.java
@@ -0,0 +1,69 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ * Ref. RFC3281
+ * <pre>
+ *
+ *  IetfAttrSyntax ::= SEQUENCE {
+ *    policyAuthority [0] GeneralNames OPTIONAL,
+ *    values SEQUENCE OF CHOICE {
+ *      octets OCTET STRING,
+ *      oid OBJECT IDENTIFIER,
+ *      string UTF8String
+ *    }
+ *  }
+ *
+ * </pre>
+ */
+public class IetfAttrSyntax extends Asn1SequenceType {
+    public static final int POLICY_AUTHORITY = 0;
+    public static final int VALUES = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new ExplicitField(POLICY_AUTHORITY, GeneralNames.class),
+        new Asn1FieldInfo(VALUES, IetfAttrSyntaxChoices.class)
+    };
+
+    public IetfAttrSyntax() {
+        super(fieldInfos);
+    }
+
+    public GeneralNames getPolicyAuthority() {
+        return getFieldAs(POLICY_AUTHORITY, GeneralNames.class);
+    }
+
+    public void setPolicyAuthority(GeneralNames policyAuthority) {
+        setFieldAs(POLICY_AUTHORITY, policyAuthority);
+    }
+
+    public IetfAttrSyntaxChoices getValues() {
+        return getFieldAs(VALUES, IetfAttrSyntaxChoices.class);
+    }
+
+    public void setValues(IetfAttrSyntaxChoices values) {
+        setFieldAs(VALUES, values);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/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
new file mode 100644
index 0000000..3a80dca
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntaxChoice.java
@@ -0,0 +1,78 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+
+/**
+ * Ref. RFC3281
+ * <pre>
+ *  IetfAttrSyntax ::= SEQUENCE {
+ *    policyAuthority [0] GeneralNames OPTIONAL,
+ *    values SEQUENCE OF CHOICE {
+ *      octets OCTET STRING,
+ *      oid OBJECT IDENTIFIER,
+ *      string UTF8String
+ *    }
+ *  }
+ * </pre>
+ */
+public class IetfAttrSyntaxChoice extends Asn1Choice {
+    public static final int OCTETS    = 1;
+    public static final int OID       = 2;
+    public static final int UTF8      = 3;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(OCTETS, Asn1OctetString.class),
+        new Asn1FieldInfo(OID, Asn1ObjectIdentifier.class),
+        new Asn1FieldInfo(UTF8, Asn1ObjectIdentifier.class)
+    };
+
+    public IetfAttrSyntaxChoice() {
+        super(fieldInfos);
+    }
+
+    public Asn1OctetString getOctets() {
+        return getFieldAs(OCTETS, Asn1OctetString.class);
+    }
+
+    public void setOctets(Asn1OctetString octets) {
+        setFieldAs(OCTETS, octets);
+    }
+
+    public Asn1ObjectIdentifier getOid() {
+        return getFieldAs(OID, Asn1ObjectIdentifier.class);
+    }
+
+    public void setOid(Asn1ObjectIdentifier oid) {
+        setFieldAs(OID, oid);
+    }
+
+    public Asn1ObjectIdentifier getUtf8() {
+        return getFieldAs(UTF8, Asn1ObjectIdentifier.class);
+    }
+
+    public void setUtf8(Asn1ObjectIdentifier utf8) {
+        setFieldAs(UTF8, utf8);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntaxChoices.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntaxChoices.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntaxChoices.java
new file mode 100644
index 0000000..04dd22e
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IetfAttrSyntaxChoices.java
@@ -0,0 +1,26 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+public class IetfAttrSyntaxChoices extends Asn1SequenceOf<IetfAttrSyntaxChoice> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IssuerSerial.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IssuerSerial.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IssuerSerial.java
new file mode 100644
index 0000000..999ae11
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IssuerSerial.java
@@ -0,0 +1,73 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * <pre>
+ *  IssuerSerial  ::=  SEQUENCE {
+ *       issuer         GeneralNames,
+ *       serial         CertificateSerialNumber,
+ *       issuerUID      UniqueIdentifier OPTIONAL
+ *  }
+ * </pre>
+ */
+public class IssuerSerial extends Asn1SequenceType {
+    private static final int ISSUER = 0;
+    private static final int SERIAL = 1;
+    private static final int ISSUER_UID = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(ISSUER, GeneralNames.class),
+        new Asn1FieldInfo(SERIAL, CertificateSerialNumber.class),
+        new Asn1FieldInfo(ISSUER_UID, Asn1BitString.class)
+    };
+
+    public IssuerSerial() {
+        super(fieldInfos);
+    }
+
+    public GeneralNames getIssuer() {
+        return getFieldAs(ISSUER, GeneralNames.class);
+    }
+
+    public void setIssuer(GeneralNames issuer) {
+        setFieldAs(ISSUER, issuer);
+    }
+
+    public CertificateSerialNumber getSerial() {
+        return getFieldAs(SERIAL, CertificateSerialNumber.class);
+    }
+
+    public void setSerial(CertificateSerialNumber serial) {
+        setFieldAs(SERIAL, serial);
+    }
+
+    public Asn1BitString getIssuerUID() {
+        return getFieldAs(ISSUER_UID, Asn1BitString.class);
+    }
+
+    public void setIssuerUID(Asn1BitString issuerUID) {
+        setFieldAs(ISSUER_UID, issuerUID);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IssuingDistributionPoint.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IssuingDistributionPoint.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IssuingDistributionPoint.java
new file mode 100644
index 0000000..f2c724b
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/IssuingDistributionPoint.java
@@ -0,0 +1,107 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Boolean;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ * <pre>
+ * IssuingDistributionPoint ::= SEQUENCE { 
+ *   distributionPoint          [0] DistributionPointName OPTIONAL, 
+ *   onlyContainsUserCerts      [1] BOOLEAN DEFAULT FALSE, 
+ *   onlyContainsCACerts        [2] BOOLEAN DEFAULT FALSE, 
+ *   onlySomeReasons            [3] ReasonFlags OPTIONAL, 
+ *   indirectCRL                [4] BOOLEAN DEFAULT FALSE,
+ *   onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE
+ * }
+ * </pre>
+ */
+public class IssuingDistributionPoint extends Asn1SequenceType {
+    private static final int DISTRIBUTION_POINT = 0;
+    private static final int ONLY_CONTAINS_USER_CERTS = 1;
+    private static final int ONLY_CONTAINS_CA_CERTS = 2;
+    private static final int ONLY_SOME_REASONS = 3;
+    private static final int INDIRECT_CRL = 4;
+    private static final int ONLY_CONTAINS_ATTRIBUTE_CERTS = 5;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new ExplicitField(DISTRIBUTION_POINT, DistributionPointName.class),
+        new ExplicitField(ONLY_CONTAINS_USER_CERTS, Asn1Boolean.class),
+        new ExplicitField(ONLY_CONTAINS_CA_CERTS, Asn1Boolean.class),
+        new ExplicitField(ONLY_SOME_REASONS, ReasonFlags.class),
+        new ExplicitField(INDIRECT_CRL, Asn1Boolean.class),
+        new ExplicitField(ONLY_CONTAINS_ATTRIBUTE_CERTS, Asn1Boolean.class)
+    };
+
+    public IssuingDistributionPoint() {
+        super(fieldInfos);
+    }
+
+    public DistributionPointName getDistributionPoint() {
+        return getFieldAs(DISTRIBUTION_POINT, DistributionPointName.class);
+    }
+
+    public void setDistributionPoint(DistributionPointName distributionPoint) {
+        setFieldAs(DISTRIBUTION_POINT, distributionPoint);
+    }
+
+    public boolean getOnlyContainsUserCerts() {
+        return getFieldAs(ONLY_CONTAINS_USER_CERTS, Asn1Boolean.class).getValue();
+    }
+
+    public void setOnlyContainsUserCerts(boolean onlyContainsUserCerts) {
+        setFieldAs(ONLY_CONTAINS_USER_CERTS, new Asn1Boolean(onlyContainsUserCerts));
+    }
+
+    public boolean getOnlyContainsCACerts() {
+        return getFieldAs(ONLY_CONTAINS_CA_CERTS, Asn1Boolean.class).getValue();
+    }
+
+    public void setOnlyContainsCaCerts(boolean onlyContainsCaCerts) {
+        setFieldAs(ONLY_CONTAINS_CA_CERTS, new Asn1Boolean(onlyContainsCaCerts));
+    }
+
+    public ReasonFlags getOnlySomeReasons() {
+        return getFieldAs(ONLY_SOME_REASONS, ReasonFlags.class);
+    }
+
+    public void setOnlySomeReasons(ReasonFlags onlySomeReasons) {
+        setFieldAs(ONLY_SOME_REASONS, onlySomeReasons);
+    }
+
+    public boolean getIndirectCRL() {
+        return getFieldAs(INDIRECT_CRL, Asn1Boolean.class).getValue();
+    }
+
+    public void setIndirectCrl(boolean indirectCrl) {
+        setFieldAs(INDIRECT_CRL, new Asn1Boolean(indirectCrl));
+    }
+
+    public boolean getOnlyContainsAttributeCerts() {
+        return getFieldAs(ONLY_CONTAINS_ATTRIBUTE_CERTS, Asn1Boolean.class).getValue();
+    }
+
+    public void setOnlyContainsAttributeCerts(boolean onlyContainsAttributeCerts) {
+        setFieldAs(ONLY_CONTAINS_ATTRIBUTE_CERTS, new Asn1Boolean(onlyContainsAttributeCerts));
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/KeyIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/KeyIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/KeyIdentifier.java
new file mode 100644
index 0000000..52f6d09
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/KeyIdentifier.java
@@ -0,0 +1,32 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1OctetString;
+
+/**
+ *
+ * <pre>
+ *   KeyIdentifier ::= OCTET STRING
+ * </pre>
+ *
+ */
+public class KeyIdentifier extends Asn1OctetString {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/KeyPurposeId.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/KeyPurposeId.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/KeyPurposeId.java
new file mode 100644
index 0000000..a0e1424
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/KeyPurposeId.java
@@ -0,0 +1,36 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+
+/**
+ *
+ * <pre>
+ *     KeyPurposeId ::= OBJECT IDENTIFIER
+ *
+ *     id-kp ::= OBJECT IDENTIFIER { iso(1) identified-organization(3) 
+ *          dod(6) internet(1) security(5) mechanisms(5) pkix(7) 3}
+ *
+ * </pre>
+ */
+public class KeyPurposeId extends Asn1ObjectIdentifier {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/KeyUsage.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/KeyUsage.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/KeyUsage.java
new file mode 100644
index 0000000..bbded47
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/KeyUsage.java
@@ -0,0 +1,62 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1EnumType;
+import org.apache.kerby.asn1.type.Asn1Flags;
+
+/**
+ * The KeyUsage object.
+ * <pre>
+ *    id-ce-keyUsage OBJECT IDENTIFIER ::=  { id-ce 15 }
+ *
+ *    KeyUsage ::= BIT STRING {
+ *         digitalSignature        (0),
+ *         nonRepudiation          (1),
+ *         keyEncipherment         (2),
+ *         dataEncipherment        (3),
+ *         keyAgreement            (4),
+ *         keyCertSign             (5),
+ *         cRLSign                 (6),
+ *         encipherOnly            (7),
+ *         decipherOnly            (8) }
+ * </pre>
+ */
+
+enum KeyUsageEnum implements Asn1EnumType {
+    DIGITAL_SIGNATURE,
+    NON_REPUDIATION,
+    KEY_ENCIPHERMENT,
+    DATA_ENCIPHERMENT,
+    KEY_AGREEMENT,
+    KEY_CERT_SIGN,
+    CRL_SIGN,
+    ENCIPHER_ONLY,
+    DECIPHER_ONLY;
+
+    @Override
+    public int getValue() {
+        return ordinal();
+    }
+}
+
+public class KeyUsage extends Asn1Flags {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/NameConstraints.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/NameConstraints.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/NameConstraints.java
new file mode 100644
index 0000000..8d12f42
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/NameConstraints.java
@@ -0,0 +1,60 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/*
+ * NameConstraints ::= SEQUENCE {
+ *     permittedSubtrees [0] GeneralSubtrees OPTIONAL,
+ *     excludedSubtrees [1] GeneralSubtrees OPTIONAL
+ * }
+ */
+public class NameConstraints extends Asn1SequenceType {
+    private static final int PERMITTED_SUBTREES = 0;
+    private static final int EXCLUDED_SUBTREES = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new ExplicitField(PERMITTED_SUBTREES, GeneralSubtrees.class),
+        new ExplicitField(EXCLUDED_SUBTREES, GeneralSubtrees.class)
+    };
+
+    public NameConstraints() {
+        super(fieldInfos);
+    }
+
+    public GeneralSubtrees getPermittedSubtrees() {
+        return getFieldAs(PERMITTED_SUBTREES, GeneralSubtrees.class);
+    }
+
+    public void setPermittedSubtrees(GeneralSubtrees permittedSubtrees) {
+        setFieldAs(PERMITTED_SUBTREES, permittedSubtrees);
+    }
+
+    public GeneralSubtrees getExcludedSubtrees() {
+        return getFieldAs(EXCLUDED_SUBTREES, GeneralSubtrees.class);
+    }
+
+    public void setExcludedSubtrees(GeneralSubtrees excludedSubtrees) {
+        setFieldAs(EXCLUDED_SUBTREES, excludedSubtrees);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/NoticeNumbers.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/NoticeNumbers.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/NoticeNumbers.java
new file mode 100644
index 0000000..798e905
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/NoticeNumbers.java
@@ -0,0 +1,31 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+/**
+ * <pre>
+ *  noticeNumbers ::=   SEQUENCE OF INTEGER }
+ * </pre>
+ */
+public class NoticeNumbers extends Asn1SequenceOf<Asn1Integer> {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/NoticeReference.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/NoticeReference.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/NoticeReference.java
new file mode 100644
index 0000000..a64ef07
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/NoticeReference.java
@@ -0,0 +1,63 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * <pre>
+ *  NoticeReference ::= SEQUENCE {
+ *      organization     DisplayText,
+ *      noticeNumbers    SEQUENCE OF INTEGER
+ *  }
+ *
+ * </pre> 
+ *
+ */
+public class NoticeReference extends Asn1SequenceType {
+    private static final int ORGANIZATION = 0;
+    private static final int NOTICE_NUMBERS = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(ORGANIZATION, DisplayText.class),
+        new Asn1FieldInfo(NOTICE_NUMBERS, NoticeNumbers.class)
+    };
+
+    public NoticeReference() {
+        super(fieldInfos);
+    }
+
+    public DisplayText getOrganization() {
+        return getFieldAs(ORGANIZATION, DisplayText.class);
+    }
+
+    public void setOrganization(DisplayText organization) {
+        setFieldAs(ORGANIZATION, organization);
+    }
+
+    public NoticeNumbers getNoticeNumbers() {
+        return getFieldAs(NOTICE_NUMBERS, NoticeNumbers.class);
+    }
+
+    public void setNoticeNumbers(NoticeNumbers noticeNumbers) {
+        setFieldAs(NOTICE_NUMBERS, noticeNumbers);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/ObjectDigestInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/ObjectDigestInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/ObjectDigestInfo.java
new file mode 100644
index 0000000..f6b7c5f
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/ObjectDigestInfo.java
@@ -0,0 +1,93 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ *
+ * <pre>
+ *    ObjectDigestInfo ::= SEQUENCE {
+ *         digestedObjectType  ENUMERATED {
+ *                 publicKey            (0),
+ *                 publicKeyCert        (1),
+ *                 otherObjectTypes     (2) },
+ *                         -- otherObjectTypes MUST NOT
+ *                         -- be used in this profile
+ *         otherObjectTypeID   OBJECT IDENTIFIER OPTIONAL,
+ *         digestAlgorithm     AlgorithmIdentifier,
+ *         objectDigest        BIT STRING
+ *    }
+ *   
+ * </pre>
+ * 
+ */
+public class ObjectDigestInfo extends Asn1SequenceType {
+    private static final int DIGESTED_OBJECT_TYPE = 0;
+    private static final int OTHER_OBJECT_TYPE_ID = 1;
+    private static final int DIGEST_ALGORITHM = 2;
+    private static final int OBJECT_DIGEST = 3;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(DIGESTED_OBJECT_TYPE, DigestedObjectType.class),
+        new Asn1FieldInfo(OTHER_OBJECT_TYPE_ID, Asn1ObjectIdentifier.class),
+        new Asn1FieldInfo(DIGEST_ALGORITHM, AlgorithmIdentifier.class),
+        new Asn1FieldInfo(OBJECT_DIGEST, Asn1BitString.class)
+    };
+
+    public ObjectDigestInfo() {
+        super(fieldInfos);
+    }
+
+    public DigestedObjectType getDigestedObjectType() {
+        return getFieldAs(DIGESTED_OBJECT_TYPE, DigestedObjectType.class);
+    }
+
+    public void setDigestedObjectType(DigestedObjectType digestedObjectType) {
+        setFieldAs(DIGESTED_OBJECT_TYPE, digestedObjectType);
+    }
+
+    public Asn1ObjectIdentifier getOtherObjectTypeID() {
+        return getFieldAs(OTHER_OBJECT_TYPE_ID, Asn1ObjectIdentifier.class);
+    }
+
+    public void setOtherObjectTypeId(Asn1ObjectIdentifier otherObjectTypeID) {
+        setFieldAs(OTHER_OBJECT_TYPE_ID, otherObjectTypeID);
+    }
+
+    public AlgorithmIdentifier getDigestAlgorithm() {
+        return getFieldAs(DIGEST_ALGORITHM, AlgorithmIdentifier.class);
+    }
+
+    public void setDigestAlgorithm(AlgorithmIdentifier digestAlgorithm) {
+        setFieldAs(DIGEST_ALGORITHM, digestAlgorithm);
+    }
+
+    public Asn1BitString getObjectDigest() {
+        return getFieldAs(OBJECT_DIGEST, Asn1BitString.class);
+    }
+
+    public void setObjectDigest(Asn1BitString objectDigest) {
+        setFieldAs(OBJECT_DIGEST, objectDigest);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/OtherName.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/OtherName.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/OtherName.java
new file mode 100644
index 0000000..d2f11ab
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/OtherName.java
@@ -0,0 +1,66 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Any;
+import org.apache.kerby.asn1.type.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.type.ExplicitField;
+
+/**
+ * <pre>
+ * OtherName ::= SEQUENCE {
+ *      type-id    OBJECT IDENTIFIER,
+ *      value      [0] EXPLICIT ANY DEFINED BY type-id
+ * }
+ *
+ * </pre>
+ */
+public class OtherName extends Asn1SequenceType {
+    private static final int TYPE_ID = 0;
+    private static final int VALUE = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(TYPE_ID, Asn1ObjectIdentifier.class),
+            new ExplicitField(VALUE, 0, Asn1Any.class)
+    };
+
+    public OtherName() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getTypeId() {
+        return getFieldAs(TYPE_ID, Asn1ObjectIdentifier.class);
+    }
+
+    public void setTypeId(Asn1ObjectIdentifier algorithm) {
+        setFieldAs(TYPE_ID, algorithm);
+    }
+
+    public Asn1Type getOtherNameValue() {
+        return getFieldAsAny(VALUE);
+    }
+
+    public void setOtherNameValue(Asn1Type value) {
+        setFieldAsAny(VALUE, value);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyConstraints.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyConstraints.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyConstraints.java
new file mode 100644
index 0000000..874f99f
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyConstraints.java
@@ -0,0 +1,67 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ * Ref. RFC 5280
+ * <pre>
+ * id-ce-policyConstraints OBJECT IDENTIFIER ::=  { id-ce 36 }
+ *
+ * PolicyConstraints ::= SEQUENCE {
+ *      requireExplicitPolicy           [0] SkipCerts OPTIONAL,
+ *      inhibitPolicyMapping            [1] SkipCerts OPTIONAL }
+ *
+ * SkipCerts ::= INTEGER (0..MAX)
+ * </pre>
+ */
+public class PolicyConstraints extends Asn1SequenceType {
+    private static final int REQUIRE_EXPLICIT_POLICY = 0;
+    private static final int INHIBIT_POLICY_MAPPING = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new ExplicitField(REQUIRE_EXPLICIT_POLICY, Asn1Integer.class),
+        new ExplicitField(INHIBIT_POLICY_MAPPING, Asn1Integer.class)
+    };
+
+    public PolicyConstraints() {
+        super(fieldInfos);
+    }
+
+    public Asn1Integer getRequireExplicitPolicy() {
+        return getFieldAs(REQUIRE_EXPLICIT_POLICY, Asn1Integer.class);
+    }
+
+    public void setRequireExplicitPolicy(Asn1Integer requireExplicitPolicy) {
+        setFieldAs(REQUIRE_EXPLICIT_POLICY, requireExplicitPolicy);
+    }
+
+    public Asn1Integer getInhibitPolicyMapping() {
+        return getFieldAs(INHIBIT_POLICY_MAPPING, Asn1Integer.class);
+    }
+
+    public void setInhibitPolicyMapping(Asn1Integer inhibitPolicyMapping) {
+        setFieldAs(INHIBIT_POLICY_MAPPING, inhibitPolicyMapping);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyInformation.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyInformation.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyInformation.java
new file mode 100644
index 0000000..481eb2e
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyInformation.java
@@ -0,0 +1,61 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/*
+ * <pre>
+ * PolicyInformation ::= SEQUENCE {
+ *      policyIdentifier   CertPolicyId,
+ *      policyQualifiers   SEQUENCE SIZE (1..MAX) OF
+ *              PolicyQualifierInfo OPTIONAL }
+ * </pre>
+ */
+public class PolicyInformation extends Asn1SequenceType {
+    private static final int POLICY_IDENTIFIER = 0;
+    private static final int POLICY_QUALIFIERS = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(POLICY_IDENTIFIER, CertPolicyId.class),
+        new Asn1FieldInfo(POLICY_QUALIFIERS, PolicyQualifierInfos.class)
+    };
+
+    public PolicyInformation() {
+        super(fieldInfos);
+    }
+
+    public CertPolicyId getPolicyIdentifier() {
+        return getFieldAs(POLICY_IDENTIFIER, CertPolicyId.class);
+    }
+
+    public void setPolicyIdentifier(CertPolicyId policyIdentifier) {
+        setFieldAs(POLICY_IDENTIFIER, policyIdentifier);
+    }
+    
+    public PolicyQualifierInfos getPolicyQualifiers() {
+        return getFieldAs(POLICY_QUALIFIERS, PolicyQualifierInfos.class);
+    }
+
+    public void setPolicyQualifiers(PolicyQualifierInfos policyQualifiers) {
+        setFieldAs(POLICY_QUALIFIERS, policyQualifiers);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyMapping.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyMapping.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyMapping.java
new file mode 100644
index 0000000..aa764d5
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyMapping.java
@@ -0,0 +1,62 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * Ref. RFC3280
+ * <pre>
+ *    PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE {
+ *      issuerDomainPolicy      CertPolicyId,
+ *      subjectDomainPolicy     CertPolicyId }
+ * </pre>
+ *
+ */
+public class PolicyMapping extends Asn1SequenceType {
+    private static final int ISSUER_DOMAIN_POLICY = 0;
+    private static final int SUBJECT_DOMAIN_POLICY = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(ISSUER_DOMAIN_POLICY, CertPolicyId.class),
+        new Asn1FieldInfo(SUBJECT_DOMAIN_POLICY, CertPolicyId.class)
+    };
+
+    public PolicyMapping() {
+        super(fieldInfos);
+    }
+
+    public CertPolicyId getIssuerDomainPolicy() {
+        return  getFieldAs(ISSUER_DOMAIN_POLICY, CertPolicyId.class);
+    }
+
+    public void setIssuerDomainPolicy(CertPolicyId issuerDomainPolicy) {
+        setFieldAs(ISSUER_DOMAIN_POLICY, issuerDomainPolicy);
+    }
+
+    public CertPolicyId getSubjectDomainPolicy() {
+        return getFieldAs(SUBJECT_DOMAIN_POLICY, CertPolicyId.class);
+    }
+
+    public void setSubjectDomainPolicy(CertPolicyId subjectDomainPolicy) {
+        setFieldAs(SUBJECT_DOMAIN_POLICY, subjectDomainPolicy);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyMappings.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyMappings.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyMappings.java
new file mode 100644
index 0000000..15f1a3b
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyMappings.java
@@ -0,0 +1,34 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+/**
+ * Ref. RFC3280.
+ * <pre>
+ *    PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE {
+ *      issuerDomainPolicy      CertPolicyId,
+ *      subjectDomainPolicy     CertPolicyId }
+ * </pre>
+ */
+public class PolicyMappings extends Asn1SequenceOf<PolicyMapping> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierId.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierId.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierId.java
new file mode 100644
index 0000000..b8895ef
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierId.java
@@ -0,0 +1,46 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+
+/**
+ * <pre>
+ *    id-qt          OBJECT IDENTIFIER ::=  { id-pkix 2 }
+ *    id-qt-cps      OBJECT IDENTIFIER ::=  { id-qt 1 }
+ *    id-qt-unotice  OBJECT IDENTIFIER ::=  { id-qt 2 }
+ *  PolicyQualifierId ::=
+ *       OBJECT IDENTIFIER (id-qt-cps | id-qt-unotice)
+ * </pre>
+ */
+public class PolicyQualifierId extends Asn1ObjectIdentifier
+{
+   private static final String id_qt = "1.3.6.1.5.5.7.2";
+
+   private PolicyQualifierId(String id) 
+      {
+         super(id);
+      }
+   
+   public static final PolicyQualifierId id_qt_cps =
+       new PolicyQualifierId(id_qt + ".1");
+   public static final PolicyQualifierId id_qt_unotice =
+       new PolicyQualifierId(id_qt + ".2");
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierInfo.java
new file mode 100644
index 0000000..16832a7
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierInfo.java
@@ -0,0 +1,66 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Any;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.Asn1Type;
+
+/**
+ * 
+ * <pre>
+ *   PolicyQualifierInfo ::= SEQUENCE {
+ *       policyQualifierId  PolicyQualifierId,
+ *       qualifier          ANY DEFINED BY policyQualifierId
+ *   }
+ *
+ *  PolicyQualifierId ::= OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice )
+ * </pre>
+ */
+public class PolicyQualifierInfo extends Asn1SequenceType {
+    private static final int POLICY_QUALIFIER_ID = 0;
+    private static final int QUALIFIER = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(POLICY_QUALIFIER_ID, PolicyQualifierId.class),
+        new Asn1FieldInfo(QUALIFIER, Asn1Any.class)
+    };
+
+    public PolicyQualifierInfo() {
+        super(fieldInfos);
+    }
+
+    public PolicyQualifierId getPolicyQualifierId() {
+        return getFieldAs(POLICY_QUALIFIER_ID, PolicyQualifierId.class);
+    }
+
+    public void setPolicyQualifierId(PolicyQualifierId policyQualifierId) {
+        setFieldAs(POLICY_QUALIFIER_ID, policyQualifierId);
+    }
+
+    public Asn1Type getQualifier() {
+        return getFieldAsAny(QUALIFIER);
+    }
+
+    public void setQualifier(Asn1Type qualifier) {
+        setFieldAsAny(QUALIFIER, qualifier);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierInfos.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierInfos.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierInfos.java
new file mode 100644
index 0000000..f6e1695
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PolicyQualifierInfos.java
@@ -0,0 +1,31 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+/*
+ * <pre>
+ *      policyQualifiers   SEQUENCE SIZE (1..MAX) OF
+ *              PolicyQualifierInfo OPTIONAL
+ * </pre>
+ */
+public class PolicyQualifierInfos extends Asn1SequenceOf<PolicyQualifierInfo> {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PrivateKeyUsagePeriod.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PrivateKeyUsagePeriod.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PrivateKeyUsagePeriod.java
new file mode 100644
index 0000000..86b6b83
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/PrivateKeyUsagePeriod.java
@@ -0,0 +1,63 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1GeneralizedTime;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ * <pre>
+ *    PrivateKeyUsagePeriod ::= SEQUENCE {
+ *      notBefore       [0]     GeneralizedTime OPTIONAL,
+ *      notAfter        [1]     GeneralizedTime OPTIONAL
+ *    }
+ * </pre>
+ */
+public class PrivateKeyUsagePeriod extends Asn1SequenceType {
+    private static final int NOT_BEFORE = 0;
+    private static final int NOT_AFTER = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new ExplicitField(NOT_BEFORE, Asn1GeneralizedTime.class),
+        new ExplicitField(NOT_AFTER, Asn1GeneralizedTime.class)
+    };
+
+    public PrivateKeyUsagePeriod() {
+        super(fieldInfos);
+    }
+
+    public Asn1GeneralizedTime getNotBeforeTime() {
+        return getFieldAs(NOT_BEFORE, Asn1GeneralizedTime.class);
+    }
+
+    public void setNotBeforeTime(Asn1GeneralizedTime notBeforeTime) {
+        setFieldAs(NOT_BEFORE, notBeforeTime);
+    }
+
+    public Asn1GeneralizedTime getNotAfterTime() {
+        return getFieldAs(NOT_AFTER, Asn1GeneralizedTime.class);
+    }
+
+    public void setNotAfterTime(Asn1GeneralizedTime notAfterTime) {
+        setFieldAs(NOT_AFTER, notAfterTime);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/ReasonFlags.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/ReasonFlags.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/ReasonFlags.java
new file mode 100644
index 0000000..c397f08
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/ReasonFlags.java
@@ -0,0 +1,61 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1EnumType;
+import org.apache.kerby.asn1.type.Asn1Flags;
+
+/**
+ *
+ * <pre>
+ * ReasonFlags ::= BIT STRING {
+ *      unused                  (0),
+ *      keyCompromise           (1),
+ *      cACompromise            (2),
+ *      affiliationChanged      (3),
+ *      superseded              (4),
+ *      cessationOfOperation    (5),
+ *      certificateHold         (6),
+ *      privilegeWithdrawn      (7),
+ *      aACompromise            (8)
+ * }
+ * </pre>
+ */
+
+enum ReasonFlagsEnum implements Asn1EnumType {
+    UNUSED,
+    KEY_COMPROMISE,
+    CA_COMPROMISE,
+    AFFILIATION_CHANGED,
+    SUPERSEDED,
+    CESSATION_OF_OPERATION,
+    CERTIFICATE_HOLD,
+    PRIVILEGE_WITH_DRAWN,
+    AA_COMPROMISE;
+
+    @Override
+    public int getValue() {
+        return ordinal();
+    }
+}
+
+public class ReasonFlags extends Asn1Flags {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/RevokedCertificate.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/RevokedCertificate.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/RevokedCertificate.java
new file mode 100644
index 0000000..034e418
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/RevokedCertificate.java
@@ -0,0 +1,75 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * Ref. RFC 2459
+ *
+ * <pre>
+ * SEQUENCE  {
+ *   userCertificate         CertificateSerialNumber,
+ *   revocationDate          Time,
+ *   crlEntryExtensions      Extensions OPTIONAL
+ *                                 -- if present, shall be v2
+ * }
+ * </pre>
+ */
+public class RevokedCertificate extends Asn1SequenceType {
+    private static final int USER_CERTIFICATE = 0;
+    private static final int REVOCATION_DATA = 1;
+    private static final int CRL_ENTRY_EXTENSIONS = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(USER_CERTIFICATE, CertificateSerialNumber.class),
+        new Asn1FieldInfo(REVOCATION_DATA, Time.class),
+        new Asn1FieldInfo(CRL_ENTRY_EXTENSIONS, Extensions.class)
+    };
+
+    public RevokedCertificate() {
+        super(fieldInfos);
+    }
+
+    public CertificateSerialNumber getUserCertificate() {
+        return getFieldAs(USER_CERTIFICATE, CertificateSerialNumber.class);
+    }
+
+    public void setUserCertificate(CertificateSerialNumber userCertificate) {
+        setFieldAs(USER_CERTIFICATE, userCertificate);
+    }
+
+    public Time getRevocationDate() {
+        return getFieldAs(REVOCATION_DATA, Time.class);
+    }
+
+    public void setRevocationData(Time revocationData) {
+        setFieldAs(REVOCATION_DATA, revocationData);
+    }
+
+    public Extensions getCrlEntryExtensions() {
+        return getFieldAs(CRL_ENTRY_EXTENSIONS, Extensions.class);
+    }
+
+    public void setCrlEntryExtensions(Extensions crlEntryExtensions) {
+        setFieldAs(CRL_ENTRY_EXTENSIONS, crlEntryExtensions);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/RevokedCertificates.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/RevokedCertificates.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/RevokedCertificates.java
new file mode 100644
index 0000000..ba12886
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/RevokedCertificates.java
@@ -0,0 +1,38 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+/**
+ * Ref. RFC-2459
+ * <pre>
+ *   revokedCertificates     SEQUENCE OF SEQUENCE  {
+ *     userCertificate         CertificateSerialNumber,
+ *     revocationDate          Time,
+ *     crlEntryExtensions      Extensions OPTIONAL
+ *                            -- if present, shall be v2
+ *  }
+ *
+ * </pre>
+ */
+public class RevokedCertificates extends Asn1SequenceOf<RevokedCertificate> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/RoleSyntax.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/RoleSyntax.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/RoleSyntax.java
new file mode 100644
index 0000000..712b33f
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/RoleSyntax.java
@@ -0,0 +1,63 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ *Ref. RFC3281
+ * <pre>
+ * RoleSyntax ::= SEQUENCE {
+ *                 roleAuthority  [0] GeneralNames OPTIONAL,
+ *                 roleName       [1] GeneralName
+ *           } 
+ * </pre>
+ */
+public class RoleSyntax extends Asn1SequenceType {
+    private static final int ROLE_AUTHORITY = 0;
+    private static final int ROLE_NAME = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new ExplicitField(ROLE_AUTHORITY, GeneralNames.class),
+        new ExplicitField(ROLE_NAME, GeneralName.class)
+    };
+
+    public RoleSyntax() {
+        super(fieldInfos);
+    }
+
+    public GeneralNames getRoleAuthority() {
+        return getFieldAs(ROLE_AUTHORITY, GeneralNames.class);
+    }
+
+    public void setRoleAuthority(GeneralNames roleAuthority) {
+        setFieldAs(ROLE_AUTHORITY, roleAuthority);
+    }
+
+    public GeneralName getRoleName() {
+        return getFieldAs(ROLE_NAME, GeneralName.class);
+    }
+
+    public void setRoleName(GeneralName roleName) {
+        setFieldAs(ROLE_NAME, roleName);
+    }
+}


[10/17] directory-kerby git commit: DIRKRB-476 Added enumerated type

Posted by pl...@apache.org.
DIRKRB-476 Added enumerated type


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/0cac1821
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/0cac1821
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/0cac1821

Branch: refs/heads/pkinit-support
Commit: 0cac18217d39697a804c00d7da49b19e5fe01af2
Parents: 4d4be89
Author: Kai Zheng <ka...@intel.com>
Authored: Fri Nov 27 13:38:32 2015 +0800
Committer: Kai Zheng <ka...@intel.com>
Committed: Fri Nov 27 13:38:32 2015 +0800

----------------------------------------------------------------------
 .../org/apache/kerby/asn1/UniversalTag.java     |  1 +
 .../org/apache/kerby/asn1/type/Asn1Any.java     | 39 +++++++++++-
 .../apache/kerby/asn1/type/Asn1Enumerated.java  | 64 ++++++++++++++++++++
 3 files changed, 101 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/0cac1821/kerby-asn1/src/main/java/org/apache/kerby/asn1/UniversalTag.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/UniversalTag.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/UniversalTag.java
index 7bc1868..e78b50e 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/UniversalTag.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/UniversalTag.java
@@ -27,6 +27,7 @@ package org.apache.kerby.asn1;
 public enum UniversalTag {
     UNKNOWN             (-1),
     CHOICE              (-2),   // Only for internal using
+    ANY                 (-3),   // Only for internal using
     BER_UNDEFINED_LENGTH(0),    // Used to encode undefined length with BER
     BOOLEAN             (0x01),
     INTEGER             (0x02),

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/0cac1821/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java
index e73315d..b04b4e1 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Any.java
@@ -20,14 +20,39 @@
 package org.apache.kerby.asn1.type;
 
 import org.apache.kerby.asn1.LimitedByteBuffer;
+import org.apache.kerby.asn1.TagClass;
+import org.apache.kerby.asn1.UniversalTag;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
+/**
+ * Can be any valid ASN-1 ojbect, limited or not limited.
+ *
+ * WARNING!!!!
+ * Note, this is far from complete, as most of parent methods are to override.
+ */
 public class Asn1Any extends AbstractAsn1Type<Asn1Type> {
+    private Asn1Type field;
+
+    public Asn1Any() {
+        super(TagClass.UNIVERSAL, UniversalTag.ANY.getValue());
+    }
 
+    // For encoding phase.
     public Asn1Any(Asn1Type anyValue) {
-        super(anyValue.tagFlags(), anyValue.tagNo(), anyValue);
+        this();
+        setValue(anyValue);
+    }
+
+    // For decoding phase, value may be an Asn1Item, not fully decoded.
+    public void setItem(Asn1Type value) {
+        this.field = value;
+    }
+
+    // For decoding phase.
+    public Asn1Type getItem() {
+        return field;
     }
 
     @Override
@@ -40,8 +65,16 @@ public class Asn1Any extends AbstractAsn1Type<Asn1Type> {
         ((AbstractAsn1Type<?>) getValue()).encodeBody(buffer);
     }
 
-    @Override
     protected void decodeBody(LimitedByteBuffer content) throws IOException {
-        ((AbstractAsn1Type<?>) getValue()).decodeBody(content);
+        // Not used
+    }
+
+    // Available for encoding phase.
+    protected <T extends Asn1Type> T getValueAs(Class<T> t) {
+        Asn1Type value = getValue();
+        if (value == null) {
+            return null;
+        }
+        return (T) value;
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/0cac1821/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Enumerated.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Enumerated.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Enumerated.java
new file mode 100644
index 0000000..8dc4b4a
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Enumerated.java
@@ -0,0 +1,64 @@
+/**
+ *  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.asn1.type;
+
+import org.apache.kerby.asn1.UniversalTag;
+
+import java.io.IOException;
+import java.math.BigInteger;
+
+/**
+ * The ASN1 enumerated type
+ */
+public abstract class Asn1Enumerated<T extends Asn1EnumType> extends Asn1Simple<T> {
+
+    /**
+     * Default constructor, generally for decoding as a container
+     */
+    public Asn1Enumerated() {
+        this(null);
+    }
+
+    /**
+     * Constructor with a value, generally for encoding of the value
+     * @param value The boolean value
+     */
+    public Asn1Enumerated(T value) {
+        super(UniversalTag.ENUMERATED, value);
+    }
+
+    protected void toBytes() {
+        BigInteger biValue = BigInteger.valueOf(getValue().getValue());
+        setBytes(biValue.toByteArray());
+    }
+
+    protected void toValue() throws IOException {
+        BigInteger biVal = new BigInteger(getBytes());
+        int iVal = biVal.intValue();
+        Asn1EnumType[] allValues = getAllEnumValues();
+        for (Asn1EnumType val : allValues) {
+            if (val.getValue() == iVal) {
+                setValue((T) val);
+            }
+        }
+    }
+
+    protected abstract Asn1EnumType[] getAllEnumValues();
+}


[11/17] directory-kerby git commit: DIRKRB-473. Initially added X509 ASN1 types

Posted by pl...@apache.org.
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/SubjectDirectoryAttributes.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/SubjectDirectoryAttributes.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/SubjectDirectoryAttributes.java
new file mode 100644
index 0000000..9ad8ff8
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/SubjectDirectoryAttributes.java
@@ -0,0 +1,39 @@
+/**
+ *  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.x509.type;
+
+/**
+ * Ref. RFC 3039
+ * <pre>
+ *     SubjectDirectoryAttributes ::= Attributes
+ *     Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
+ *     Attribute ::= SEQUENCE {
+ *       type AttributeType 
+ *       values SET OF AttributeValue 
+ *     }
+ *     
+ *     AttributeType ::= OBJECT IDENTIFIER
+ *     AttributeValue ::= ANY DEFINED BY AttributeType
+ * </pre>
+ *
+ */
+public class SubjectDirectoryAttributes extends Attributes {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/SubjectKeyIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/SubjectKeyIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/SubjectKeyIdentifier.java
new file mode 100644
index 0000000..e70882d
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/SubjectKeyIdentifier.java
@@ -0,0 +1,32 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1OctetString;
+
+/**
+ *
+ * <pre>
+ *   SubjectKeyIdentifier::= OCTET STRING
+ * </pre>
+ */
+public class SubjectKeyIdentifier extends Asn1OctetString {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/SubjectPublicKeyInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/SubjectPublicKeyInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/SubjectPublicKeyInfo.java
new file mode 100644
index 0000000..d904e63
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/SubjectPublicKeyInfo.java
@@ -0,0 +1,60 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * SubjectPublicKeyInfo  ::=  SEQUENCE  {
+ *    algorithm            AlgorithmIdentifier,
+ *    subjectPublicKey     BIT STRING
+ * }
+ */
+public class SubjectPublicKeyInfo extends Asn1SequenceType {
+    private static final int ALGORITHM = 0;
+    private static final int SUBJECT_PUBLIC_KEY = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(ALGORITHM, AlgorithmIdentifier.class),
+            new Asn1FieldInfo(SUBJECT_PUBLIC_KEY, Asn1BitString.class)
+    };
+
+    public SubjectPublicKeyInfo() {
+        super(fieldInfos);
+    }
+
+    public AlgorithmIdentifier getAlgorithm() {
+        return getFieldAs(ALGORITHM, AlgorithmIdentifier.class);
+    }
+
+    public void setAlgorithm(AlgorithmIdentifier algorithm) {
+        setFieldAs(ALGORITHM, algorithm);
+    }
+
+    public byte[] getSubjectPubKey() {
+        return getFieldAsOctets(SUBJECT_PUBLIC_KEY);
+    }
+
+    public void setSubjectPubKey(byte[] subjectPubKey) {
+        setFieldAs(SUBJECT_PUBLIC_KEY, new Asn1BitString(subjectPubKey));
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TBSCertList.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TBSCertList.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TBSCertList.java
new file mode 100644
index 0000000..64f1b90
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TBSCertList.java
@@ -0,0 +1,128 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+import org.apache.kerby.x500.type.Name;
+
+/**
+ * Ref. RFC-2459
+ * <pre>
+ * TBSCertList  ::=  SEQUENCE  {
+ *      version                 Version OPTIONAL,
+ *                                   -- if present, shall be v2
+ *      signature               AlgorithmIdentifier,
+ *      issuer                  Name,
+ *      thisUpdate              Time,
+ *      nextUpdate              Time OPTIONAL,
+ *      revokedCertificates     SEQUENCE OF SEQUENCE  {
+ *           userCertificate         CertificateSerialNumber,
+ *           revocationDate          Time,
+ *           crlEntryExtensions      Extensions OPTIONAL
+ *                                         -- if present, shall be v2
+ *                                }  OPTIONAL,
+ *      crlExtensions           [0]  EXPLICIT Extensions OPTIONAL
+ *                                         -- if present, shall be v2
+ *                                }
+ * </pre>
+ */
+public class TBSCertList extends Asn1SequenceType {
+
+    private static final int VERSION = 0;
+    private static final int SIGNATURE = 1;
+    private static final int ISSUER = 2;
+    private static final int THIS_UPDATA = 3;
+    private static final int NEXT_UPDATE = 4;
+    private static final int REVOKED_CERTIFICATES = 5;
+    private static final int CRL_EXTENSIONS = 6;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(VERSION, Asn1Integer.class),
+        new Asn1FieldInfo(SIGNATURE, AlgorithmIdentifier.class),
+        new Asn1FieldInfo(ISSUER, Name.class),
+        new Asn1FieldInfo(THIS_UPDATA, Time.class),
+        new Asn1FieldInfo(NEXT_UPDATE, Time.class),
+        new Asn1FieldInfo(REVOKED_CERTIFICATES, RevokedCertificates.class),
+        new ExplicitField(CRL_EXTENSIONS, 0, Extensions.class)
+    };
+
+    public TBSCertList() {
+        super(fieldInfos);
+    }
+
+    public Asn1Integer getVersion() {
+        return getFieldAs(VERSION, Asn1Integer.class);
+    }
+
+    public void setVersion(Asn1Integer version) {
+        setFieldAs(VERSION, version);
+    }
+
+    public AlgorithmIdentifier getSignature() {
+        return getFieldAs(SIGNATURE, AlgorithmIdentifier.class);
+    }
+
+    public void setSignature(AlgorithmIdentifier signature) {
+        setFieldAs(SIGNATURE, signature);
+    }
+
+    public Name getIssuer() {
+        return getFieldAs(ISSUER, Name.class);
+    }
+
+    public void setIssuer(Name issuer) {
+        setFieldAs(ISSUER, issuer);
+    }
+
+    public Time getThisUpdate() {
+        return getFieldAs(THIS_UPDATA, Time.class);
+    }
+
+    public void setThisUpdata(Time thisUpdata) {
+        setFieldAs(THIS_UPDATA, thisUpdata);
+    }
+
+    public Time getNextUpdate() {
+        return getFieldAs(NEXT_UPDATE, Time.class);
+    }
+
+    public void setNextUpdate(Time nextUpdate) {
+        setFieldAs(NEXT_UPDATE, nextUpdate);
+    }
+
+    public RevokedCertificates getRevokedCertificates() {
+        return getFieldAs(REVOKED_CERTIFICATES, RevokedCertificates.class);
+    }
+
+    public void setRevokedCertificates(RevokedCertificates revokedCertificates) {
+        setFieldAs(REVOKED_CERTIFICATES, revokedCertificates);
+    }
+
+    public Extensions getCrlExtensions() {
+        return getFieldAs(CRL_EXTENSIONS, Extensions.class);
+    }
+
+    public void setCrlExtensions(Extensions crlExtensions) {
+        setFieldAs(CRL_EXTENSIONS, crlExtensions);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TBSCertificate.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TBSCertificate.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TBSCertificate.java
new file mode 100644
index 0000000..23042c0
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TBSCertificate.java
@@ -0,0 +1,155 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+import org.apache.kerby.asn1.type.ImplicitField;
+import org.apache.kerby.x500.type.Name;
+
+/**
+ * <pre>
+ * TBSCertificate ::= SEQUENCE {
+ *      version          [ 0 ]  Version DEFAULT v1(0),
+ *      serialNumber            CertificateSerialNumber,
+ *      signature               AlgorithmIdentifier,
+ *      issuer                  Name,
+ *      validity                Validity,
+ *      subject                 Name,
+ *      subjectPublicKeyInfo    SubjectPublicKeyInfo,
+ *      issuerUniqueID    [ 1 ] IMPLICIT UniqueIdentifier OPTIONAL,
+ *      subjectUniqueID   [ 2 ] IMPLICIT UniqueIdentifier OPTIONAL,
+ *      extensions        [ 3 ] Extensions OPTIONAL
+ *  }
+ * </pre>
+ */
+public class TBSCertificate extends Asn1SequenceType {
+
+    private static final int VERSION = 0;
+    private static final int SERIAL_NUMBER = 1;
+    private static final int SIGNATURE = 2;
+    private static final int ISSUER = 3;
+    private static final int VALIDITY = 4;
+    private static final int SUBJECT = 5;
+    private static final int SUBJECT_PUBLIC_KEY_INFO = 6;
+    private static final int ISSUER_UNIQUE_ID = 7;
+    private static final int SUBJECT_UNIQUE_ID = 8;
+    private static final int EXTENSIONS = 9;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new ExplicitField(VERSION, 0, Asn1Integer.class),
+            new Asn1FieldInfo(SERIAL_NUMBER, CertificateSerialNumber.class),
+            new Asn1FieldInfo(SIGNATURE, AlgorithmIdentifier.class),
+            new Asn1FieldInfo(ISSUER, Name.class),
+            new Asn1FieldInfo(VALIDITY, AttCertValidityPeriod.class),
+            new Asn1FieldInfo(SUBJECT, Name.class),
+            new Asn1FieldInfo(SUBJECT_PUBLIC_KEY_INFO, SubjectPublicKeyInfo.class),
+            new ImplicitField(ISSUER_UNIQUE_ID, 1, Asn1BitString.class),
+            new ImplicitField(SUBJECT_UNIQUE_ID, 2, Asn1BitString.class),
+            new ExplicitField(EXTENSIONS, 3, Extensions.class)
+    };
+
+    public TBSCertificate() {
+        super(fieldInfos);
+    }
+
+    public int getVersion() {
+        return getFieldAsInteger(VERSION);
+    }
+
+    public void setVersion(int version) {
+        setFieldAsInt(VERSION, version);
+    }
+
+    public CertificateSerialNumber getSerialNumber() {
+        return getFieldAs(SERIAL_NUMBER, CertificateSerialNumber.class);
+    }
+
+    public void setSerialNumber(CertificateSerialNumber certificateSerialNumber) {
+        setFieldAs(SERIAL_NUMBER, certificateSerialNumber);
+    }
+
+    public AlgorithmIdentifier getSignature() {
+        return getFieldAs(SIGNATURE, AlgorithmIdentifier.class);
+    }
+
+    public void setSignature(AlgorithmIdentifier signature) {
+        setFieldAs(SIGNATURE, signature);
+    }
+
+    public Name getIssuer() {
+        return getFieldAs(ISSUER, Name.class);
+    }
+
+    public void setIssuer(Name attCertIssuer) {
+        setFieldAs(ISSUER, attCertIssuer);
+    }
+
+    public AttCertValidityPeriod getValidity() {
+        return getFieldAs(VALIDITY, AttCertValidityPeriod.class);
+    }
+
+    public void setValidity(AttCertValidityPeriod validity) {
+        setFieldAs(VALIDITY, validity);
+    }
+
+    public Name getSubject() {
+        return getFieldAs(SUBJECT, Name.class);
+    }
+
+    public void setSubject(Name subject) {
+        setFieldAs(SUBJECT, subject);
+    }
+
+    public SubjectPublicKeyInfo getSubjectPublicKeyInfo() {
+        return getFieldAs(SUBJECT_PUBLIC_KEY_INFO, SubjectPublicKeyInfo.class);
+    }
+
+    public void setSubjectPublicKeyInfo(SubjectPublicKeyInfo subjectPublicKeyInfo) {
+        setFieldAs(SUBJECT_PUBLIC_KEY_INFO, subjectPublicKeyInfo);
+    }
+
+    public byte[] getIssuerUniqueID() {
+        return getFieldAs(ISSUER_UNIQUE_ID, Asn1BitString.class).getValue();
+    }
+
+    public void setIssuerUniqueId(byte[] issuerUniqueId) {
+        setFieldAs(ISSUER_UNIQUE_ID, new Asn1BitString(issuerUniqueId));
+    }
+
+    public byte[] getSubjectUniqueId() {
+        return getFieldAs(ISSUER_UNIQUE_ID, Asn1BitString.class).getValue();
+    }
+
+    public void setSubjectUniqueId(byte[] issuerUniqueId) {
+        setFieldAs(ISSUER_UNIQUE_ID, new Asn1BitString(issuerUniqueId));
+    }
+
+    public Extensions getExtensions() {
+        return getFieldAs(EXTENSIONS, Extensions.class);
+    }
+
+    public void setExtensions(Extensions extensions) {
+        setFieldAs(EXTENSIONS, extensions);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Target.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Target.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Target.java
new file mode 100644
index 0000000..8ef6c5e
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Target.java
@@ -0,0 +1,74 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ * Ref. RFC 3281
+ * <pre>
+ *     Target  ::= CHOICE {
+ *       targetName          [0] GeneralName,
+ *       targetGroup         [1] GeneralName,
+ *       targetCert          [2] TargetCert
+ *     }
+ * </pre>
+ */
+public class Target extends Asn1Choice {
+    private static final int TARGET_NAME = 0;
+    private static final int TARGET_GROUP = 1;
+    private static final int TARGET_CERT = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new ExplicitField(TARGET_NAME, GeneralName.class),
+        new ExplicitField(TARGET_GROUP, GeneralName.class),
+        new ExplicitField(TARGET_CERT, TargetCert.class),
+    };
+
+    public Target() {
+        super(fieldInfos);
+    }
+
+    public GeneralName getTargetName() {
+        return getFieldAs(TARGET_NAME, GeneralName.class);
+    }
+
+    public void setTargetName(GeneralName targetName) {
+        setFieldAs(TARGET_NAME, targetName);
+    }
+
+    public GeneralName getTargetGroup() {
+        return getFieldAs(TARGET_GROUP, GeneralName.class);
+    }
+
+    public void setTargetGroup(GeneralName targetGroup) {
+        setFieldAs(TARGET_GROUP, targetGroup);
+    }
+
+    public TargetCert targetCert() {
+        return getFieldAs(TARGET_CERT, TargetCert.class);
+    }
+
+    public void setTargetCert(TargetCert targetCert) {
+        setFieldAs(TARGET_CERT, targetCert);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TargetCert.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TargetCert.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TargetCert.java
new file mode 100644
index 0000000..b79fe3f
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TargetCert.java
@@ -0,0 +1,70 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * TargetCert  ::= SEQUENCE {
+ *   targetCertificate    IssuerSerial,
+ *   targetName           GeneralName OPTIONAL,
+ *   certDigestInfo       ObjectDigestInfo OPTIONAL
+ * }
+ */
+public class TargetCert extends Asn1SequenceType{
+    private static final int TARGET_CERTIFICATE = 0;
+    private static final int TARGET_NAME = 1;
+    private static final int CERT_DIGEST_INFO = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(TARGET_CERTIFICATE, IssuerSerial.class),
+            new Asn1FieldInfo(TARGET_NAME, GeneralName.class),
+            new Asn1FieldInfo(CERT_DIGEST_INFO, ObjectDigestInfo.class)
+    };
+
+    public TargetCert() {
+        super(fieldInfos);
+    }
+
+    public IssuerSerial getTargetCertificate() {
+        return getFieldAs(TARGET_CERTIFICATE, IssuerSerial.class);
+    }
+
+    public void setTargetCertificate(IssuerSerial targetCertificate) {
+        setFieldAs(TARGET_CERTIFICATE, targetCertificate);
+    }
+
+    public GeneralName getTargetName() {
+        return getFieldAs(TARGET_NAME, GeneralName.class);
+    }
+
+    public void setTargetName(GeneralName targetName) {
+        setFieldAs(TARGET_NAME, targetName);
+    }
+
+    public ObjectDigestInfo getCertDigestInfo() {
+        return getFieldAs(CERT_DIGEST_INFO, ObjectDigestInfo.class);
+    }
+
+    public void setCerttDigestInfo(ObjectDigestInfo certDigestInfo) {
+        setFieldAs(CERT_DIGEST_INFO, certDigestInfo);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TargetInformation.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TargetInformation.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TargetInformation.java
new file mode 100644
index 0000000..8c17c3b
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/TargetInformation.java
@@ -0,0 +1,34 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+/**
+ * Ref. RFC 3281
+ * 
+ * <pre>
+ *  TargetInformation ::= SEQUENCE OF Targets
+ * </pre>
+ * 
+ */
+public class TargetInformation extends Asn1SequenceOf<Target> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Targets.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Targets.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Targets.java
new file mode 100644
index 0000000..77b6adc
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Targets.java
@@ -0,0 +1,45 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1SequenceOf;
+
+/**
+ * Ref. RFC 3281
+ * 
+ * <pre>
+ *            Targets ::= SEQUENCE OF Target
+ *           
+ *            Target  ::= CHOICE {
+ *              targetName          [0] GeneralName,
+ *              targetGroup         [1] GeneralName,
+ *              targetCert          [2] TargetCert
+ *            }
+ *           
+ *            TargetCert  ::= SEQUENCE {
+ *              targetCertificate    IssuerSerial,
+ *              targetName           GeneralName OPTIONAL,
+ *              certDigestInfo       ObjectDigestInfo OPTIONAL
+ *            }
+ * </pre>
+ */
+public class Targets extends Asn1SequenceOf<Target> {
+
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Time.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Time.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Time.java
new file mode 100644
index 0000000..fb3280d
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/Time.java
@@ -0,0 +1,66 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1GeneralizedTime;
+import org.apache.kerby.asn1.type.Asn1UtcTime;
+
+import java.util.Date;
+
+/**
+ *
+ * <pre>
+ * Time ::= CHOICE {
+ *             utcTime        UTCTime,
+ *             generalTime    GeneralizedTime
+ *          }
+ * </pre>
+ */
+public class Time extends Asn1Choice {
+    private static final int UTC_TIME = 0;
+    private static final int GENERAL_TIME = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(UTC_TIME, Asn1UtcTime.class),
+        new Asn1FieldInfo(GENERAL_TIME, Asn1GeneralizedTime.class)
+    };
+
+    public Time() {
+        super(fieldInfos);
+    }
+
+    public Date getUtcTime() {
+        return getFieldAs(UTC_TIME, Asn1UtcTime.class).getValue();
+    }
+
+    public void setUtcTime(Asn1UtcTime utcTime) {
+        setFieldAs(UTC_TIME, utcTime);
+    }
+
+    public Date generalizedTime() {
+        return getFieldAs(GENERAL_TIME, Asn1GeneralizedTime.class).getValue();
+    }
+
+    public void setGeneralTime(Asn1GeneralizedTime generalTime) {
+        setFieldAs(GENERAL_TIME, generalTime);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/UserNotice.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/UserNotice.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/UserNotice.java
new file mode 100644
index 0000000..d648218
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/UserNotice.java
@@ -0,0 +1,63 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ *
+ * <pre>
+ * UserNotice ::= SEQUENCE {
+ *      noticeRef        NoticeReference OPTIONAL,
+ *      explicitText     DisplayText OPTIONAL}
+ *
+ * </pre>
+ *
+ */
+public class UserNotice extends Asn1SequenceType {
+    private static final int NOTICE_REF = 0;
+    private static final int EXPLICIT_TEXT = 1;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(NOTICE_REF, NoticeReference.class),
+        new Asn1FieldInfo(EXPLICIT_TEXT, DisplayText.class)
+    };
+
+    public UserNotice() {
+        super(fieldInfos);
+    }
+
+    public NoticeReference getNoticeRef() {
+        return getFieldAs(NOTICE_REF, NoticeReference.class);
+    }
+
+    public void setNoticeRef(NoticeReference noticeRef) {
+        setFieldAs(NOTICE_REF, noticeRef);
+    }
+    
+    public DisplayText getExplicitText() {
+        return getFieldAs(EXPLICIT_TEXT, DisplayText.class);
+    }
+
+    public void setExplicitText(DisplayText explicitText) {
+        setFieldAs(EXPLICIT_TEXT, explicitText);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/kerby-pkix/src/main/java/org/apache/kerby/x509/type/V2Form.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/V2Form.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/V2Form.java
new file mode 100644
index 0000000..26ecec3
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/V2Form.java
@@ -0,0 +1,77 @@
+/**
+ *  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.x509.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ * Produce an object suitable for an ASN1OutputStream.
+ * <pre>
+ *  V2Form ::= SEQUENCE {
+ *       issuerName            GeneralNames  OPTIONAL,
+ *       baseCertificateID     [0] IssuerSerial  OPTIONAL,
+ *       objectDigestInfo      [1] ObjectDigestInfo  OPTIONAL
+ *         -- issuerName MUST be present in this profile
+ *         -- baseCertificateID and objectDigestInfo MUST NOT
+ *         -- be present in this profile
+ *  }
+ * </pre>
+ */
+public class V2Form extends Asn1SequenceType {
+    private static final int ISSUER_NAME = 0;
+    private static final int BASE_CERTIFICATE_ID = 1;
+    private static final int OBJECT_DIGEST_INFO = 2;
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+        new Asn1FieldInfo(ISSUER_NAME, GeneralNames.class),
+        new ExplicitField(BASE_CERTIFICATE_ID, 0, IssuerSerial.class),
+        new ExplicitField(OBJECT_DIGEST_INFO, 1, ObjectDigestInfo.class)
+    };
+
+    public V2Form() {
+        super(fieldInfos);
+    }
+
+    public GeneralNames getIssuerName() {
+        return getFieldAs(ISSUER_NAME, GeneralNames.class);
+    }
+
+    public void setIssuerName(GeneralNames issuerName) {
+        setFieldAs(ISSUER_NAME, issuerName);
+    }
+
+    public IssuerSerial getBaseCertificateID() {
+        return getFieldAs(BASE_CERTIFICATE_ID, IssuerSerial.class);
+    }
+
+    public void setBaseCertificateId(IssuerSerial baseCertificateId) {
+        setFieldAs(BASE_CERTIFICATE_ID, baseCertificateId);
+    }
+
+    public ObjectDigestInfo getObjectDigestInfo() {
+        return getFieldAs(OBJECT_DIGEST_INFO, ObjectDigestInfo.class);
+    }
+
+    public void setObjectDigestInfo(ObjectDigestInfo objectDigestInfo) {
+        setFieldAs(OBJECT_DIGEST_INFO, objectDigestInfo);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/93bcd6fe/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 96ea773..90be760 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,6 +68,7 @@
     <module>kerby-config</module>
     <module>kerby-util</module>
     <module>kerby-asn1</module>
+    <module>kerby-pkix</module>
     <module>kerby-kerb</module>
     <module>kerby-kdc</module>
     <module>kerby-tool</module>


[17/17] directory-kerby git commit: Merge from master.

Posted by pl...@apache.org.
Merge from master.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/67c2bb6e
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/67c2bb6e
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/67c2bb6e

Branch: refs/heads/pkinit-support
Commit: 67c2bb6e249b92017dc091f5c38271309b58919c
Parents: b948567 af7deb6
Author: plusplusjiajia <ji...@intel.com>
Authored: Fri Nov 27 16:24:39 2015 +0800
Committer: plusplusjiajia <ji...@intel.com>
Committed: Fri Nov 27 16:24:39 2015 +0800

----------------------------------------------------------------------
 .../org/apache/kerby/asn1/Asn1OutputBuffer.java |   5 -
 .../org/apache/kerby/asn1/EncodingOption.java   | 202 -------------------
 .../org/apache/kerby/asn1/TaggingOption.java    |   4 +-
 .../org/apache/kerby/asn1/UniversalTag.java     |   3 +-
 .../kerby/asn1/type/AbstractAsn1Type.java       | 147 +++++++++-----
 .../org/apache/kerby/asn1/type/Asn1Any.java     |  39 +++-
 .../apache/kerby/asn1/type/Asn1BmpString.java   |   3 +-
 .../org/apache/kerby/asn1/type/Asn1Boolean.java |   2 +-
 .../org/apache/kerby/asn1/type/Asn1Choice.java  |   6 -
 .../apache/kerby/asn1/type/Asn1Collection.java  |   7 +-
 .../kerby/asn1/type/Asn1CollectionType.java     |   7 +-
 .../apache/kerby/asn1/type/Asn1EnumType.java    |  13 +-
 .../apache/kerby/asn1/type/Asn1Enumerated.java  |  64 ++++++
 .../apache/kerby/asn1/type/Asn1FieldInfo.java   |  43 +++-
 .../org/apache/kerby/asn1/type/Asn1Flags.java   |  10 +-
 .../org/apache/kerby/asn1/type/Asn1Simple.java  |   7 +-
 .../org/apache/kerby/asn1/type/Asn1Tagging.java |  55 +++--
 .../org/apache/kerby/asn1/type/Asn1Type.java    |  96 ++++++++-
 .../apache/kerby/asn1/type/ExplicitField.java   |  44 ++++
 .../apache/kerby/asn1/type/ImplicitField.java   |  44 ++++
 .../kerby/asn1/type/TaggingCollection.java      |  82 ++++++--
 .../apache/kerby/asn1/type/TaggingSequence.java |   5 +-
 .../org/apache/kerby/asn1/type/TaggingSet.java  |   5 +-
 .../org/apache/kerby/asn1/PersonnelRecord.java  |  40 ++--
 .../org/apache/kerby/asn1/TestAsn1Boolean.java  |   8 +-
 .../org/apache/kerby/asn1/TestAsn1Flags.java    |   2 +-
 .../org/apache/kerby/asn1/TestAsn1Integer.java  |   4 +-
 .../kerby/asn1/TestAsn1ObjectIdentifier.java    |   4 +-
 .../org/apache/kerby/asn1/TestAsn1UtcTime.java  |   4 +-
 .../apache/kerby/asn1/TestTaggingEncoding.java  |  12 +-
 .../identitybackend/LdapIdentityBackend.java    |   2 +-
 .../org/apache/kerby/KrbIdentitySerializer.java |   2 +-
 .../apache/kerby/config/IniConfigLoader.java    |   4 +-
 .../kerb/integration/test/Transport.java        |   4 +-
 .../kerb/integration/test/gss/GssAppClient.java |   4 +-
 .../kerb/integration/test/gss/GssAppServer.java |   4 +-
 .../kerb/integration/test/jaas/TokenCache.java  |   6 +-
 .../integration/test/sasl/SaslAppClient.java    |   8 +-
 .../integration/test/sasl/SaslAppServer.java    |   4 +-
 .../client/preauth/pkinit/PkinitPreauth.java    |   9 +-
 .../kerby/kerberos/kerb/preauth/PaFlag.java     |   4 +-
 .../kerb/preauth/pkinit/PluginOpts.java         |   2 +-
 .../kerby/kerberos/kerb/codec/CodecTest.java    |   2 +
 .../kerberos/kerb/codec/TestAsReqCodec.java     |   8 +-
 .../kerberos/kerb/codec/TestTgsReqCodec.java    |   8 +-
 kerby-kerb/kerb-core/pom.xml                    |   5 +
 .../apache/kerby/kerberos/kerb/KrbCodec.java    |   3 +-
 .../kerby/kerberos/kerb/KrbErrorCode.java       |   4 +-
 .../kerberos/kerb/spec/KerberosString.java      |   1 +
 .../kerberos/kerb/spec/KrbAppSequenceType.java  |   6 +-
 .../kerberos/kerb/spec/KrbSequenceType.java     |   4 +-
 .../kerby/kerberos/kerb/spec/ad/AdToken.java    |   3 +-
 .../kerb/spec/ad/AuthorizationDataEntry.java    |   7 +-
 .../kerb/spec/ad/AuthorizationType.java         |   4 +-
 .../kerby/kerberos/kerb/spec/ap/ApOption.java   |   4 +-
 .../kerby/kerberos/kerb/spec/ap/ApRep.java      |   9 +-
 .../kerby/kerberos/kerb/spec/ap/ApReq.java      |  13 +-
 .../kerberos/kerb/spec/ap/Authenticator.java    |  19 +-
 .../kerberos/kerb/spec/ap/EncAPRepPart.java     |   9 +-
 .../kerby/kerberos/kerb/spec/base/CheckSum.java |   7 +-
 .../kerberos/kerb/spec/base/CheckSumType.java   |   4 +-
 .../kerberos/kerb/spec/base/EncryptedData.java  |   9 +-
 .../kerberos/kerb/spec/base/EncryptionKey.java  |   7 +-
 .../kerberos/kerb/spec/base/EncryptionType.java |   4 +-
 .../kerb/spec/base/EtypeInfo2Entry.java         |   7 +-
 .../kerberos/kerb/spec/base/EtypeInfoEntry.java |   5 +-
 .../kerberos/kerb/spec/base/HostAddrType.java   |   4 +-
 .../kerberos/kerb/spec/base/HostAddress.java    |   7 +-
 .../kerby/kerberos/kerb/spec/base/KeyUsage.java |   4 +-
 .../kerby/kerberos/kerb/spec/base/KrbError.java |  27 +--
 .../kerberos/kerb/spec/base/KrbMessage.java     |   4 +-
 .../kerberos/kerb/spec/base/KrbMessageType.java |   4 +-
 .../kerby/kerberos/kerb/spec/base/KrbToken.java |   7 +-
 .../kerberos/kerb/spec/base/LastReqEntry.java   |   7 +-
 .../kerberos/kerb/spec/base/LastReqType.java    |   4 +-
 .../kerby/kerberos/kerb/spec/base/NameType.java |   4 +-
 .../kerberos/kerb/spec/base/PrincipalName.java  |   7 +-
 .../kerby/kerberos/kerb/spec/base/SamType.java  |   4 +-
 .../kerberos/kerb/spec/base/TokenFormat.java    |   4 +-
 .../kerb/spec/base/TransitedEncoding.java       |   5 +-
 .../kerb/spec/base/TransitedEncodingType.java   |   4 +-
 .../kerb/spec/cms/AlgorithmIdentifier.java      |  61 ------
 .../kerberos/kerb/spec/cms/DHParameter.java     |  51 -----
 .../kerb/spec/cms/SubjectPublicKeyInfo.java     |  60 ------
 .../kerberos/kerb/spec/fast/ArmorType.java      |   4 +-
 .../kerberos/kerb/spec/fast/FastOption.java     |   4 +-
 .../kerberos/kerb/spec/fast/KrbFastArmor.java   |   7 +-
 .../kerb/spec/fast/KrbFastArmoredRep.java       |   3 +-
 .../kerb/spec/fast/KrbFastArmoredReq.java       |   7 +-
 .../kerb/spec/fast/KrbFastFinished.java         |   7 +-
 .../kerberos/kerb/spec/fast/KrbFastReq.java     |   7 +-
 .../kerb/spec/fast/KrbFastResponse.java         |   9 +-
 .../kerberos/kerb/spec/fast/PaAuthnEntry.java   |   9 +-
 .../kerberos/kerb/spec/fast/PaFxFastReply.java  |   3 +-
 .../kerb/spec/fast/PaFxFastRequest.java         |   3 +-
 .../kerberos/kerb/spec/kdc/EncKdcRepPart.java   |  25 +--
 .../kerby/kerberos/kerb/spec/kdc/KdcOption.java |   4 +-
 .../kerby/kerberos/kerb/spec/kdc/KdcRep.java    |  15 +-
 .../kerby/kerberos/kerb/spec/kdc/KdcReq.java    |   9 +-
 .../kerberos/kerb/spec/kdc/KdcReqBody.java      |  27 +--
 .../kerb/spec/pa/PaAuthenticationSetElem.java   |   9 +-
 .../kerberos/kerb/spec/pa/PaDataEntry.java      |   7 +-
 .../kerby/kerberos/kerb/spec/pa/PaDataType.java |   4 +-
 .../kerby/kerberos/kerb/spec/pa/PaEncTsEnc.java |   5 +-
 .../kerberos/kerb/spec/pa/otp/OtpTokenInfo.java |  19 +-
 .../kerb/spec/pa/otp/PaOtpChallenge.java        |  11 +-
 .../spec/pa/pkinit/AlgorithmIdentifiers.java    |   2 +-
 .../kerberos/kerb/spec/pa/pkinit/AuthPack.java  |  11 +-
 .../kerb/spec/pa/pkinit/DHParameter.java        |  51 +++++
 .../kerberos/kerb/spec/pa/pkinit/DHRepInfo.java |   6 +-
 .../pa/pkinit/ExternalPrincipalIdentifier.java  |   7 +-
 .../kerb/spec/pa/pkinit/KdcDHKeyInfo.java       |   7 +-
 .../kerb/spec/pa/pkinit/Krb5PrincipalName.java  |   5 +-
 .../kerberos/kerb/spec/pa/pkinit/PaPkAsRep.java |   6 +-
 .../kerberos/kerb/spec/pa/pkinit/PaPkAsReq.java |   8 +-
 .../kerb/spec/pa/pkinit/PkAuthenticator.java    |   9 +-
 .../kerb/spec/pa/pkinit/ReplyKeyPack.java       |   5 +-
 .../kerb/spec/pa/token/PaTokenChallenge.java    |   3 +-
 .../kerb/spec/pa/token/PaTokenRequest.java      |   5 +-
 .../kerberos/kerb/spec/pa/token/TokenFlag.java  |   4 +-
 .../kerberos/kerb/spec/pa/token/TokenFlags.java |   2 +-
 .../kerberos/kerb/spec/pa/token/TokenInfo.java  |   5 +-
 .../kerb/spec/ticket/EncTicketPart.java         |  23 ++-
 .../kerby/kerberos/kerb/spec/ticket/Ticket.java |   9 +-
 .../kerberos/kerb/spec/ticket/TicketFlag.java   |   4 +-
 .../kerberos/kerb/spec/ticket/TicketFlags.java  |   2 +-
 .../kerberos/kerb/crypto/CheckSumHandler.java   |   4 +-
 .../kerberos/kerb/crypto/EncryptionHandler.java |   6 +-
 .../kerb/crypto/cksum/HmacMd5Rc4CheckSum.java   |   4 +-
 .../kerberos/kerb/crypto/enc/KeKiCmacEnc.java   |   4 +-
 .../kerb/crypto/enc/KeKiHmacSha1Enc.java        |   4 +-
 .../kerberos/kerb/crypto/fast/FastUtil.java     |   4 +-
 .../kerb/crypto/key/AbstractKeyMaker.java       |  18 +-
 .../kerberos/kerb/crypto/key/AesKeyMaker.java   |   8 +-
 .../kerb/crypto/key/CamelliaKeyMaker.java       |   8 +-
 .../kerby/kerberos/kerb/crypto/util/Rc4.java    |   4 +-
 .../kerb/identity/backend/BackendTest.java      |   4 +-
 .../server/preauth/pkinit/PkinitPreauth.java    |   1 -
 .../kerby/kerberos/kerb/KrbInputStream.java     |   4 +-
 .../kerby/kerberos/kerb/KrbOutputStream.java    |   4 +-
 .../kerb/ccache/CredCacheOutputStream.java      |  10 +-
 .../kerby/kerberos/kerb/ccache/Credential.java  |   2 +-
 .../kerb/keytab/KeytabOutputStream.java         |   4 +-
 kerby-pkix/pom.xml                              |  37 ++++
 .../org/apache/kerby/cms/type/Attribute.java    |  66 ++++++
 .../cms/type/AttributeCertificateInfoV1.java    | 147 ++++++++++++++
 .../kerby/cms/type/AttributeCertificateV1.java  |  73 +++++++
 .../kerby/cms/type/AttributeCertificateV2.java  |  29 +++
 .../org/apache/kerby/cms/type/Certificate.java  |  76 +++++++
 .../kerby/cms/type/CertificateChoices.java      |  93 +++++++++
 .../apache/kerby/cms/type/CertificateList.java  |  77 +++++++
 .../apache/kerby/cms/type/CertificateSet.java   |  29 +++
 .../org/apache/kerby/cms/type/CmsVersion.java   |  53 +++++
 .../apache/kerby/cms/type/CompressedData.java   |  77 +++++++
 .../org/apache/kerby/cms/type/ContentInfo.java  |  69 +++++++
 .../cms/type/DigestAlgorithmIdentifier.java     |  28 +++
 .../cms/type/DigestAlgorithmIdentifiers.java    |  28 +++
 .../kerby/cms/type/EncapsulatedContentInfo.java |  64 ++++++
 .../kerby/cms/type/ExtendedCertificate.java     |  70 +++++++
 .../kerby/cms/type/ExtendedCertificateInfo.java |  71 +++++++
 .../kerby/cms/type/IssuerAndSerialNumber.java   |  66 ++++++
 .../kerby/cms/type/OtherCertificateFormat.java  |  63 ++++++
 .../cms/type/OtherRevocationInfoFormat.java     |  62 ++++++
 .../cms/type/RelativeDistinguishedName.java     |  29 +++
 .../kerby/cms/type/RevocationInfoChoice.java    |  60 ++++++
 .../kerby/cms/type/RevocationInfoChoices.java   |  28 +++
 .../org/apache/kerby/cms/type/Signature.java    |  28 +++
 .../cms/type/SignatureAlgorithmIdentifier.java  |  28 +++
 .../apache/kerby/cms/type/SignatureValue.java   |  28 +++
 .../apache/kerby/cms/type/SignedAttributes.java |  28 +++
 .../org/apache/kerby/cms/type/SignedData.java   | 108 ++++++++++
 .../apache/kerby/cms/type/SignerIdentifier.java |  66 ++++++
 .../org/apache/kerby/cms/type/SignerInfo.java   | 119 +++++++++++
 .../org/apache/kerby/cms/type/SignerInfos.java  |  28 +++
 .../java/org/apache/kerby/cms/type/Subject.java |  65 ++++++
 .../kerby/cms/type/UnsignedAttributes.java      |  28 +++
 .../kerby/x500/type/AttributeTypeAndValue.java  |  63 ++++++
 .../java/org/apache/kerby/x500/type/Name.java   |  49 +++++
 .../org/apache/kerby/x500/type/RDNSequence.java |  28 +++
 .../x500/type/RelativeDistinguishedName.java    |  28 +++
 .../kerby/x509/type/AccessDescription.java      |  63 ++++++
 .../kerby/x509/type/AlgorithmIdentifier.java    |  62 ++++++
 .../apache/kerby/x509/type/AttCertIssuer.java   |  63 ++++++
 .../kerby/x509/type/AttCertValidityPeriod.java  |  62 ++++++
 .../org/apache/kerby/x509/type/Attribute.java   |  62 ++++++
 .../kerby/x509/type/AttributeCertificate.java   |  73 +++++++
 .../x509/type/AttributeCertificateInfo.java     | 145 +++++++++++++
 .../apache/kerby/x509/type/AttributeValues.java |  27 +++
 .../org/apache/kerby/x509/type/Attributes.java  |  43 ++++
 .../x509/type/AuthorityInformationAccess.java   |  41 ++++
 .../kerby/x509/type/AuthorityKeyIdentifier.java |  80 ++++++++
 .../kerby/x509/type/BasicConstraints.java       |  69 +++++++
 .../apache/kerby/x509/type/CRLDistPoint.java    |  31 +++
 .../org/apache/kerby/x509/type/CRLNumber.java   |  31 +++
 .../org/apache/kerby/x509/type/CRLReason.java   |  66 ++++++
 .../apache/kerby/x509/type/CertPolicyId.java    |  31 +++
 .../org/apache/kerby/x509/type/Certificate.java |  73 +++++++
 .../apache/kerby/x509/type/CertificateList.java |  75 +++++++
 .../apache/kerby/x509/type/CertificatePair.java |  64 ++++++
 .../kerby/x509/type/CertificatePolicies.java    |  32 +++
 .../x509/type/CertificateSerialNumber.java      |  26 +++
 .../apache/kerby/x509/type/DSAParameter.java    |  66 ++++++
 .../org/apache/kerby/x509/type/DigestInfo.java  |  62 ++++++
 .../kerby/x509/type/DigestedObjectType.java     |  53 +++++
 .../apache/kerby/x509/type/DirectoryString.java | 100 +++++++++
 .../org/apache/kerby/x509/type/DisplayText.java |  87 ++++++++
 .../kerby/x509/type/DistributionPoint.java      |  74 +++++++
 .../kerby/x509/type/DistributionPointName.java  |  64 ++++++
 .../apache/kerby/x509/type/EDIPartyName.java    |  62 ++++++
 .../kerby/x509/type/ExtendedKeyUsage.java       |  31 +++
 .../org/apache/kerby/x509/type/Extension.java   |  77 +++++++
 .../org/apache/kerby/x509/type/Extensions.java  |  37 ++++
 .../org/apache/kerby/x509/type/GeneralName.java | 147 ++++++++++++++
 .../apache/kerby/x509/type/GeneralNames.java    |  26 +++
 .../apache/kerby/x509/type/GeneralSubtree.java  |  77 +++++++
 .../apache/kerby/x509/type/GeneralSubtrees.java |  25 +++
 .../java/org/apache/kerby/x509/type/Holder.java |  78 +++++++
 .../apache/kerby/x509/type/IetfAttrSyntax.java  |  69 +++++++
 .../kerby/x509/type/IetfAttrSyntaxChoice.java   |  78 +++++++
 .../kerby/x509/type/IetfAttrSyntaxChoices.java  |  26 +++
 .../apache/kerby/x509/type/IssuerSerial.java    |  73 +++++++
 .../x509/type/IssuingDistributionPoint.java     | 107 ++++++++++
 .../apache/kerby/x509/type/KeyIdentifier.java   |  32 +++
 .../apache/kerby/x509/type/KeyPurposeId.java    |  36 ++++
 .../org/apache/kerby/x509/type/KeyUsage.java    |  62 ++++++
 .../apache/kerby/x509/type/NameConstraints.java |  60 ++++++
 .../apache/kerby/x509/type/NoticeNumbers.java   |  31 +++
 .../apache/kerby/x509/type/NoticeReference.java |  63 ++++++
 .../kerby/x509/type/ObjectDigestInfo.java       |  93 +++++++++
 .../org/apache/kerby/x509/type/OtherName.java   |  66 ++++++
 .../kerby/x509/type/PolicyConstraints.java      |  67 ++++++
 .../kerby/x509/type/PolicyInformation.java      |  61 ++++++
 .../apache/kerby/x509/type/PolicyMapping.java   |  62 ++++++
 .../apache/kerby/x509/type/PolicyMappings.java  |  34 ++++
 .../kerby/x509/type/PolicyQualifierId.java      |  35 ++++
 .../kerby/x509/type/PolicyQualifierInfo.java    |  66 ++++++
 .../kerby/x509/type/PolicyQualifierInfos.java   |  31 +++
 .../kerby/x509/type/PrivateKeyUsagePeriod.java  |  63 ++++++
 .../org/apache/kerby/x509/type/ReasonFlags.java |  61 ++++++
 .../kerby/x509/type/RevokedCertificate.java     |  75 +++++++
 .../kerby/x509/type/RevokedCertificates.java    |  38 ++++
 .../org/apache/kerby/x509/type/RoleSyntax.java  |  63 ++++++
 .../x509/type/SubjectDirectoryAttributes.java   |  39 ++++
 .../kerby/x509/type/SubjectKeyIdentifier.java   |  32 +++
 .../kerby/x509/type/SubjectPublicKeyInfo.java   |  60 ++++++
 .../org/apache/kerby/x509/type/TBSCertList.java | 128 ++++++++++++
 .../apache/kerby/x509/type/TBSCertificate.java  | 155 ++++++++++++++
 .../java/org/apache/kerby/x509/type/Target.java |  74 +++++++
 .../org/apache/kerby/x509/type/TargetCert.java  |  70 +++++++
 .../kerby/x509/type/TargetInformation.java      |  34 ++++
 .../org/apache/kerby/x509/type/Targets.java     |  45 +++++
 .../java/org/apache/kerby/x509/type/Time.java   |  66 ++++++
 .../org/apache/kerby/x509/type/UserNotice.java  |  63 ++++++
 .../java/org/apache/kerby/x509/type/V2Form.java |  77 +++++++
 .../provider/token/JwtTokenDecoder.java         |   4 +-
 .../provider/token/JwtTokenEncoder.java         |   4 +-
 .../kerby/kerberos/tool/token/TokenCache.java   |   6 +-
 .../main/java/org/apache/kerby/util/Utf8.java   |  14 +-
 pom.xml                                         |   1 +
 259 files changed, 7673 insertions(+), 930 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67c2bb6e/kerby-asn1/src/main/java/org/apache/kerby/asn1/UniversalTag.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67c2bb6e/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67c2bb6e/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
----------------------------------------------------------------------
diff --cc kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
index ae8ff74,0a69a04..096045b
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/preauth/pkinit/PkinitPreauth.java
@@@ -38,13 -31,9 +38,11 @@@ import org.apache.kerby.kerberos.kerb.p
  import org.apache.kerby.kerberos.kerb.preauth.pkinit.PkinitIdenity;
  import org.apache.kerby.kerberos.kerb.preauth.pkinit.PkinitPreauthMeta;
  import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
 +import org.apache.kerby.kerberos.kerb.spec.base.CheckSum;
 +import org.apache.kerby.kerberos.kerb.spec.base.CheckSumType;
  import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
  import org.apache.kerby.kerberos.kerb.spec.base.EncryptionType;
- import org.apache.kerby.kerberos.kerb.spec.cms.AlgorithmIdentifier;
 -import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
 +import org.apache.kerby.kerberos.kerb.spec.cms.DHParameter;
- import org.apache.kerby.kerberos.kerb.spec.cms.SubjectPublicKeyInfo;
  import org.apache.kerby.kerberos.kerb.spec.pa.PaData;
  import org.apache.kerby.kerberos.kerb.spec.pa.PaDataEntry;
  import org.apache.kerby.kerberos.kerb.spec.pa.PaDataType;
@@@ -52,24 -41,11 +50,29 @@@ import org.apache.kerby.kerberos.kerb.s
  import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.PaPkAsReq;
  import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.PkAuthenticator;
  import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.TrustedCertifiers;
++
++import org.apache.kerby.x509.type.AlgorithmIdentifier;
+ import org.apache.kerby.x509.type.SubjectPublicKeyInfo;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +import javax.crypto.interfaces.DHPublicKey;
 +import javax.crypto.spec.DHParameterSpec;
 +import java.io.FileInputStream;
 +import java.io.FileNotFoundException;
 +import java.io.IOException;
 +import java.io.InputStream;
 +import java.math.BigInteger;
 +import java.security.cert.X509Certificate;
 +import java.util.Arrays;
 +import java.util.Calendar;
 +import java.util.Date;
 +import java.util.List;
 +
++
+ 
 -@SuppressWarnings("PMD")
  public class PkinitPreauth extends AbstractPreauthPlugin {
 +    private static final Logger LOG = LoggerFactory.getLogger(PkinitPreauth.class);
  
      private PkinitContext pkinitContext;
  
@@@ -234,69 -175,20 +237,69 @@@
          boolean usingRsa = reqCtx.requestOpts.usingRsa;
          reqCtx.paType = PaDataType.PK_AS_REQ;
  
 -        pkAuthen.setCtime(ctime);
          pkAuthen.setCusec(cusec);
 +        pkAuthen.setCtime(ctime);
          pkAuthen.setNonce(nonce);
 -        pkAuthen.setPaChecksum(checksum);
 +//        pkAuthen.setPaChecksum(checkSum.getChecksum());
 +
 +        pkAuthen.setPaChecksum(checkSum.encode());
  
          authPack.setPkAuthenticator(pkAuthen);
 -        DHNonce dhNonce = new DHNonce();
 -        authPack.setClientDhNonce(dhNonce);
 -        authPack.setClientPublicValue(pubInfo);
  
 -        authPack.setsupportedCmsTypes(pkinitContext.pluginOpts.createSupportedCMSTypes());
 +//        authPack.setsupportedCmsTypes(pkinitContext.pluginOpts.createSupportedCMSTypes());
 +
 +        if (!usingRsa) {
 +            // DH case
 +            LOG.info("DH key transport algorithm.");
 +
 +            AlgorithmIdentifier dhAlg = new AlgorithmIdentifier();
 +
 +//            byte[] dh_oid = new byte[]{0, 7, (byte) 0x2A, (byte) 0x86, (byte) 0x48, (byte) 0xce,
 +//                    (byte) 0x3e, (byte) 0x02, (byte) 0x01};
 +//            String dhOidStr = Utf8.toString(dh_oid);
 +//            String dhOidStr = "0.7.42.840.10046.2.1";
 +
 +            String content = "0x06 07 2A 86 48 ce 3e 02 01";
 +            Asn1ObjectIdentifier decoded = new Asn1ObjectIdentifier();
-             decoded.getEncodingOption().useDer();
++            decoded.useDER();
 +            try {
 +                decoded.decode(Util.hex2bytes(content));
 +            } catch (IOException e) {
 +                e.printStackTrace();
 +            }
 +
 +            dhAlg.setAlgorithm(decoded);
 +
 +            DhClient client = new DhClient();
 +
 +            DHPublicKey clientPubKey = null;
 +            try {
 +                clientPubKey = client.init(DhGroup.MODP_GROUP14);
 +            } catch (Exception e) {
 +                e.printStackTrace();
 +            }
 +
 +            kdcRequest.setDhClient(client);
 +
 +            DHParameterSpec spec = clientPubKey.getParams();
 +            BigInteger q = spec.getP().shiftRight(1);
 +            DHParameter dhParameter = new DHParameter();
 +            dhParameter.setP(spec.getP());
 +            dhParameter.setG(spec.getG());
 +            dhParameter.setQ(q);
 +            dhAlg.setParameters(dhParameter);
 +
 +            SubjectPublicKeyInfo pubInfo = new SubjectPublicKeyInfo();
 +            pubInfo.setAlgorithm(dhAlg);
 +
 +            Asn1Integer publickey = new Asn1Integer(clientPubKey.getY());
 +            pubInfo.setSubjectPubKey(publickey.encode());
 +
 +            authPack.setClientPublicValue(pubInfo);
 +
 +//            DHNonce dhNonce = new DHNonce();
 +//            authPack.setClientDhNonce(dhNonce);
  
 -        if (usingRsa) {
 -            System.out.println(); // DH case
          } else {
              authPack.setClientPublicValue(null);
          }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67c2bb6e/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/pkinit/PluginOpts.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67c2bb6e/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
----------------------------------------------------------------------
diff --cc kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
index d3b214a,f5543f7..abc4164
--- a/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
+++ b/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
@@@ -57,26 -41,7 +57,28 @@@ public class CodecTest 
          assertThat(restored).isNotNull();
          assertThat(restored.getCksumtype()).isEqualTo(mcs.getCksumtype());
          assertThat(mcs.getChecksum()).isEqualTo(restored.getChecksum());
+         assertThat(restored.tagNo()).isEqualTo(mcs.tagNo());
+         assertThat(restored.tagFlags()).isEqualTo(mcs.tagFlags());
      }
 +
 +    @Test
 +    public void testDecode() throws IOException {
 +        AsReq expected = new AsReq();
 +
 +        KdcReqBody body = new KdcReqBody();
 +
 +        expected.setReqBody(body);
 +
 +        Asn1InputBuffer ib = new Asn1InputBuffer(expected.encode());
 +        Asn1Type fd1 = ib.read();
 +        Asn1Type fd2 = ib.read();
 +        Asn1Type fd3 = ib.read();
 +        Asn1Type fd4 = ib.read();
 +        Asn1Type fd5 = ib.read();
 +        Asn1Type fd6 = ib.read();
 +        Asn1Type fd7 = ib.read();
 +        Asn1Type fd8 = ib.read();
 +        Asn1Type fd9 = ib.read();
 +
 +    }
  }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67c2bb6e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/NameType.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67c2bb6e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/DHParameter.java
----------------------------------------------------------------------
diff --cc kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/DHParameter.java
index 0000000,0000000..8675820
new file mode 100644
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/DHParameter.java
@@@ -1,0 -1,0 +1,51 @@@
++package org.apache.kerby.kerberos.kerb.spec.pa.pkinit;
++
++import org.apache.kerby.asn1.type.Asn1FieldInfo;
++import org.apache.kerby.asn1.type.Asn1Integer;
++import org.apache.kerby.asn1.type.Asn1SequenceType;
++
++import java.math.BigInteger;
++
++public class DHParameter extends Asn1SequenceType {
++
++    private static final int P = 0;
++    private static final int G = 1;
++    private static final int Q = 2;
++
++    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
++            new Asn1FieldInfo(P, Asn1Integer.class),
++            new Asn1FieldInfo(G, Asn1Integer.class),
++            new Asn1FieldInfo(Q, Asn1Integer.class),
++    };
++
++    public DHParameter() {
++        super(fieldInfos);
++    }
++
++    public void setP(BigInteger p) {
++        setFieldAsBigInteger(P, p);
++    }
++
++    public BigInteger getP() {
++        Asn1Integer p = getFieldAs(P, Asn1Integer.class);
++        return p.getValue();
++    }
++
++    public void setG(BigInteger g) {
++        setFieldAsBigInteger(G, g);
++    }
++
++    public BigInteger getG() {
++        Asn1Integer g = getFieldAs(G, Asn1Integer.class);
++        return g.getValue();
++    }
++
++    public void setQ(BigInteger q) {
++        setFieldAsBigInteger(Q, q);
++    }
++
++    public BigInteger getQ() {
++        Asn1Integer q = getFieldAs(Q, Asn1Integer.class);
++        return q.getValue();
++    }
++}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67c2bb6e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/KdcDHKeyInfo.java
----------------------------------------------------------------------
diff --cc kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/KdcDHKeyInfo.java
index ed01f43,b5e23f4..bc60921
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/KdcDHKeyInfo.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/KdcDHKeyInfo.java
@@@ -38,9 -39,9 +39,9 @@@ public class KdcDHKeyInfo extends KrbSe
      private static final int DH_KEY_EXPIRATION = 2;
  
      static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-             new Asn1FieldInfo(SUBJECT_PUBLIC_KEY, Asn1BitString.class),
-             new Asn1FieldInfo(NONCE, Asn1Integer.class),
-             new Asn1FieldInfo(DH_KEY_EXPIRATION, KerberosTime.class)
 -            new ExplicitField(SUBJECT_PUBLICK_KEY, Asn1BitString.class),
++            new ExplicitField(SUBJECT_PUBLIC_KEY, Asn1BitString.class),
+             new ExplicitField(NONCE, Asn1Integer.class),
+             new ExplicitField(DH_KEY_EXPIRATION, KerberosTime.class)
      };
  
      public KdcDHKeyInfo() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67c2bb6e/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/preauth/pkinit/PkinitPreauth.java
----------------------------------------------------------------------
diff --cc kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/preauth/pkinit/PkinitPreauth.java
index 8d99bbe,08baa0e..fd933f3
--- a/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/preauth/pkinit/PkinitPreauth.java
+++ b/kerby-kerb/kerb-server/src/main/java/org/apache/kerby/kerberos/kerb/server/preauth/pkinit/PkinitPreauth.java
@@@ -35,42 -26,13 +35,41 @@@ import org.apache.kerby.kerberos.kerb.p
  import org.apache.kerby.kerberos.kerb.server.KdcContext;
  import org.apache.kerby.kerberos.kerb.server.preauth.AbstractPreauthPlugin;
  import org.apache.kerby.kerberos.kerb.server.request.KdcRequest;
 +import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
 +import org.apache.kerby.kerberos.kerb.spec.base.CheckSum;
 +import org.apache.kerby.kerberos.kerb.spec.base.CheckSumType;
 +import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
  import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
 +import org.apache.kerby.kerberos.kerb.spec.cms.DHParameter;
- import org.apache.kerby.kerberos.kerb.spec.cms.SubjectPublicKeyInfo;
 +import org.apache.kerby.kerberos.kerb.spec.kdc.KdcOption;
  import org.apache.kerby.kerberos.kerb.spec.pa.PaDataEntry;
  import org.apache.kerby.kerberos.kerb.spec.pa.PaDataType;
 +import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.AuthPack;
 +import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.DHRepInfo;
 +import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.KdcDHKeyInfo;
 +import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.PaPkAsRep;
  import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.PaPkAsReq;
 +import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.PkAuthenticator;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +import sun.security.pkcs.ContentInfo;
 +import sun.security.pkcs.PKCS7;
  
 +import javax.crypto.interfaces.DHPublicKey;
 +import java.io.ByteArrayOutputStream;
 +import java.io.File;
 +import java.io.FileInputStream;
 +import java.io.FileNotFoundException;
 +import java.io.IOException;
 +import java.io.InputStream;
 +import java.math.BigInteger;
 +import java.security.cert.X509Certificate;
 +import java.util.ArrayList;
 +import java.util.Arrays;
  import java.util.HashMap;
 +import java.util.List;
  import java.util.Map;
 +import java.util.Scanner;
  
  public class PkinitPreauth extends AbstractPreauthPlugin {
  

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/67c2bb6e/pom.xml
----------------------------------------------------------------------


[03/17] directory-kerby git commit: DIRKRB-475 The decoded asn1 object with the wrong tagFlags.

Posted by pl...@apache.org.
DIRKRB-475 The decoded asn1 object with the wrong tagFlags.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/8194b218
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/8194b218
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/8194b218

Branch: refs/heads/pkinit-support
Commit: 8194b218129a73ffb6f8af48aa06718a672ad3e7
Parents: e69ab4d
Author: plusplusjiajia <ji...@intel.com>
Authored: Thu Nov 26 10:27:23 2015 +0800
Committer: plusplusjiajia <ji...@intel.com>
Committed: Thu Nov 26 10:27:23 2015 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java    | 3 ++-
 .../test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java | 2 ++
 .../src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java    | 3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8194b218/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
index f0fbf35..74bf6e3 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
@@ -209,9 +209,10 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
     protected void decode(LimitedByteBuffer content) throws IOException {
         int tag = readTag(content);
         int tagNo = readTagNo(content, tag);
+        int tagFlags = tag & 0xe0;
         int length = readLength(content);
 
-        decode(tag, tagNo, new LimitedByteBuffer(content, length));
+        decode(tagFlags, tagNo, new LimitedByteBuffer(content, length));
     }
 
     public void decode(int tagFlags, int tagNo,

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8194b218/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java b/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
index da6c7ce..f5543f7 100644
--- a/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
+++ b/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
@@ -41,5 +41,7 @@ public class CodecTest {
         assertThat(restored).isNotNull();
         assertThat(restored.getCksumtype()).isEqualTo(mcs.getCksumtype());
         assertThat(mcs.getChecksum()).isEqualTo(restored.getChecksum());
+        assertThat(restored.tagNo()).isEqualTo(mcs.tagNo());
+        assertThat(restored.tagFlags()).isEqualTo(mcs.tagFlags());
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8194b218/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
index fd3d4ba..4827961 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
@@ -67,6 +67,7 @@ public class KrbCodec {
         LimitedByteBuffer limitedBuffer = new LimitedByteBuffer(byteBuffer);
         int tag = AbstractAsn1Type.readTag(limitedBuffer);
         int tagNo = AbstractAsn1Type.readTagNo(limitedBuffer, tag);
+        int tagFlags = tag & 0xe0;
         int length = AbstractAsn1Type.readLength(limitedBuffer);
         LimitedByteBuffer valueBuffer = new LimitedByteBuffer(limitedBuffer, length);
 
@@ -89,7 +90,7 @@ public class KrbCodec {
         } else {
             throw new IOException("To be supported krb message type with tag: " + tag);
         }
-        msg.decode(tag, tagNo, valueBuffer);
+        msg.decode(tagFlags, tagNo, valueBuffer);
 
         return msg;
     }


[06/17] directory-kerby git commit: Renamed the method: getIntValue to getValue

Posted by pl...@apache.org.
Renamed the method: getIntValue to getValue


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/28bb76d8
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/28bb76d8
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/28bb76d8

Branch: refs/heads/pkinit-support
Commit: 28bb76d8e1a7e5e71596aed14a33db819a0efd81
Parents: 1f4b21c
Author: Kai Zheng <ka...@intel.com>
Authored: Thu Nov 26 19:45:24 2015 +0800
Committer: Kai Zheng <ka...@intel.com>
Committed: Thu Nov 26 19:45:24 2015 +0800

----------------------------------------------------------------------
 .../java/org/apache/kerby/asn1/type/Asn1EnumType.java     |  2 +-
 .../main/java/org/apache/kerby/asn1/type/Asn1Flags.java   | 10 +++++-----
 .../test/java/org/apache/kerby/asn1/TestAsn1Flags.java    |  2 +-
 .../kerberos/kdc/identitybackend/LdapIdentityBackend.java |  2 +-
 .../main/java/org/apache/kerby/KrbIdentitySerializer.java |  2 +-
 .../org/apache/kerby/kerberos/kerb/preauth/PaFlag.java    |  4 ++--
 .../apache/kerby/kerberos/kerb/codec/TestAsReqCodec.java  |  8 ++++----
 .../apache/kerby/kerberos/kerb/codec/TestTgsReqCodec.java |  8 ++++----
 .../java/org/apache/kerby/kerberos/kerb/KrbErrorCode.java |  4 ++--
 .../kerby/kerberos/kerb/spec/KrbAppSequenceType.java      |  2 +-
 .../apache/kerby/kerberos/kerb/spec/KrbSequenceType.java  |  2 +-
 .../kerberos/kerb/spec/ad/AuthorizationDataEntry.java     |  2 +-
 .../kerby/kerberos/kerb/spec/ad/AuthorizationType.java    |  4 ++--
 .../org/apache/kerby/kerberos/kerb/spec/ap/ApOption.java  |  4 ++--
 .../apache/kerby/kerberos/kerb/spec/base/CheckSum.java    |  2 +-
 .../kerby/kerberos/kerb/spec/base/CheckSumType.java       |  4 ++--
 .../kerby/kerberos/kerb/spec/base/EncryptedData.java      |  2 +-
 .../kerby/kerberos/kerb/spec/base/EncryptionKey.java      |  2 +-
 .../kerby/kerberos/kerb/spec/base/EncryptionType.java     |  4 ++--
 .../kerby/kerberos/kerb/spec/base/HostAddrType.java       |  4 ++--
 .../apache/kerby/kerberos/kerb/spec/base/HostAddress.java |  2 +-
 .../apache/kerby/kerberos/kerb/spec/base/KeyUsage.java    |  4 ++--
 .../apache/kerby/kerberos/kerb/spec/base/KrbMessage.java  |  4 ++--
 .../kerby/kerberos/kerb/spec/base/KrbMessageType.java     |  4 ++--
 .../apache/kerby/kerberos/kerb/spec/base/KrbToken.java    |  2 +-
 .../kerby/kerberos/kerb/spec/base/LastReqEntry.java       |  2 +-
 .../apache/kerby/kerberos/kerb/spec/base/LastReqType.java |  4 ++--
 .../apache/kerby/kerberos/kerb/spec/base/NameType.java    |  4 ++--
 .../kerby/kerberos/kerb/spec/base/PrincipalName.java      |  2 +-
 .../org/apache/kerby/kerberos/kerb/spec/base/SamType.java |  4 ++--
 .../apache/kerby/kerberos/kerb/spec/base/TokenFormat.java |  4 ++--
 .../kerberos/kerb/spec/base/TransitedEncodingType.java    |  4 ++--
 .../apache/kerby/kerberos/kerb/spec/fast/ArmorType.java   |  4 ++--
 .../apache/kerby/kerberos/kerb/spec/fast/FastOption.java  |  4 ++--
 .../kerby/kerberos/kerb/spec/fast/KrbFastArmor.java       |  2 +-
 .../kerby/kerberos/kerb/spec/fast/PaAuthnEntry.java       |  2 +-
 .../apache/kerby/kerberos/kerb/spec/kdc/KdcOption.java    |  4 ++--
 .../apache/kerby/kerberos/kerb/spec/kdc/KdcReqBody.java   |  2 +-
 .../kerberos/kerb/spec/pa/PaAuthenticationSetElem.java    |  2 +-
 .../apache/kerby/kerberos/kerb/spec/pa/PaDataEntry.java   |  2 +-
 .../apache/kerby/kerberos/kerb/spec/pa/PaDataType.java    |  4 ++--
 .../kerby/kerberos/kerb/spec/pa/token/TokenFlag.java      |  4 ++--
 .../kerby/kerberos/kerb/spec/pa/token/TokenFlags.java     |  2 +-
 .../kerby/kerberos/kerb/spec/ticket/TicketFlag.java       |  4 ++--
 .../kerby/kerberos/kerb/spec/ticket/TicketFlags.java      |  2 +-
 .../kerby/kerberos/kerb/crypto/CheckSumHandler.java       |  4 ++--
 .../kerby/kerberos/kerb/crypto/EncryptionHandler.java     |  6 +++---
 .../kerby/kerberos/kerb/identity/backend/BackendTest.java |  4 ++--
 .../kerby/kerberos/kerb/ccache/CredCacheOutputStream.java | 10 +++++-----
 .../org/apache/kerby/kerberos/kerb/ccache/Credential.java |  2 +-
 .../kerby/kerberos/kerb/keytab/KeytabOutputStream.java    |  4 ++--
 51 files changed, 91 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1EnumType.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1EnumType.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1EnumType.java
index 12e5e65..7210aee 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1EnumType.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1EnumType.java
@@ -23,5 +23,5 @@ package org.apache.kerby.asn1.type;
  * A helper interface used by Asn1Enumerated.
  */
 public interface Asn1EnumType {
-    int getIntValue();
+    int getValue();
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Flags.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Flags.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Flags.java
index a9b57f2..9c219df 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Flags.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Flags.java
@@ -82,23 +82,23 @@ public class Asn1Flags extends Asn1BitString {
     }
 
     public boolean isFlagSet(Asn1EnumType flag) {
-        return isFlagSet(flag.getIntValue());
+        return isFlagSet(flag.getValue());
     }
 
     public void setFlag(Asn1EnumType flag) {
-        setFlag(flag.getIntValue());
+        setFlag(flag.getValue());
     }
 
     public void setFlag(Asn1EnumType flag, boolean isSet)  {
         if (isSet) {
-            setFlag(flag.getIntValue());
+            setFlag(flag.getValue());
         } else {
-            clearFlag(flag.getIntValue());
+            clearFlag(flag.getValue());
         }
     }
 
     public void clearFlag(Asn1EnumType flag) {
-        clearFlag(flag.getIntValue());
+        clearFlag(flag.getValue());
     }
 
     private void flags2Value() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Flags.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Flags.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Flags.java
index e866831..ef70a69 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Flags.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Flags.java
@@ -56,7 +56,7 @@ public class TestAsn1Flags {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
       return value;
     }
   }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
----------------------------------------------------------------------
diff --git a/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java b/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
index 993f63e..3c9c39e 100644
--- a/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
+++ b/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
@@ -162,7 +162,7 @@ public class LdapIdentityBackend extends AbstractIdentityBackend {
             this.kvnos = new String[keymap.size()];
             int i = 0;
             for (Map.Entry<EncryptionType, EncryptionKey> entryKey : keymap.entrySet()) {
-                etypes[i] = entryKey.getKey().getIntValue() + "";
+                etypes[i] = entryKey.getKey().getValue() + "";
                 keys[i] = entryKey.getValue().encode();
                 kvnos[i] = entryKey.getValue().getKvno() + "";
                 i++;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-backend/mavibot-backend/src/main/java/org/apache/kerby/KrbIdentitySerializer.java
----------------------------------------------------------------------
diff --git a/kerby-backend/mavibot-backend/src/main/java/org/apache/kerby/KrbIdentitySerializer.java b/kerby-backend/mavibot-backend/src/main/java/org/apache/kerby/KrbIdentitySerializer.java
index 61fef87..22766ec 100644
--- a/kerby-backend/mavibot-backend/src/main/java/org/apache/kerby/KrbIdentitySerializer.java
+++ b/kerby-backend/mavibot-backend/src/main/java/org/apache/kerby/KrbIdentitySerializer.java
@@ -85,7 +85,7 @@ public class KrbIdentitySerializer implements ElementSerializer<KrbIdentity> {
             out.write(IntSerializer.serialize(keys.size()));
             
             for (EncryptionKey ek : keys.values()) {
-                int type = ek.getKeyType().getIntValue();
+                int type = ek.getKeyType().getValue();
                 out.write(IntSerializer.serialize(type));
                 byte[] data = ek.getKeyData();
                 out.write(IntSerializer.serialize(data.length));

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/PaFlag.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/PaFlag.java b/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/PaFlag.java
index 99fd33e..f67ab90 100644
--- a/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/PaFlag.java
+++ b/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/preauth/PaFlag.java
@@ -33,13 +33,13 @@ public enum PaFlag implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static PaFlag fromValue(int value) {
         for (Asn1EnumType e : values()) {
-            if (e.getIntValue() == value) {
+            if (e.getValue() == value) {
                 return (PaFlag) e;
             }
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestAsReqCodec.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestAsReqCodec.java b/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestAsReqCodec.java
index 94b9c16..21317a9 100644
--- a/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestAsReqCodec.java
+++ b/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestAsReqCodec.java
@@ -90,12 +90,12 @@ public class TestAsReqCodec {
 
         List<EncryptionType> types = body.getEtypes();
         assertThat(types).hasSize(7);
-        assertThat(types.get(0).getIntValue()).isEqualTo(0x0017);
+        assertThat(types.get(0).getValue()).isEqualTo(0x0017);
         //assertThat(types.get(1).getValue()).isEqualTo(0xff7b);//FIXME
         //assertThat(types.get(2).getValue()).isEqualTo(0x0080);//FIXME
-        assertThat(types.get(3).getIntValue()).isEqualTo(0x0003);
-        assertThat(types.get(4).getIntValue()).isEqualTo(0x0001);
-        assertThat(types.get(5).getIntValue()).isEqualTo(0x0018);
+        assertThat(types.get(3).getValue()).isEqualTo(0x0003);
+        assertThat(types.get(4).getValue()).isEqualTo(0x0001);
+        assertThat(types.get(5).getValue()).isEqualTo(0x0018);
         //assertThat(types.get(6).getValue()).isEqualTo(0xff79);//FIXME
 
         List<HostAddress> hostAddress = body.getAddresses().getElements();

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestTgsReqCodec.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestTgsReqCodec.java b/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestTgsReqCodec.java
index 5fabbce..de75355 100644
--- a/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestTgsReqCodec.java
+++ b/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/TestTgsReqCodec.java
@@ -81,12 +81,12 @@ public class TestTgsReqCodec {
 
         List<EncryptionType> eTypes = body.getEtypes();
         assertThat(eTypes).hasSize(7);
-        assertThat(eTypes.get(0).getIntValue()).isEqualTo(0x0017);
+        assertThat(eTypes.get(0).getValue()).isEqualTo(0x0017);
         //assertThat(eTypes.get(1).getValue()).isEqualTo(-133);//FIXME
         //assertThat(eTypes.get(2).getValue()).isEqualTo(-128);//FIXME
-        assertThat(eTypes.get(3).getIntValue()).isEqualTo(0x0003);
-        assertThat(eTypes.get(4).getIntValue()).isEqualTo(0x0001);
-        assertThat(eTypes.get(5).getIntValue()).isEqualTo(0x0018);
+        assertThat(eTypes.get(3).getValue()).isEqualTo(0x0003);
+        assertThat(eTypes.get(4).getValue()).isEqualTo(0x0001);
+        assertThat(eTypes.get(5).getValue()).isEqualTo(0x0018);
         //assertThat(eTypes.get(6).getValue()).isEqualTo(-135);//FIXME
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbErrorCode.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbErrorCode.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbErrorCode.java
index ef0a3d1..33b0689 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbErrorCode.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbErrorCode.java
@@ -109,7 +109,7 @@ public enum KrbErrorCode implements Asn1EnumType {
     public static KrbErrorCode fromValue(Integer value) {
         if (value != null) {
             for (Asn1EnumType e : values()) {
-                if (e.getIntValue() == value.intValue()) {
+                if (e.getValue() == value.intValue()) {
                     return (KrbErrorCode) e;
                 }
             }
@@ -118,7 +118,7 @@ public enum KrbErrorCode implements Asn1EnumType {
         return KRB_ERR_GENERIC;
     }
 
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java
index 6e4e1bd..5e83189 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java
@@ -52,6 +52,6 @@ public abstract class KrbAppSequenceType extends TaggingSequence {
     }
 
     protected void setField(int index, Asn1EnumType krbEnum) {
-        setFieldAsInt(index, krbEnum.getIntValue());
+        setFieldAsInt(index, krbEnum.getValue());
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbSequenceType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbSequenceType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbSequenceType.java
index 388de92..b9902bc 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbSequenceType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbSequenceType.java
@@ -50,6 +50,6 @@ public abstract class KrbSequenceType extends Asn1SequenceType {
     }
 
     protected void setField(int index, Asn1EnumType value) {
-        setFieldAsInt(index, value.getIntValue());
+        setFieldAsInt(index, value.getValue());
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationDataEntry.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationDataEntry.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationDataEntry.java
index 113c9c4..07b04d7 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationDataEntry.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationDataEntry.java
@@ -49,7 +49,7 @@ public class AuthorizationDataEntry extends KrbSequenceType {
     }
 
     public void setAuthzType(AuthorizationType authzType) {
-        setFieldAsInt(AD_TYPE, authzType.getIntValue());
+        setFieldAsInt(AD_TYPE, authzType.getValue());
     }
 
     public byte[] getAuthzData() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationType.java
index aecc138..f4c4988 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationType.java
@@ -125,14 +125,14 @@ public enum AuthorizationType implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static AuthorizationType fromValue(Integer value) {
         if (value != null) {
             for (Asn1EnumType e : values()) {
-                if (e.getIntValue() == value.intValue()) {
+                if (e.getValue() == value.intValue()) {
                     return (AuthorizationType) e;
                 }
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApOption.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApOption.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApOption.java
index 4faf643..b62d298 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApOption.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApOption.java
@@ -42,13 +42,13 @@ public enum ApOption implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static ApOption fromValue(int value) {
         for (Asn1EnumType e : values()) {
-            if (e.getIntValue() == value) {
+            if (e.getValue() == value) {
                 return (ApOption) e;
             }
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSum.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSum.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSum.java
index d40fa81..b0ec6b8 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSum.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSum.java
@@ -62,7 +62,7 @@ public class CheckSum extends KrbSequenceType {
     }
 
     public void setCksumtype(CheckSumType cksumtype) {
-        setFieldAsInt(CKSUM_TYPE, cksumtype.getIntValue());
+        setFieldAsInt(CKSUM_TYPE, cksumtype.getValue());
     }
 
     public byte[] getChecksum() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSumType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSumType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSumType.java
index a4c7498..8e6347a 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSumType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSumType.java
@@ -81,7 +81,7 @@ public enum CheckSumType implements Asn1EnumType {
     public static CheckSumType fromValue(Integer value) {
         if (value != null) {
             for (Asn1EnumType e : values()) {
-                if (e.getIntValue() == value) {
+                if (e.getValue() == value) {
                     return (CheckSumType) e;
                 }
             }
@@ -101,7 +101,7 @@ public enum CheckSumType implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptedData.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptedData.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptedData.java
index 8e4dca7..2092560 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptedData.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptedData.java
@@ -54,7 +54,7 @@ public class EncryptedData extends KrbSequenceType {
     }
 
     public void setEType(EncryptionType eType) {
-        setFieldAsInt(ETYPE, eType.getIntValue());
+        setFieldAsInt(ETYPE, eType.getValue());
     }
 
     public int getKvno() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionKey.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionKey.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionKey.java
index b15160a..4f00a46 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionKey.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionKey.java
@@ -72,7 +72,7 @@ public class EncryptionKey extends KrbSequenceType {
     }
 
     public void setKeyType(EncryptionType keyType) {
-        setFieldAsInt(KEY_TYPE, keyType.getIntValue());
+        setFieldAsInt(KEY_TYPE, keyType.getValue());
     }
 
     public byte[] getKeyData() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionType.java
index f173c09..752ca27 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionType.java
@@ -96,7 +96,7 @@ public enum EncryptionType implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
@@ -119,7 +119,7 @@ public enum EncryptionType implements Asn1EnumType {
     public static EncryptionType fromValue(Integer value) {
         if (value != null) {
             for (Asn1EnumType e : values()) {
-                if (e.getIntValue() == value) {
+                if (e.getValue() == value) {
                     return (EncryptionType) e;
                 }
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddrType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddrType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddrType.java
index 1b8b616..33342da 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddrType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddrType.java
@@ -82,14 +82,14 @@ public enum HostAddrType implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static HostAddrType fromValue(Integer value) {
         if (value != null) {
             for (Asn1EnumType e : values()) {
-                if (e.getIntValue() == value.intValue()) {
+                if (e.getValue() == value.intValue()) {
                     return (HostAddrType) e;
                 }
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddress.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddress.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddress.java
index 2fd33d4..2c2a1b8 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddress.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddress.java
@@ -99,7 +99,7 @@ public class HostAddress extends KrbSequenceType {
 
     @Override
     public int hashCode() {
-        int result = getAddrType().getIntValue();
+        int result = getAddrType().getValue();
         if (getAddress() != null) {
             result = 31 * result + Arrays.hashCode(getAddress());
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KeyUsage.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KeyUsage.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KeyUsage.java
index 2cdb10b..1715865 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KeyUsage.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KeyUsage.java
@@ -108,14 +108,14 @@ public enum KeyUsage implements Asn1EnumType {
         this.value = value;
     }
 
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static KeyUsage fromValue(Integer value) {
         if (value != null) {
             for (Asn1EnumType e : values()) {
-                if (e.getIntValue() == value) {
+                if (e.getValue() == value) {
                     return (KeyUsage) e;
                 }
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbMessage.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbMessage.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbMessage.java
index 904a919..0b1297c 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbMessage.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbMessage.java
@@ -30,7 +30,7 @@ public abstract class KrbMessage extends KrbAppSequenceType {
     private final int pvno = KrbConstant.KRB_V5;
 
     public KrbMessage(KrbMessageType msgType, Asn1FieldInfo[] fieldInfos) {
-        super(msgType.getIntValue(), fieldInfos);
+        super(msgType.getValue(), fieldInfos);
         setPvno(pvno);
         setMsgType(msgType);
     }
@@ -49,6 +49,6 @@ public abstract class KrbMessage extends KrbAppSequenceType {
     }
 
     public void setMsgType(KrbMessageType msgType) {
-        setFieldAsInt(MSG_TYPE, msgType.getIntValue());
+        setFieldAsInt(MSG_TYPE, msgType.getValue());
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbMessageType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbMessageType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbMessageType.java
index 32d22cb..464c87d 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbMessageType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbMessageType.java
@@ -41,14 +41,14 @@ public enum KrbMessageType implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static KrbMessageType fromValue(Integer value) {
         if (value != null) {
             for (Asn1EnumType e : values()) {
-                if (e.getIntValue() == value.intValue()) {
+                if (e.getValue() == value.intValue()) {
                     return (KrbMessageType) e;
                 }
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbToken.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbToken.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbToken.java
index 970692e..c40b7bb 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbToken.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbToken.java
@@ -149,7 +149,7 @@ public class KrbToken extends KrbSequenceType implements AuthToken {
      * @param tokenFormat The token format
      */
     public void setTokenFormat(TokenFormat tokenFormat) {
-        setFieldAsInt(TOKEN_FORMAT, tokenFormat.getIntValue());
+        setFieldAsInt(TOKEN_FORMAT, tokenFormat.getValue());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqEntry.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqEntry.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqEntry.java
index f6e4d16..c2553d8 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqEntry.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqEntry.java
@@ -49,7 +49,7 @@ public class LastReqEntry extends KrbSequenceType {
     }
 
     public void setLrType(LastReqType lrType) {
-        setFieldAsInt(LR_TYPE, lrType.getIntValue());
+        setFieldAsInt(LR_TYPE, lrType.getValue());
     }
 
     public KerberosTime getLrValue() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqType.java
index 5064de0..8113fe9 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqType.java
@@ -45,14 +45,14 @@ public enum LastReqType implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static LastReqType fromValue(Integer value) {
         if (value != null) {
             for (Asn1EnumType e : values()) {
-                if (e.getIntValue() == value) {
+                if (e.getValue() == value) {
                     return (LastReqType) e;
                 }
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/NameType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/NameType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/NameType.java
index 8f61bc3..86055f4 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/NameType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/NameType.java
@@ -36,14 +36,14 @@ public enum NameType implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static NameType fromValue(Integer value) {
         if (value != null) {
             for (Asn1EnumType e : values()) {
-                if (e.getIntValue() == value.intValue()) {
+                if (e.getValue() == value.intValue()) {
                     return (NameType) e;
                 }
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/PrincipalName.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/PrincipalName.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/PrincipalName.java
index 496e36d..4bf6e0f 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/PrincipalName.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/PrincipalName.java
@@ -103,7 +103,7 @@ public class PrincipalName extends KrbSequenceType {
     }
 
     public void setNameType(NameType nameType) {
-        setFieldAsInt(NAME_TYPE, nameType.getIntValue());
+        setFieldAsInt(NAME_TYPE, nameType.getValue());
     }
 
     public List<String> getNameStrings() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/SamType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/SamType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/SamType.java
index 7461672..bf8fad7 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/SamType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/SamType.java
@@ -48,14 +48,14 @@ public enum SamType implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static SamType fromValue(Integer value) {
         if (value != null) {
             for (SamType st : SamType.values()) {
-                if (value == st.getIntValue()) {
+                if (value == st.getValue()) {
                     return st;
                 }
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TokenFormat.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TokenFormat.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TokenFormat.java
index de9aad8..f4e2a7d 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TokenFormat.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TokenFormat.java
@@ -32,14 +32,14 @@ public enum TokenFormat implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static TokenFormat fromValue(Integer value) {
         if (value != null) {
             for (Asn1EnumType e : values()) {
-                if (e.getIntValue() == value.intValue()) {
+                if (e.getValue() == value.intValue()) {
                     return (TokenFormat) e;
                 }
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TransitedEncodingType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TransitedEncodingType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TransitedEncodingType.java
index 83de2bc..a7616ac 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TransitedEncodingType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TransitedEncodingType.java
@@ -33,14 +33,14 @@ public enum TransitedEncodingType implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static TransitedEncodingType fromValue(Integer value) {
         if (value != null) {
             for (Asn1EnumType e : values()) {
-                if (e.getIntValue() == value.intValue()) {
+                if (e.getValue() == value.intValue()) {
                     return (TransitedEncodingType) e;
                 }
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/ArmorType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/ArmorType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/ArmorType.java
index 05d5f0e..65184a7 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/ArmorType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/ArmorType.java
@@ -32,14 +32,14 @@ public enum ArmorType implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static ArmorType fromValue(Integer value) {
         if (value != null) {
             for (Asn1EnumType e : values()) {
-                if (e.getIntValue() == value.intValue()) {
+                if (e.getValue() == value.intValue()) {
                     return (ArmorType) e;
                 }
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/FastOption.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/FastOption.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/FastOption.java
index 39bfbbb..adc6445 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/FastOption.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/FastOption.java
@@ -35,13 +35,13 @@ public enum FastOption implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static FastOption fromValue(int value) {
         for (Asn1EnumType e : values()) {
-            if (e.getIntValue() == value) {
+            if (e.getValue() == value) {
                 return (FastOption) e;
             }
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmor.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmor.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmor.java
index 4b7d04d..71227ba 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmor.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmor.java
@@ -51,7 +51,7 @@ public class KrbFastArmor extends KrbSequenceType {
     }
 
     public void setArmorType(ArmorType armorType) {
-        setFieldAsInt(ARMOR_TYPE, armorType.getIntValue());
+        setFieldAsInt(ARMOR_TYPE, armorType.getValue());
     }
 
     public byte[] getArmorValue() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaAuthnEntry.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaAuthnEntry.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaAuthnEntry.java
index da15051..34f60fa 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaAuthnEntry.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaAuthnEntry.java
@@ -59,7 +59,7 @@ public class PaAuthnEntry extends KrbSequenceType {
     }
 
     public void setPaType(PaDataType paDataType) {
-        setFieldAsInt(PA_TYPE, paDataType.getIntValue());
+        setFieldAsInt(PA_TYPE, paDataType.getValue());
     }
 
     public byte[] getPaHint() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcOption.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcOption.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcOption.java
index 57633b5..98c1438 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcOption.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcOption.java
@@ -63,13 +63,13 @@ public enum KdcOption implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static KdcOption fromValue(int value) {
         for (Asn1EnumType e : values()) {
-            if (e.getIntValue() == value) {
+            if (e.getValue() == value) {
                 return (KdcOption) e;
             }
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReqBody.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReqBody.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReqBody.java
index 081b0a0..a9b3c48 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReqBody.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReqBody.java
@@ -141,7 +141,7 @@ public class KdcReqBody extends KrbSequenceType {
     public void setEtypes(List<EncryptionType> etypes) {
         List<Integer> values = new ArrayList<Integer>();
         for (EncryptionType etype: etypes) {
-            values.add(etype.getIntValue());
+            values.add(etype.getValue());
         }
         KrbIntegers value = new KrbIntegers(values);
         setFieldAs(ETYPE, value);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaAuthenticationSetElem.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaAuthenticationSetElem.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaAuthenticationSetElem.java
index 62f90b5..48fbef9 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaAuthenticationSetElem.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaAuthenticationSetElem.java
@@ -53,7 +53,7 @@ public class PaAuthenticationSetElem extends KrbSequenceType {
     }
 
     public void setPaType(PaDataType paDataType) {
-        setFieldAsInt(PA_TYPE, paDataType.getIntValue());
+        setFieldAsInt(PA_TYPE, paDataType.getValue());
     }
 
     public byte[] getPaHint() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataEntry.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataEntry.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataEntry.java
index f9a9170..901eb06 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataEntry.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataEntry.java
@@ -56,7 +56,7 @@ public class PaDataEntry extends KrbSequenceType {
     }
 
     public void setPaDataType(PaDataType paDataType) {
-        setFieldAsInt(PADATA_TYPE, paDataType.getIntValue());
+        setFieldAsInt(PADATA_TYPE, paDataType.getValue());
     }
 
     public byte[] getPaDataValue() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataType.java
index a29540b..3656b5e 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataType.java
@@ -74,14 +74,14 @@ public enum PaDataType implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static PaDataType fromValue(Integer value) {
         if (value != null) {
             for (Asn1EnumType e : values()) {
-                if (e.getIntValue() == value.intValue()) {
+                if (e.getValue() == value.intValue()) {
                     return (PaDataType) e;
                 }
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenFlag.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenFlag.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenFlag.java
index ea3fac7..512cda2 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenFlag.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenFlag.java
@@ -35,13 +35,13 @@ public enum TokenFlag implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static TokenFlag fromValue(int value) {
         for (Asn1EnumType e : values()) {
-            if (e.getIntValue() == value) {
+            if (e.getValue() == value) {
                 return (TokenFlag) e;
             }
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenFlags.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenFlags.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenFlags.java
index ec34811..026c054 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenFlags.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/token/TokenFlags.java
@@ -34,6 +34,6 @@ public class TokenFlags extends Asn1Flags {
     }
 
     public boolean isInvalid() {
-        return isFlagSet(INVALID.getIntValue());
+        return isFlagSet(INVALID.getValue());
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TicketFlag.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TicketFlag.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TicketFlag.java
index 56ac780..ef53cee 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TicketFlag.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TicketFlag.java
@@ -46,13 +46,13 @@ public enum TicketFlag implements Asn1EnumType {
     }
 
     @Override
-    public int getIntValue() {
+    public int getValue() {
         return value;
     }
 
     public static TicketFlag fromValue(int value) {
         for (Asn1EnumType e : values()) {
-            if (e.getIntValue() == value) {
+            if (e.getValue() == value) {
                 return (TicketFlag) e;
             }
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TicketFlags.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TicketFlags.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TicketFlags.java
index 240af65..88f5c01 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TicketFlags.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ticket/TicketFlags.java
@@ -34,6 +34,6 @@ public class TicketFlags extends Asn1Flags {
     }
 
     public boolean isInvalid() {
-        return isFlagSet(INVALID.getIntValue());
+        return isFlagSet(INVALID.getValue());
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumHandler.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumHandler.java
index b2b30b4..5fb7d42 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumHandler.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/CheckSumHandler.java
@@ -157,7 +157,7 @@ public class CheckSumHandler {
     public static CheckSum checksumWithKey(CheckSumType checkSumType,
                            byte[] bytes, byte[] key, KeyUsage usage) throws KrbException {
         CheckSumTypeHandler handler = getCheckSumHandler(checkSumType);
-        byte[] checksumBytes = handler.checksumWithKey(bytes, key, usage.getIntValue());
+        byte[] checksumBytes = handler.checksumWithKey(bytes, key, usage.getValue());
         CheckSum checkSum = new CheckSum();
         checkSum.setCksumtype(checkSumType);
         checkSum.setChecksum(checksumBytes);
@@ -169,6 +169,6 @@ public class CheckSumHandler {
         CheckSumType checkSumType = checkSum.getCksumtype();
         CheckSumTypeHandler handler = getCheckSumHandler(checkSumType);
         return handler.verifyWithKey(bytes, key,
-                usage.getIntValue(), checkSum.getChecksum());
+                usage.getValue(), checkSum.getChecksum());
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/EncryptionHandler.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/EncryptionHandler.java b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/EncryptionHandler.java
index 4438ec6..a5e18df 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/EncryptionHandler.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/EncryptionHandler.java
@@ -199,7 +199,7 @@ public class EncryptionHandler {
     public static EncryptedData encrypt(byte[] plainText, EncryptionKey key,
                                         KeyUsage usage) throws KrbException {
         EncTypeHandler handler = getEncHandler(key.getKeyType());
-        byte[] cipher = handler.encrypt(plainText, key.getKeyData(), usage.getIntValue());
+        byte[] cipher = handler.encrypt(plainText, key.getKeyData(), usage.getValue());
 
         EncryptedData ed = new EncryptedData();
         ed.setCipher(cipher);
@@ -224,7 +224,7 @@ public class EncryptionHandler {
                                  KeyUsage usage) throws KrbException {
         EncTypeHandler handler = getEncHandler(key.getKeyType());
 
-        byte[] plainData = handler.decrypt(data, key.getKeyData(), usage.getIntValue());
+        byte[] plainData = handler.decrypt(data, key.getKeyData(), usage.getValue());
         return plainData;
     }
 
@@ -242,7 +242,7 @@ public class EncryptionHandler {
         EncTypeHandler handler = getEncHandler(key.getKeyType());
 
         byte[] plainData = handler.decrypt(data.getCipher(),
-                key.getKeyData(), usage.getIntValue());
+                key.getKeyData(), usage.getValue());
         return plainData;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-identity-test/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/BackendTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-identity-test/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/BackendTest.java b/kerby-kerb/kerb-identity-test/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/BackendTest.java
index 6384860..ccb738c 100644
--- a/kerby-kerb/kerb-identity-test/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/BackendTest.java
+++ b/kerby-kerb/kerb-identity-test/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/BackendTest.java
@@ -48,9 +48,9 @@ public abstract class BackendTest {
         assertThat(identity.isDisabled()).isEqualTo(kid.isDisabled());
         assertThat(identity.getKeyVersion()).isEqualTo(kid.getKeyVersion());
         for (EncryptionKey expectedKey : kid.getKeys().values()) {
-            EncryptionType actualType = EncryptionType.fromValue(expectedKey.getKeyType().getIntValue());
+            EncryptionType actualType = EncryptionType.fromValue(expectedKey.getKeyType().getValue());
             EncryptionKey actualKey = identity.getKey(actualType);
-            assertThat(actualKey.getKeyType().getIntValue()).isEqualTo(expectedKey.getKeyType().getIntValue());
+            assertThat(actualKey.getKeyType().getValue()).isEqualTo(expectedKey.getKeyType().getValue());
             assertThat(actualKey.getKeyData()).isEqualTo(expectedKey.getKeyData());
             assertThat(actualKey.getKvno()).isEqualTo(expectedKey.getKvno());
         }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheOutputStream.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheOutputStream.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheOutputStream.java
index 1b30fe9..75e720d 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheOutputStream.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/CredCacheOutputStream.java
@@ -44,7 +44,7 @@ public class CredCacheOutputStream extends KrbOutputStream {
         List<String> nameComponents = principal.getNameStrings();
 
         if (version != CredentialCache.FCC_FVNO_1) {
-            writeInt(principal.getNameType().getIntValue());
+            writeInt(principal.getNameType().getValue());
         }
 
         int numComponents = nameComponents.size();
@@ -62,9 +62,9 @@ public class CredCacheOutputStream extends KrbOutputStream {
 
     @Override
     public void writeKey(EncryptionKey key, int version) throws IOException {
-        writeShort(key.getKeyType().getIntValue());
+        writeShort(key.getKeyType().getValue());
         if (version == CredentialCache.FCC_FVNO_3) {
-            writeShort(key.getKeyType().getIntValue());
+            writeShort(key.getKeyType().getValue());
         }
 
         writeCountedOctets(key.getKeyData());
@@ -89,7 +89,7 @@ public class CredCacheOutputStream extends KrbOutputStream {
     }
 
     public void writeAddress(HostAddress address) throws IOException {
-        write(address.getAddrType().getIntValue());
+        write(address.getAddrType().getValue());
         write(address.getAddress().length);
         write(address.getAddress(), 0,
               address.getAddress().length);
@@ -100,7 +100,7 @@ public class CredCacheOutputStream extends KrbOutputStream {
             writeInt(0);
         } else {
             for (AuthorizationDataEntry entry : authData.getElements()) {
-                write(entry.getAuthzType().getIntValue());
+                write(entry.getAuthzType().getValue());
                 write(entry.getAuthzData().length);
                 write(entry.getAuthzData());
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/Credential.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/Credential.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/Credential.java
index 9f27a77..a391089 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/Credential.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/ccache/Credential.java
@@ -108,7 +108,7 @@ public class Credential {
     }
 
     public int getEType() {
-        return key.getKeyType().getIntValue();
+        return key.getKeyType().getValue();
     }
 
     public PrincipalName getClientName() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/28bb76d8/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabOutputStream.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabOutputStream.java b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabOutputStream.java
index 4438417..3fe2280 100644
--- a/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabOutputStream.java
+++ b/kerby-kerb/kerb-util/src/main/java/org/apache/kerby/kerberos/kerb/keytab/KeytabOutputStream.java
@@ -45,12 +45,12 @@ public class KeytabOutputStream extends KrbOutputStream {
             writeCountedString(nameCom);
         }
 
-        writeInt(principal.getNameType().getIntValue()); // todo: consider the version
+        writeInt(principal.getNameType().getValue()); // todo: consider the version
     }
 
     @Override
     public void writeKey(EncryptionKey key, int version) throws IOException {
-        writeShort(key.getKeyType().getIntValue());
+        writeShort(key.getKeyType().getValue());
         writeCountedOctets(key.getKeyData());
     }
 


[02/17] directory-kerby git commit: Revert "DIRKRB-475 The decoded asn1 object with the wrong tagFlags."

Posted by pl...@apache.org.
Revert "DIRKRB-475 The decoded asn1 object with the wrong tagFlags."

This reverts commit 5706da2ebb7cc5aea15dcb186efe2995de28f6af.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/e69ab4d5
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/e69ab4d5
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/e69ab4d5

Branch: refs/heads/pkinit-support
Commit: e69ab4d5e6df87a9b0fd13743ff09f26b1be1311
Parents: 5706da2
Author: plusplusjiajia <ji...@intel.com>
Authored: Thu Nov 26 10:18:28 2015 +0800
Committer: plusplusjiajia <ji...@intel.com>
Committed: Thu Nov 26 10:18:28 2015 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java   | 3 +--
 .../java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java     | 4 +---
 .../src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java   | 3 +--
 3 files changed, 3 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e69ab4d5/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
index 305f986..f0fbf35 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
@@ -209,10 +209,9 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
     protected void decode(LimitedByteBuffer content) throws IOException {
         int tag = readTag(content);
         int tagNo = readTagNo(content, tag);
-        int tagFlags = tag & 0xe0;
         int length = readLength(content);
 
-        decode(tagNo, tagNo, new LimitedByteBuffer(content, length));
+        decode(tag, tagNo, new LimitedByteBuffer(content, length));
     }
 
     public void decode(int tagFlags, int tagNo,

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e69ab4d5/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java b/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
index 8c005b4..da6c7ce 100644
--- a/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
+++ b/kerby-kerb/kerb-core-test/src/test/java/org/apache/kerby/kerberos/kerb/codec/CodecTest.java
@@ -19,8 +19,8 @@
  */
 package org.apache.kerby.kerberos.kerb.codec;
 
-import org.apache.kerby.kerberos.kerb.KrbCodec;
 import org.apache.kerby.kerberos.kerb.KrbException;
+import org.apache.kerby.kerberos.kerb.KrbCodec;
 import org.apache.kerby.kerberos.kerb.spec.base.CheckSum;
 import org.apache.kerby.kerberos.kerb.spec.base.CheckSumType;
 import org.junit.Test;
@@ -41,7 +41,5 @@ public class CodecTest {
         assertThat(restored).isNotNull();
         assertThat(restored.getCksumtype()).isEqualTo(mcs.getCksumtype());
         assertThat(mcs.getChecksum()).isEqualTo(restored.getChecksum());
-        assertThat(restored.tagNo()).isEqualTo(mcs.tagNo());
-        assertThat(restored.tagFlags()).isEqualTo(mcs.tagFlags());
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e69ab4d5/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
index 4827961..fd3d4ba 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/KrbCodec.java
@@ -67,7 +67,6 @@ public class KrbCodec {
         LimitedByteBuffer limitedBuffer = new LimitedByteBuffer(byteBuffer);
         int tag = AbstractAsn1Type.readTag(limitedBuffer);
         int tagNo = AbstractAsn1Type.readTagNo(limitedBuffer, tag);
-        int tagFlags = tag & 0xe0;
         int length = AbstractAsn1Type.readLength(limitedBuffer);
         LimitedByteBuffer valueBuffer = new LimitedByteBuffer(limitedBuffer, length);
 
@@ -90,7 +89,7 @@ public class KrbCodec {
         } else {
             throw new IOException("To be supported krb message type with tag: " + tag);
         }
-        msg.decode(tagFlags, tagNo, valueBuffer);
+        msg.decode(tag, tagNo, valueBuffer);
 
         return msg;
     }


[08/17] directory-kerby git commit: DIRKRB-476 Allow to define explicit and implicit fields more easily for collection types

Posted by pl...@apache.org.
DIRKRB-476 Allow to define explicit and implicit fields more easily for collection types


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/a8a07691
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/a8a07691
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/a8a07691

Branch: refs/heads/pkinit-support
Commit: a8a07691afe6d3f8d96538ba1b547ba558844a48
Parents: 28bb76d
Author: Kai Zheng <ka...@intel.com>
Authored: Fri Nov 27 09:21:47 2015 +0800
Committer: Kai Zheng <ka...@intel.com>
Committed: Fri Nov 27 09:21:47 2015 +0800

----------------------------------------------------------------------
 .../apache/kerby/asn1/type/Asn1FieldInfo.java   | 14 +++------
 .../apache/kerby/asn1/type/ExplicitField.java   | 31 ++++++++++++++++++++
 .../apache/kerby/asn1/type/ImplicitField.java   | 31 ++++++++++++++++++++
 .../org/apache/kerby/asn1/PersonnelRecord.java  | 25 ++++++++--------
 .../kerberos/kerb/spec/KerberosString.java      |  1 +
 .../kerberos/kerb/spec/KrbAppSequenceType.java  |  2 +-
 .../kerberos/kerb/spec/KrbSequenceType.java     |  2 +-
 .../kerby/kerberos/kerb/spec/ad/AdToken.java    |  3 +-
 .../kerb/spec/ad/AuthorizationDataEntry.java    |  5 ++--
 .../kerby/kerberos/kerb/spec/ap/ApRep.java      |  9 +++---
 .../kerby/kerberos/kerb/spec/ap/ApReq.java      | 13 ++++----
 .../kerberos/kerb/spec/ap/Authenticator.java    | 19 ++++++------
 .../kerberos/kerb/spec/ap/EncAPRepPart.java     |  9 +++---
 .../kerby/kerberos/kerb/spec/base/CheckSum.java |  5 ++--
 .../kerberos/kerb/spec/base/EncryptedData.java  |  7 +++--
 .../kerberos/kerb/spec/base/EncryptionKey.java  |  5 ++--
 .../kerb/spec/base/EtypeInfo2Entry.java         |  7 +++--
 .../kerberos/kerb/spec/base/EtypeInfoEntry.java |  5 ++--
 .../kerberos/kerb/spec/base/HostAddress.java    |  5 ++--
 .../kerby/kerberos/kerb/spec/base/KrbError.java | 27 +++++++++--------
 .../kerby/kerberos/kerb/spec/base/KrbToken.java |  5 ++--
 .../kerberos/kerb/spec/base/LastReqEntry.java   |  5 ++--
 .../kerberos/kerb/spec/base/PrincipalName.java  |  5 ++--
 .../kerb/spec/base/TransitedEncoding.java       |  5 ++--
 .../kerberos/kerb/spec/fast/KrbFastArmor.java   |  5 ++--
 .../kerb/spec/fast/KrbFastArmoredRep.java       |  3 +-
 .../kerb/spec/fast/KrbFastArmoredReq.java       |  7 +++--
 .../kerb/spec/fast/KrbFastFinished.java         |  7 +++--
 .../kerberos/kerb/spec/fast/KrbFastReq.java     |  7 +++--
 .../kerb/spec/fast/KrbFastResponse.java         |  9 +++---
 .../kerberos/kerb/spec/fast/PaAuthnEntry.java   |  7 +++--
 .../kerberos/kerb/spec/fast/PaFxFastReply.java  |  3 +-
 .../kerb/spec/fast/PaFxFastRequest.java         |  3 +-
 .../kerberos/kerb/spec/kdc/EncKdcRepPart.java   | 25 ++++++++--------
 .../kerby/kerberos/kerb/spec/kdc/KdcRep.java    | 15 +++++-----
 .../kerby/kerberos/kerb/spec/kdc/KdcReq.java    |  9 +++---
 .../kerberos/kerb/spec/kdc/KdcReqBody.java      | 25 ++++++++--------
 .../kerb/spec/pa/PaAuthenticationSetElem.java   |  7 +++--
 .../kerberos/kerb/spec/pa/PaDataEntry.java      |  5 ++--
 .../kerby/kerberos/kerb/spec/pa/PaEncTsEnc.java |  5 ++--
 .../kerberos/kerb/spec/pa/otp/OtpTokenInfo.java | 19 ++++++------
 .../kerb/spec/pa/otp/PaOtpChallenge.java        | 11 +++----
 .../kerberos/kerb/spec/pa/pkinit/AuthPack.java  |  9 +++---
 .../kerberos/kerb/spec/pa/pkinit/DHRepInfo.java |  6 ++--
 .../pa/pkinit/ExternalPrincipalIdentifier.java  |  7 +++--
 .../kerb/spec/pa/pkinit/KdcDHKeyInfo.java       |  7 +++--
 .../kerb/spec/pa/pkinit/Krb5PrincipalName.java  |  5 ++--
 .../kerberos/kerb/spec/pa/pkinit/PaPkAsRep.java |  6 ++--
 .../kerberos/kerb/spec/pa/pkinit/PaPkAsReq.java |  8 +++--
 .../kerb/spec/pa/pkinit/PkAuthenticator.java    |  9 +++---
 .../kerb/spec/pa/pkinit/ReplyKeyPack.java       |  5 ++--
 .../kerb/spec/pa/token/PaTokenChallenge.java    |  3 +-
 .../kerb/spec/pa/token/PaTokenRequest.java      |  5 ++--
 .../kerberos/kerb/spec/pa/token/TokenInfo.java  |  5 ++--
 .../kerb/spec/ticket/EncTicketPart.java         | 23 ++++++++-------
 .../kerby/kerberos/kerb/spec/ticket/Ticket.java |  9 +++---
 .../kerb/spec/x509/AlgorithmIdentifier.java     |  5 ++--
 .../kerb/spec/x509/SubjectPublicKeyInfo.java    |  5 ++--
 58 files changed, 323 insertions(+), 211 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1FieldInfo.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1FieldInfo.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1FieldInfo.java
index 0647159..3c844e1 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1FieldInfo.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1FieldInfo.java
@@ -27,19 +27,13 @@ public class Asn1FieldInfo {
     private boolean isImplicit;
     private Class<? extends Asn1Type> type;
 
-    public Asn1FieldInfo(int index, int tagNo, Class<? extends Asn1Type> type) {
-        this(index, tagNo, type, false);
-    }
-
-    public Asn1FieldInfo(int index, Class<? extends Asn1Type> type) {
-        this(index, index, type, false);
-    }
-
-    public Asn1FieldInfo(int index, Class<? extends Asn1Type> type, boolean isImplicit) {
+    public Asn1FieldInfo(int index, Class<? extends Asn1Type> type,
+                         boolean isImplicit) {
         this(index, index, type, isImplicit);
     }
 
-    public Asn1FieldInfo(int index, int tagNo, Class<? extends Asn1Type> type, boolean isImplicit) {
+    public Asn1FieldInfo(int index, int tagNo, Class<? extends Asn1Type> type,
+                         boolean isImplicit) {
         this.index = index;
         this.tagNo = tagNo;
         this.type = type;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ExplicitField.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ExplicitField.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ExplicitField.java
new file mode 100644
index 0000000..7628fdc
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ExplicitField.java
@@ -0,0 +1,31 @@
+/**
+ *  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.asn1.type;
+
+public class ExplicitField extends Asn1FieldInfo {
+
+    public ExplicitField(int index, int tagNo, Class<? extends Asn1Type> type) {
+        super(index, tagNo, type, false);
+    }
+
+    public ExplicitField(int index, Class<? extends Asn1Type> type) {
+        super(index, index, type, false);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ImplicitField.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ImplicitField.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ImplicitField.java
new file mode 100644
index 0000000..128df68
--- /dev/null
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/ImplicitField.java
@@ -0,0 +1,31 @@
+/**
+ *  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.asn1.type;
+
+public class ImplicitField extends Asn1FieldInfo {
+
+    public ImplicitField(int index, int tagNo, Class<? extends Asn1Type> type) {
+        super(index, tagNo, type, true);
+    }
+
+    public ImplicitField(int index, Class<? extends Asn1Type> type) {
+        super(index, index, type, true);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java
index cee7d3b..72da457 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java
@@ -19,13 +19,14 @@
  */
 package org.apache.kerby.asn1;
 
-
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1SequenceOf;
 import org.apache.kerby.asn1.type.Asn1SetType;
 import org.apache.kerby.asn1.type.Asn1Tagging;
 import org.apache.kerby.asn1.type.Asn1VisibleString;
+import org.apache.kerby.asn1.type.ExplicitField;
+import org.apache.kerby.asn1.type.ImplicitField;
 import org.apache.kerby.asn1.type.TaggingSequence;
 import org.apache.kerby.asn1.type.TaggingSet;
 
@@ -42,12 +43,12 @@ public class PersonnelRecord extends TaggingSet {
     private static final int CHILDREN = 5;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(NAME, -1, Name.class),
-            new Asn1FieldInfo(TITLE, 0, Asn1VisibleString.class),
-            new Asn1FieldInfo(NUMBER, -1, EmployeeNumber.class),
-            new Asn1FieldInfo(DATEOFHIRE, 1, Date.class),
-            new Asn1FieldInfo(NAMEOFSPOUSE, 2, Name.class),
-            new Asn1FieldInfo(CHILDREN, 3, Children.class, true)
+            new ExplicitField(NAME, -1, Name.class),
+            new ExplicitField(TITLE, 0, Asn1VisibleString.class),
+            new ExplicitField(NUMBER, -1, EmployeeNumber.class),
+            new ExplicitField(DATEOFHIRE, 1, Date.class),
+            new ExplicitField(NAMEOFSPOUSE, 2, Name.class),
+            new ImplicitField(CHILDREN, 3, Children.class)
     };
 
     public PersonnelRecord() {
@@ -120,8 +121,8 @@ public class PersonnelRecord extends TaggingSet {
         private static final int DATEOFBIRTH = 1;
 
         static Asn1FieldInfo[] tags = new Asn1FieldInfo[] {
-                new Asn1FieldInfo(NAME, -1, Name.class),
-                new Asn1FieldInfo(DATEOFBIRTH, 0, Date.class)
+                new ExplicitField(NAME, -1, Name.class),
+                new ExplicitField(DATEOFBIRTH, 0, Date.class)
         };
 
         public ChildInformation() {
@@ -151,9 +152,9 @@ public class PersonnelRecord extends TaggingSet {
         private static final int FAMILYNAME = 2;
 
         static Asn1FieldInfo[] tags = new Asn1FieldInfo[] {
-                new Asn1FieldInfo(GIVENNAME, -1, Asn1VisibleString.class),
-                new Asn1FieldInfo(INITIAL, -1, Asn1VisibleString.class),
-                new Asn1FieldInfo(FAMILYNAME, -1, Asn1VisibleString.class)
+                new ExplicitField(GIVENNAME, -1, Asn1VisibleString.class),
+                new ExplicitField(INITIAL, -1, Asn1VisibleString.class),
+                new ExplicitField(FAMILYNAME, -1, Asn1VisibleString.class)
         };
 
         public Name() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KerberosString.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KerberosString.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KerberosString.java
index 3078b72..9ada2fa 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KerberosString.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KerberosString.java
@@ -26,6 +26,7 @@ import org.apache.kerby.asn1.type.Asn1GeneralString;
  */
 public class KerberosString extends Asn1GeneralString {
     public KerberosString() {
+        super();
     }
 
     public KerberosString(String value) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java
index 5e83189..ef7f911 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java
@@ -19,8 +19,8 @@
  */
 package org.apache.kerby.kerberos.kerb.spec;
 
-import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1EnumType;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.TaggingSequence;
 
 /**

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbSequenceType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbSequenceType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbSequenceType.java
index b9902bc..a15cc59 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbSequenceType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbSequenceType.java
@@ -19,9 +19,9 @@
  */
 package org.apache.kerby.kerberos.kerb.spec;
 
+import org.apache.kerby.asn1.type.Asn1EnumType;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
-import org.apache.kerby.asn1.type.Asn1EnumType;
 
 public abstract class KrbSequenceType extends Asn1SequenceType {
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AdToken.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AdToken.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AdToken.java
index 652170b..80896ff 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AdToken.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AdToken.java
@@ -20,6 +20,7 @@
 package org.apache.kerby.kerberos.kerb.spec.ad;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 import org.apache.kerby.kerberos.kerb.spec.base.KrbToken;
 
@@ -32,7 +33,7 @@ public class AdToken extends KrbSequenceType {
     private static final int TOKEN = 0;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(TOKEN, KrbToken.class)
+            new ExplicitField(TOKEN, KrbToken.class)
     };
 
     public AdToken() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationDataEntry.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationDataEntry.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationDataEntry.java
index 07b04d7..6f5b3bf 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationDataEntry.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ad/AuthorizationDataEntry.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.ad;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 /**
@@ -35,8 +36,8 @@ public class AuthorizationDataEntry extends KrbSequenceType {
     private static final int AD_DATA = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(AD_TYPE, 0, Asn1Integer.class),
-            new Asn1FieldInfo(AD_DATA, 1, Asn1OctetString.class)
+            new ExplicitField(AD_TYPE, 0, Asn1Integer.class),
+            new ExplicitField(AD_DATA, 1, Asn1OctetString.class)
     };
 
     public AuthorizationDataEntry() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApRep.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApRep.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApRep.java
index 7433311..8e69400 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApRep.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApRep.java
@@ -21,8 +21,9 @@ package org.apache.kerby.kerberos.kerb.spec.ap;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
-import org.apache.kerby.kerberos.kerb.spec.base.KrbMessage;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.base.EncryptedData;
+import org.apache.kerby.kerberos.kerb.spec.base.KrbMessage;
 import org.apache.kerby.kerberos.kerb.spec.base.KrbMessageType;
 
 /**
@@ -36,9 +37,9 @@ public class ApRep extends KrbMessage {
     private static final int ENC_PART = 2;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(PVNO, 0, Asn1Integer.class),
-            new Asn1FieldInfo(MSG_TYPE, 1, Asn1Integer.class),
-            new Asn1FieldInfo(ENC_PART, 2, EncryptedData.class)
+            new ExplicitField(PVNO, 0, Asn1Integer.class),
+            new ExplicitField(MSG_TYPE, 1, Asn1Integer.class),
+            new ExplicitField(ENC_PART, 2, EncryptedData.class)
     };
 
     public ApRep() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApReq.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApReq.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApReq.java
index 9a0b994..23be6a4 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApReq.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/ApReq.java
@@ -21,8 +21,9 @@ package org.apache.kerby.kerberos.kerb.spec.ap;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
-import org.apache.kerby.kerberos.kerb.spec.base.KrbMessage;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.base.EncryptedData;
+import org.apache.kerby.kerberos.kerb.spec.base.KrbMessage;
 import org.apache.kerby.kerberos.kerb.spec.base.KrbMessageType;
 import org.apache.kerby.kerberos.kerb.spec.ticket.Ticket;
 
@@ -41,11 +42,11 @@ public class ApReq extends KrbMessage {
     private static final int AUTHENTICATOR = 4;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(PVNO, Asn1Integer.class),
-            new Asn1FieldInfo(MSG_TYPE, Asn1Integer.class),
-            new Asn1FieldInfo(AP_OPTIONS, ApOptions.class),
-            new Asn1FieldInfo(TICKET, Ticket.class),
-            new Asn1FieldInfo(AUTHENTICATOR, EncryptedData.class)
+            new ExplicitField(PVNO, Asn1Integer.class),
+            new ExplicitField(MSG_TYPE, Asn1Integer.class),
+            new ExplicitField(AP_OPTIONS, ApOptions.class),
+            new ExplicitField(TICKET, Ticket.class),
+            new ExplicitField(AUTHENTICATOR, EncryptedData.class)
     };
 
     private Authenticator authenticator;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/Authenticator.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/Authenticator.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/Authenticator.java
index 9705ecb..f40e031 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/Authenticator.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/Authenticator.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.ap;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosString;
 import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
 import org.apache.kerby.kerberos.kerb.spec.KrbAppSequenceType;
@@ -55,15 +56,15 @@ public class Authenticator extends KrbAppSequenceType {
     private static final int AUTHORIZATION_DATA = 8;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(AUTHENTICATOR_VNO, 0, Asn1Integer.class),
-            new Asn1FieldInfo(CREALM, 1, KerberosString.class),
-            new Asn1FieldInfo(CNAME, 2, PrincipalName.class),
-            new Asn1FieldInfo(CKSUM, 3, CheckSum.class),
-            new Asn1FieldInfo(CUSEC, 4, Asn1Integer.class),
-            new Asn1FieldInfo(CTIME, 5, KerberosTime.class),
-            new Asn1FieldInfo(SUBKEY, 6, EncryptionKey.class),
-            new Asn1FieldInfo(SEQ_NUMBER, 7, Asn1Integer.class),
-            new Asn1FieldInfo(AUTHORIZATION_DATA, 8, AuthorizationData.class)
+            new ExplicitField(AUTHENTICATOR_VNO, 0, Asn1Integer.class),
+            new ExplicitField(CREALM, 1, KerberosString.class),
+            new ExplicitField(CNAME, 2, PrincipalName.class),
+            new ExplicitField(CKSUM, 3, CheckSum.class),
+            new ExplicitField(CUSEC, 4, Asn1Integer.class),
+            new ExplicitField(CTIME, 5, KerberosTime.class),
+            new ExplicitField(SUBKEY, 6, EncryptionKey.class),
+            new ExplicitField(SEQ_NUMBER, 7, Asn1Integer.class),
+            new ExplicitField(AUTHORIZATION_DATA, 8, AuthorizationData.class)
     };
 
     public Authenticator() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/EncAPRepPart.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/EncAPRepPart.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/EncAPRepPart.java
index dd3b5ef..5b6826d 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/EncAPRepPart.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/ap/EncAPRepPart.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.ap;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
 import org.apache.kerby.kerberos.kerb.spec.KrbAppSequenceType;
 import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
@@ -41,10 +42,10 @@ public class EncAPRepPart extends KrbAppSequenceType {
     private static final int SEQ_NUMBER = 3;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(CTIME, 0, KerberosTime.class),
-            new Asn1FieldInfo(CUSEC, 1, Asn1Integer.class),
-            new Asn1FieldInfo(SUBKEY, 2, EncryptionKey.class),
-            new Asn1FieldInfo(SEQ_NUMBER, 3, Asn1Integer.class)
+            new ExplicitField(CTIME, 0, KerberosTime.class),
+            new ExplicitField(CUSEC, 1, Asn1Integer.class),
+            new ExplicitField(SUBKEY, 2, EncryptionKey.class),
+            new ExplicitField(SEQ_NUMBER, 3, Asn1Integer.class)
     };
 
     public EncAPRepPart() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSum.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSum.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSum.java
index b0ec6b8..ce975a8 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSum.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/CheckSum.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.base;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 import java.util.Arrays;
@@ -37,8 +38,8 @@ public class CheckSum extends KrbSequenceType {
     private static final int CHECK_SUM = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-        new Asn1FieldInfo(CKSUM_TYPE, 0, Asn1Integer.class),
-        new Asn1FieldInfo(CHECK_SUM, 1, Asn1OctetString.class)
+        new ExplicitField(CKSUM_TYPE, 0, Asn1Integer.class),
+        new ExplicitField(CHECK_SUM, 1, Asn1OctetString.class)
     };
 
     public CheckSum() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptedData.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptedData.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptedData.java
index 2092560..4ccc5a4 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptedData.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptedData.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.base;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 import java.util.Arrays;
@@ -39,9 +40,9 @@ public class EncryptedData extends KrbSequenceType {
     private static final int CIPHER = 2;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(ETYPE, 0, Asn1Integer.class),
-            new Asn1FieldInfo(KVNO, 1, Asn1Integer.class),
-            new Asn1FieldInfo(CIPHER, 2, Asn1OctetString.class)
+            new ExplicitField(ETYPE, 0, Asn1Integer.class),
+            new ExplicitField(KVNO, 1, Asn1Integer.class),
+            new ExplicitField(CIPHER, 2, Asn1OctetString.class)
     };
 
     public EncryptedData() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionKey.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionKey.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionKey.java
index 4f00a46..9c00bee 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionKey.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EncryptionKey.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.base;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 import java.util.Arrays;
@@ -39,8 +40,8 @@ public class EncryptionKey extends KrbSequenceType {
     private int kvno = -1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(KEY_TYPE, 0, Asn1Integer.class),
-            new Asn1FieldInfo(KEY_VALUE, 1, Asn1OctetString.class)
+            new ExplicitField(KEY_TYPE, 0, Asn1Integer.class),
+            new ExplicitField(KEY_VALUE, 1, Asn1OctetString.class)
     };
 
     public EncryptionKey() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EtypeInfo2Entry.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EtypeInfo2Entry.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EtypeInfo2Entry.java
index a2071c7..aac940d 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EtypeInfo2Entry.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EtypeInfo2Entry.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.base;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosString;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
@@ -38,9 +39,9 @@ public class EtypeInfo2Entry extends KrbSequenceType {
     private static final int S2KPARAMS = 2;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(ETYPE, 0, Asn1Integer.class),
-            new Asn1FieldInfo(SALT, 1, KerberosString.class),
-            new Asn1FieldInfo(S2KPARAMS, 2, Asn1OctetString.class)
+            new ExplicitField(ETYPE, 0, Asn1Integer.class),
+            new ExplicitField(SALT, 1, KerberosString.class),
+            new ExplicitField(S2KPARAMS, 2, Asn1OctetString.class)
     };
 
     public EtypeInfo2Entry() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EtypeInfoEntry.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EtypeInfoEntry.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EtypeInfoEntry.java
index 0adb7b3..176a212 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EtypeInfoEntry.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/EtypeInfoEntry.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.base;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 /**
@@ -35,8 +36,8 @@ public class EtypeInfoEntry extends KrbSequenceType {
     private static final int SALT = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(ETYPE, 0, Asn1Integer.class),
-            new Asn1FieldInfo(SALT, 1, Asn1OctetString.class)
+            new ExplicitField(ETYPE, 0, Asn1Integer.class),
+            new ExplicitField(SALT, 1, Asn1OctetString.class)
     };
 
     public EtypeInfoEntry() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddress.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddress.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddress.java
index 2c2a1b8..404d803 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddress.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/HostAddress.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.base;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 import java.net.InetAddress;
@@ -38,8 +39,8 @@ public class HostAddress extends KrbSequenceType {
     private static final int ADDRESS = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(ADDR_TYPE, 0, Asn1Integer.class),
-            new Asn1FieldInfo(ADDRESS, 1, Asn1OctetString.class)
+            new ExplicitField(ADDR_TYPE, 0, Asn1Integer.class),
+            new ExplicitField(ADDRESS, 1, Asn1OctetString.class)
     };
 
     public HostAddress() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbError.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbError.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbError.java
index 5ff4e62..31938f9 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbError.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbError.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.base;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.KrbErrorCode;
 import org.apache.kerby.kerberos.kerb.spec.KerberosString;
 import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
@@ -57,19 +58,19 @@ public class KrbError extends KrbMessage {
     private static final int EDATA = 12;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(PVNO, Asn1Integer.class),
-            new Asn1FieldInfo(MSG_TYPE, Asn1Integer.class),
-            new Asn1FieldInfo(CTIME, KerberosTime.class),
-            new Asn1FieldInfo(CUSEC, Asn1Integer.class),
-            new Asn1FieldInfo(STIME, KerberosTime.class),
-            new Asn1FieldInfo(SUSEC, Asn1Integer.class),
-            new Asn1FieldInfo(ERROR_CODE, Asn1Integer.class),
-            new Asn1FieldInfo(CREALM, KerberosString.class),
-            new Asn1FieldInfo(CNAME, PrincipalName.class),
-            new Asn1FieldInfo(REALM, KerberosString.class),
-            new Asn1FieldInfo(SNAME, PrincipalName.class),
-            new Asn1FieldInfo(ETEXT, KerberosString.class),
-            new Asn1FieldInfo(EDATA, Asn1OctetString.class)
+            new ExplicitField(PVNO, Asn1Integer.class),
+            new ExplicitField(MSG_TYPE, Asn1Integer.class),
+            new ExplicitField(CTIME, KerberosTime.class),
+            new ExplicitField(CUSEC, Asn1Integer.class),
+            new ExplicitField(STIME, KerberosTime.class),
+            new ExplicitField(SUSEC, Asn1Integer.class),
+            new ExplicitField(ERROR_CODE, Asn1Integer.class),
+            new ExplicitField(CREALM, KerberosString.class),
+            new ExplicitField(CNAME, PrincipalName.class),
+            new ExplicitField(REALM, KerberosString.class),
+            new ExplicitField(SNAME, PrincipalName.class),
+            new ExplicitField(ETEXT, KerberosString.class),
+            new ExplicitField(EDATA, Asn1OctetString.class)
     };
 
     public KrbError() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbToken.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbToken.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbToken.java
index c40b7bb..e0ccd52 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbToken.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/KrbToken.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.base;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.KrbConstant;
 import org.apache.kerby.kerberos.kerb.KrbException;
 import org.apache.kerby.kerberos.kerb.KrbRuntime;
@@ -51,8 +52,8 @@ public class KrbToken extends KrbSequenceType implements AuthToken {
     private AuthToken innerToken = null;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
-            new Asn1FieldInfo(TOKEN_FORMAT, 0, Asn1Integer.class),
-            new Asn1FieldInfo(TOKEN_VALUE, 1, Asn1OctetString.class)
+            new ExplicitField(TOKEN_FORMAT, 0, Asn1Integer.class),
+            new ExplicitField(TOKEN_VALUE, 1, Asn1OctetString.class)
     };
 
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqEntry.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqEntry.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqEntry.java
index c2553d8..816821a 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqEntry.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/LastReqEntry.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.base;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
@@ -35,8 +36,8 @@ public class LastReqEntry extends KrbSequenceType {
     private static final int LR_VALUE = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(LR_TYPE, 0, Asn1Integer.class),
-            new Asn1FieldInfo(LR_VALUE, 1, KerberosTime.class)
+            new ExplicitField(LR_TYPE, 0, Asn1Integer.class),
+            new ExplicitField(LR_VALUE, 1, KerberosTime.class)
     };
 
     public LastReqEntry() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/PrincipalName.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/PrincipalName.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/PrincipalName.java
index 4bf6e0f..4f9b45c 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/PrincipalName.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/PrincipalName.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.base;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosStrings;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
@@ -38,8 +39,8 @@ public class PrincipalName extends KrbSequenceType {
     private static final int NAME_TYPE = 0;
     private static final int NAME_STRING = 1;
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(NAME_TYPE, Asn1Integer.class),
-            new Asn1FieldInfo(NAME_STRING, KerberosStrings.class)
+            new ExplicitField(NAME_TYPE, Asn1Integer.class),
+            new ExplicitField(NAME_STRING, KerberosStrings.class)
     };
     private String realm;
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TransitedEncoding.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TransitedEncoding.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TransitedEncoding.java
index 1d69bd0..06d3cbe 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TransitedEncoding.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/base/TransitedEncoding.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.base;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 /**
@@ -35,8 +36,8 @@ public class TransitedEncoding extends KrbSequenceType {
     private static final int CONTENTS = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(TR_TYPE, 0, Asn1Integer.class),
-            new Asn1FieldInfo(CONTENTS, 1, Asn1OctetString.class)
+            new ExplicitField(TR_TYPE, 0, Asn1Integer.class),
+            new ExplicitField(CONTENTS, 1, Asn1OctetString.class)
     };
 
     public TransitedEncoding() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmor.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmor.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmor.java
index 71227ba..b1e5318 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmor.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmor.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.fast;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 /**
@@ -37,8 +38,8 @@ public class KrbFastArmor extends KrbSequenceType {
     private static final int ARMOR_VALUE = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(ARMOR_TYPE, Asn1Integer.class),
-            new Asn1FieldInfo(ARMOR_VALUE, Asn1OctetString.class)
+            new ExplicitField(ARMOR_TYPE, Asn1Integer.class),
+            new ExplicitField(ARMOR_VALUE, Asn1OctetString.class)
     };
 
     public KrbFastArmor() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmoredRep.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmoredRep.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmoredRep.java
index 380f76f..e034d46 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmoredRep.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmoredRep.java
@@ -20,6 +20,7 @@
 package org.apache.kerby.kerberos.kerb.spec.fast;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 import org.apache.kerby.kerberos.kerb.spec.base.EncryptedData;
 
@@ -35,7 +36,7 @@ public class KrbFastArmoredRep extends KrbSequenceType {
 
     //private
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(ENC_FAST_REP, EncryptedData.class)
+            new ExplicitField(ENC_FAST_REP, EncryptedData.class)
     };
 
     public KrbFastArmoredRep() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmoredReq.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmoredReq.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmoredReq.java
index dfef6d6..f1057b1 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmoredReq.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastArmoredReq.java
@@ -20,6 +20,7 @@
 package org.apache.kerby.kerberos.kerb.spec.fast;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 import org.apache.kerby.kerberos.kerb.spec.base.CheckSum;
 import org.apache.kerby.kerberos.kerb.spec.base.EncryptedData;
@@ -52,9 +53,9 @@ public class KrbFastArmoredReq extends KrbSequenceType {
     private KrbFastReq fastReq;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(ARMOR, KrbFastArmor.class),
-            new Asn1FieldInfo(REQ_CHECKSUM, CheckSum.class),
-            new Asn1FieldInfo(ENC_FAST_REQ, EncryptedData.class),
+            new ExplicitField(ARMOR, KrbFastArmor.class),
+            new ExplicitField(REQ_CHECKSUM, CheckSum.class),
+            new ExplicitField(ENC_FAST_REQ, EncryptedData.class),
     };
 
     public KrbFastArmoredReq() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastFinished.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastFinished.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastFinished.java
index 12f120e..a2df6fe 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastFinished.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastFinished.java
@@ -20,6 +20,7 @@
 package org.apache.kerby.kerberos.kerb.spec.fast;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 import org.apache.kerby.kerberos.kerb.spec.base.CheckSum;
 import org.apache.kerby.kerberos.kerb.spec.base.EncryptedData;
@@ -47,9 +48,9 @@ public class KrbFastFinished extends KrbSequenceType {
     private static final int REQ_BODY = 2;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(FAST_OPTIONS, KrbFastArmor.class),
-            new Asn1FieldInfo(PADATA, PaData.class),
-            new Asn1FieldInfo(REQ_BODY, EncryptedData.class),
+            new ExplicitField(FAST_OPTIONS, KrbFastArmor.class),
+            new ExplicitField(PADATA, PaData.class),
+            new ExplicitField(REQ_BODY, EncryptedData.class),
     };
 
     public KrbFastFinished() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastReq.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastReq.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastReq.java
index 9cbd15c..90cff9b 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastReq.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastReq.java
@@ -20,6 +20,7 @@
 package org.apache.kerby.kerberos.kerb.spec.fast;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 import org.apache.kerby.kerberos.kerb.spec.kdc.KdcReqBody;
 import org.apache.kerby.kerberos.kerb.spec.pa.PaData;
@@ -43,9 +44,9 @@ public class KrbFastReq extends KrbSequenceType {
     private static final int REQ_BODY = 2;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(FAST_OPTIONS, FastOptions.class),
-            new Asn1FieldInfo(PADATA, PaData.class),
-            new Asn1FieldInfo(REQ_BODY, KdcReqBody.class),
+            new ExplicitField(FAST_OPTIONS, FastOptions.class),
+            new ExplicitField(PADATA, PaData.class),
+            new ExplicitField(REQ_BODY, KdcReqBody.class),
     };
 
     public KrbFastReq() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastResponse.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastResponse.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastResponse.java
index 98ee83c..eafaa82 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastResponse.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/KrbFastResponse.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.fast;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
 import org.apache.kerby.kerberos.kerb.spec.pa.PaData;
@@ -46,10 +47,10 @@ public class KrbFastResponse extends KrbSequenceType {
     private static final int NONCE = 3;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(PADATA, PaData.class),
-            new Asn1FieldInfo(STRENGTHEN_KEY, EncryptionKey.class),
-            new Asn1FieldInfo(FINISHED, KrbFastFinished.class),
-            new Asn1FieldInfo(NONCE, Asn1Integer.class)
+            new ExplicitField(PADATA, PaData.class),
+            new ExplicitField(STRENGTHEN_KEY, EncryptionKey.class),
+            new ExplicitField(FINISHED, KrbFastFinished.class),
+            new ExplicitField(NONCE, Asn1Integer.class)
     };
 
     public KrbFastResponse() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaAuthnEntry.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaAuthnEntry.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaAuthnEntry.java
index 34f60fa..6e78a7a 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaAuthnEntry.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaAuthnEntry.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.fast;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 import org.apache.kerby.kerberos.kerb.spec.pa.PaDataType;
 
@@ -38,9 +39,9 @@ public class PaAuthnEntry extends KrbSequenceType {
     private static final int PA_VALUE = 2;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(PA_TYPE, Asn1Integer.class),
-            new Asn1FieldInfo(PA_HINT, Asn1OctetString.class),
-            new Asn1FieldInfo(PA_VALUE, Asn1OctetString.class)
+            new ExplicitField(PA_TYPE, Asn1Integer.class),
+            new ExplicitField(PA_HINT, Asn1OctetString.class),
+            new ExplicitField(PA_VALUE, Asn1OctetString.class)
     };
 
     public PaAuthnEntry() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaFxFastReply.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaFxFastReply.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaFxFastReply.java
index d8768a5..41d95bc 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaFxFastReply.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaFxFastReply.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.fast;
 
 import org.apache.kerby.asn1.type.Asn1Choice;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 
 /**
  PA-FX-FAST-REPLY ::= CHOICE {
@@ -31,7 +32,7 @@ public class PaFxFastReply extends Asn1Choice {
     private static final int ARMORED_DATA = 0;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(ARMORED_DATA, KrbFastArmoredRep.class)
+            new ExplicitField(ARMORED_DATA, KrbFastArmoredRep.class)
     };
 
     public PaFxFastReply() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaFxFastRequest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaFxFastRequest.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaFxFastRequest.java
index 4036ad2..5a24cd5 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaFxFastRequest.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/fast/PaFxFastRequest.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.fast;
 
 import org.apache.kerby.asn1.type.Asn1Choice;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 
 /**
  PA-FX-FAST-REQUEST ::= CHOICE {
@@ -31,7 +32,7 @@ public class PaFxFastRequest extends Asn1Choice {
     private static final int ARMORED_DATA = 0;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(ARMORED_DATA, KrbFastArmoredReq.class)
+            new ExplicitField(ARMORED_DATA, KrbFastArmoredReq.class)
     };
 
     public PaFxFastRequest() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/EncKdcRepPart.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/EncKdcRepPart.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/EncKdcRepPart.java
index 32ab96b..dfccf18 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/EncKdcRepPart.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/EncKdcRepPart.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.kdc;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosString;
 import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
 import org.apache.kerby.kerberos.kerb.spec.KrbAppSequenceType;
@@ -61,18 +62,18 @@ public abstract class EncKdcRepPart extends KrbAppSequenceType {
     private static final int CADDR = 11;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(KEY, EncryptionKey.class),
-            new Asn1FieldInfo(LAST_REQ, LastReq.class),
-            new Asn1FieldInfo(NONCE, Asn1Integer.class),
-            new Asn1FieldInfo(KEY_EXPIRATION, KerberosTime.class),
-            new Asn1FieldInfo(FLAGS, TicketFlags.class),
-            new Asn1FieldInfo(AUTHTIME, KerberosTime.class),
-            new Asn1FieldInfo(STARTTIME, KerberosTime.class),
-            new Asn1FieldInfo(ENDTIME, KerberosTime.class),
-            new Asn1FieldInfo(RENEW_TILL, KerberosTime.class),
-            new Asn1FieldInfo(SREALM, KerberosString.class),
-            new Asn1FieldInfo(SNAME, PrincipalName.class),
-            new Asn1FieldInfo(CADDR, HostAddresses.class)
+            new ExplicitField(KEY, EncryptionKey.class),
+            new ExplicitField(LAST_REQ, LastReq.class),
+            new ExplicitField(NONCE, Asn1Integer.class),
+            new ExplicitField(KEY_EXPIRATION, KerberosTime.class),
+            new ExplicitField(FLAGS, TicketFlags.class),
+            new ExplicitField(AUTHTIME, KerberosTime.class),
+            new ExplicitField(STARTTIME, KerberosTime.class),
+            new ExplicitField(ENDTIME, KerberosTime.class),
+            new ExplicitField(RENEW_TILL, KerberosTime.class),
+            new ExplicitField(SREALM, KerberosString.class),
+            new ExplicitField(SNAME, PrincipalName.class),
+            new ExplicitField(CADDR, HostAddresses.class)
     };
 
     public EncKdcRepPart(int tagNo) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcRep.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcRep.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcRep.java
index 87a160a..fa92cd2 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcRep.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcRep.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.kdc;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosString;
 import org.apache.kerby.kerberos.kerb.spec.base.EncryptedData;
 import org.apache.kerby.kerberos.kerb.spec.base.KrbMessage;
@@ -51,13 +52,13 @@ public class KdcRep extends KrbMessage {
     private static final int ENC_PART = 6;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(PVNO, Asn1Integer.class),
-            new Asn1FieldInfo(MSG_TYPE, Asn1Integer.class),
-            new Asn1FieldInfo(PADATA, PaData.class),
-            new Asn1FieldInfo(CREALM, KerberosString.class),
-            new Asn1FieldInfo(CNAME, PrincipalName.class),
-            new Asn1FieldInfo(TICKET, Ticket.class),
-            new Asn1FieldInfo(ENC_PART, EncryptedData.class)
+            new ExplicitField(PVNO, Asn1Integer.class),
+            new ExplicitField(MSG_TYPE, Asn1Integer.class),
+            new ExplicitField(PADATA, PaData.class),
+            new ExplicitField(CREALM, KerberosString.class),
+            new ExplicitField(CNAME, PrincipalName.class),
+            new ExplicitField(TICKET, Ticket.class),
+            new ExplicitField(ENC_PART, EncryptedData.class)
     };
 
     private EncKdcRepPart encPart;

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReq.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReq.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReq.java
index 96a9f10..b0417b4 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReq.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReq.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.kdc;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.base.KrbMessage;
 import org.apache.kerby.kerberos.kerb.spec.base.KrbMessageType;
 import org.apache.kerby.kerberos.kerb.spec.pa.PaData;
@@ -41,10 +42,10 @@ public class KdcReq extends KrbMessage {
     private static final int REQ_BODY = 3;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(PVNO, 1, Asn1Integer.class),
-            new Asn1FieldInfo(MSG_TYPE, 2, Asn1Integer.class),
-            new Asn1FieldInfo(PADATA, 3, PaData.class),
-            new Asn1FieldInfo(REQ_BODY, 4, KdcReqBody.class)
+            new ExplicitField(PVNO, 1, Asn1Integer.class),
+            new ExplicitField(MSG_TYPE, 2, Asn1Integer.class),
+            new ExplicitField(PADATA, 3, PaData.class),
+            new ExplicitField(REQ_BODY, 4, KdcReqBody.class)
     };
 
     public KdcReq(KrbMessageType msgType) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReqBody.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReqBody.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReqBody.java
index a9b3c48..9afadd6 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReqBody.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/kdc/KdcReqBody.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.kdc;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosString;
 import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
 import org.apache.kerby.kerberos.kerb.spec.KrbIntegers;
@@ -73,18 +74,18 @@ public class KdcReqBody extends KrbSequenceType {
     private static final int ADDITIONAL_TICKETS = 11;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(KDC_OPTIONS, KdcOptions.class),
-            new Asn1FieldInfo(CNAME, PrincipalName.class),
-            new Asn1FieldInfo(REALM, KerberosString.class),
-            new Asn1FieldInfo(SNAME, PrincipalName.class),
-            new Asn1FieldInfo(FROM, KerberosTime.class),
-            new Asn1FieldInfo(TILL, KerberosTime.class),
-            new Asn1FieldInfo(RTIME, KerberosTime.class),
-            new Asn1FieldInfo(NONCE, Asn1Integer.class),
-            new Asn1FieldInfo(ETYPE, KrbIntegers.class),
-            new Asn1FieldInfo(ADDRESSES, HostAddresses.class),
-            new Asn1FieldInfo(ENC_AUTHORIZATION_DATA, AuthorizationData.class),
-            new Asn1FieldInfo(ADDITIONAL_TICKETS, Tickets.class)
+            new ExplicitField(KDC_OPTIONS, KdcOptions.class),
+            new ExplicitField(CNAME, PrincipalName.class),
+            new ExplicitField(REALM, KerberosString.class),
+            new ExplicitField(SNAME, PrincipalName.class),
+            new ExplicitField(FROM, KerberosTime.class),
+            new ExplicitField(TILL, KerberosTime.class),
+            new ExplicitField(RTIME, KerberosTime.class),
+            new ExplicitField(NONCE, Asn1Integer.class),
+            new ExplicitField(ETYPE, KrbIntegers.class),
+            new ExplicitField(ADDRESSES, HostAddresses.class),
+            new ExplicitField(ENC_AUTHORIZATION_DATA, AuthorizationData.class),
+            new ExplicitField(ADDITIONAL_TICKETS, Tickets.class)
     };
 
     public KdcReqBody() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaAuthenticationSetElem.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaAuthenticationSetElem.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaAuthenticationSetElem.java
index 48fbef9..9a3ca09 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaAuthenticationSetElem.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaAuthenticationSetElem.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.pa;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 /**
@@ -38,9 +39,9 @@ public class PaAuthenticationSetElem extends KrbSequenceType {
     private static final int PA_VALUE = 2;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(PA_TYPE, Asn1Integer.class),
-            new Asn1FieldInfo(PA_HINT, Asn1OctetString.class),
-            new Asn1FieldInfo(PA_VALUE, Asn1OctetString.class)
+            new ExplicitField(PA_TYPE, Asn1Integer.class),
+            new ExplicitField(PA_HINT, Asn1OctetString.class),
+            new ExplicitField(PA_VALUE, Asn1OctetString.class)
     };
 
     public PaAuthenticationSetElem() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataEntry.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataEntry.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataEntry.java
index 901eb06..5dd6e59 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataEntry.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaDataEntry.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.pa;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 /**
@@ -36,8 +37,8 @@ public class PaDataEntry extends KrbSequenceType {
     private static final int PADATA_VALUE = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(PADATA_TYPE, 1, Asn1Integer.class),
-            new Asn1FieldInfo(PADATA_VALUE, 2, Asn1OctetString.class)
+            new ExplicitField(PADATA_TYPE, 1, Asn1Integer.class),
+            new ExplicitField(PADATA_VALUE, 2, Asn1OctetString.class)
     };
 
     public PaDataEntry() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaEncTsEnc.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaEncTsEnc.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaEncTsEnc.java
index 7eb0b56..1107919 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaEncTsEnc.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/PaEncTsEnc.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.pa;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
@@ -35,8 +36,8 @@ public class PaEncTsEnc extends KrbSequenceType {
     private static final int PAUSEC = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(PATIMESTAMP, 0, KerberosTime.class),
-            new Asn1FieldInfo(PAUSEC, 1, Asn1Integer.class)
+            new ExplicitField(PATIMESTAMP, 0, KerberosTime.class),
+            new ExplicitField(PAUSEC, 1, Asn1Integer.class)
     };
 
     public PaEncTsEnc() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/otp/OtpTokenInfo.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/otp/OtpTokenInfo.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/otp/OtpTokenInfo.java
index fa29244..b2a6a6a 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/otp/OtpTokenInfo.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/otp/OtpTokenInfo.java
@@ -23,6 +23,7 @@ import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
 import org.apache.kerby.asn1.type.Asn1Utf8String;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosString;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 import org.apache.kerby.kerberos.kerb.spec.pa.pkinit.AlgorithmIdentifiers;
@@ -52,15 +53,15 @@ public class OtpTokenInfo extends KrbSequenceType {
     private static final int ITERATION_COUNT = 8;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(FLAGS, Asn1OctetString.class, true),
-            new Asn1FieldInfo(OTP_VENDOR, Asn1Utf8String.class),
-            new Asn1FieldInfo(OTP_CHALLENGE, Asn1OctetString.class, true),
-            new Asn1FieldInfo(OTP_LENGTH, KerberosString.class),
-            new Asn1FieldInfo(OTP_FORMAT, Asn1OctetString.class, true),
-            new Asn1FieldInfo(OTP_TOKEN_ID, Asn1Utf8String.class),
-            new Asn1FieldInfo(OTP_ALG_ID, Asn1OctetString.class, true),
-            new Asn1FieldInfo(SUPPORTED_HASH_ALG, AlgorithmIdentifiers.class),
-            new Asn1FieldInfo(ITERATION_COUNT, Asn1Integer.class, true)
+            new ExplicitField(FLAGS, Asn1OctetString.class),
+            new ExplicitField(OTP_VENDOR, Asn1Utf8String.class),
+            new ExplicitField(OTP_CHALLENGE, Asn1OctetString.class),
+            new ExplicitField(OTP_LENGTH, KerberosString.class),
+            new ExplicitField(OTP_FORMAT, Asn1OctetString.class),
+            new ExplicitField(OTP_TOKEN_ID, Asn1Utf8String.class),
+            new ExplicitField(OTP_ALG_ID, Asn1OctetString.class),
+            new ExplicitField(SUPPORTED_HASH_ALG, AlgorithmIdentifiers.class),
+            new ExplicitField(ITERATION_COUNT, Asn1Integer.class)
     };
 
     public OtpTokenInfo() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/otp/PaOtpChallenge.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/otp/PaOtpChallenge.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/otp/PaOtpChallenge.java
index 58140a9..a146552 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/otp/PaOtpChallenge.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/otp/PaOtpChallenge.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.pa.otp;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1OctetString;
 import org.apache.kerby.asn1.type.Asn1Utf8String;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosString;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
@@ -42,11 +43,11 @@ public class PaOtpChallenge extends KrbSequenceType {
     private static final int S2KPARAMS = 4;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(NONCE, Asn1OctetString.class, true),
-            new Asn1FieldInfo(OTP_SERVICE, Asn1Utf8String.class),
-            new Asn1FieldInfo(OTP_TOKEN_INFO, Asn1OctetString.class, true),
-            new Asn1FieldInfo(SALT, KerberosString.class),
-            new Asn1FieldInfo(S2KPARAMS, Asn1OctetString.class, true)
+            new ExplicitField(NONCE, Asn1OctetString.class),
+            new ExplicitField(OTP_SERVICE, Asn1Utf8String.class),
+            new ExplicitField(OTP_TOKEN_INFO, Asn1OctetString.class),
+            new ExplicitField(SALT, KerberosString.class),
+            new ExplicitField(S2KPARAMS, Asn1OctetString.class)
     };
 
     public PaOtpChallenge() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AuthPack.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AuthPack.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AuthPack.java
index 8ca1f9c..c3e429a 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AuthPack.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/AuthPack.java
@@ -20,6 +20,7 @@
 package org.apache.kerby.kerberos.kerb.spec.pa.pkinit;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 import org.apache.kerby.kerberos.kerb.spec.x509.SubjectPublicKeyInfo;
 
@@ -38,10 +39,10 @@ public class AuthPack extends KrbSequenceType {
     private static final int CLIENT_DH_NONCE = 3;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(PK_AUTHENTICATOR, PkAuthenticator.class),
-            new Asn1FieldInfo(CLIENT_PUBLIC_VALUE, SubjectPublicKeyInfo.class),
-            new Asn1FieldInfo(SUPPORTED_CMS_TYPES, AlgorithmIdentifiers.class),
-            new Asn1FieldInfo(CLIENT_DH_NONCE, DHNonce.class)
+            new ExplicitField(PK_AUTHENTICATOR, PkAuthenticator.class),
+            new ExplicitField(CLIENT_PUBLIC_VALUE, SubjectPublicKeyInfo.class),
+            new ExplicitField(SUPPORTED_CMS_TYPES, AlgorithmIdentifiers.class),
+            new ExplicitField(CLIENT_DH_NONCE, DHNonce.class)
     };
 
     public AuthPack() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/DHRepInfo.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/DHRepInfo.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/DHRepInfo.java
index 721e87a..85072fb 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/DHRepInfo.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/DHRepInfo.java
@@ -21,6 +21,8 @@ package org.apache.kerby.kerberos.kerb.spec.pa.pkinit;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
+import org.apache.kerby.asn1.type.ImplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 /**
@@ -34,8 +36,8 @@ public class DHRepInfo extends KrbSequenceType {
     private static final int SERVER_DH_NONCE = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(DH_SIGNED_DATA, Asn1OctetString.class, true),
-            new Asn1FieldInfo(SERVER_DH_NONCE, DHNonce.class)
+            new ImplicitField(DH_SIGNED_DATA, Asn1OctetString.class),
+            new ExplicitField(SERVER_DH_NONCE, DHNonce.class)
     };
 
     public DHRepInfo() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/ExternalPrincipalIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/ExternalPrincipalIdentifier.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/ExternalPrincipalIdentifier.java
index 08be503..5e03253 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/ExternalPrincipalIdentifier.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/ExternalPrincipalIdentifier.java
@@ -21,6 +21,7 @@ package org.apache.kerby.kerberos.kerb.spec.pa.pkinit;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ImplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 /**
@@ -36,9 +37,9 @@ public class ExternalPrincipalIdentifier extends KrbSequenceType {
     private static final int SUBJECT_KEY_IDENTIFIER = 2;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(SUBJECT_NAME, Asn1OctetString.class, true),
-            new Asn1FieldInfo(ISSUER_AND_SERIAL_NUMBER, Asn1OctetString.class, true),
-            new Asn1FieldInfo(SUBJECT_KEY_IDENTIFIER, Asn1OctetString.class, true)
+            new ImplicitField(SUBJECT_NAME, Asn1OctetString.class),
+            new ImplicitField(ISSUER_AND_SERIAL_NUMBER, Asn1OctetString.class),
+            new ImplicitField(SUBJECT_KEY_IDENTIFIER, Asn1OctetString.class)
     };
 
     public ExternalPrincipalIdentifier() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/KdcDHKeyInfo.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/KdcDHKeyInfo.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/KdcDHKeyInfo.java
index 0e9504e..b5e23f4 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/KdcDHKeyInfo.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/KdcDHKeyInfo.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.pa.pkinit;
 import org.apache.kerby.asn1.type.Asn1BitString;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
@@ -38,9 +39,9 @@ public class KdcDHKeyInfo extends KrbSequenceType {
     private static final int DH_KEY_EXPIRATION = 2;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(SUBJECT_PUBLICK_KEY, Asn1BitString.class),
-            new Asn1FieldInfo(NONCE, Asn1Integer.class),
-            new Asn1FieldInfo(DH_KEY_EXPIRATION, KerberosTime.class)
+            new ExplicitField(SUBJECT_PUBLICK_KEY, Asn1BitString.class),
+            new ExplicitField(NONCE, Asn1Integer.class),
+            new ExplicitField(DH_KEY_EXPIRATION, KerberosTime.class)
     };
 
     public KdcDHKeyInfo() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/Krb5PrincipalName.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/Krb5PrincipalName.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/Krb5PrincipalName.java
index 347af0b..eb210e2 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/Krb5PrincipalName.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/Krb5PrincipalName.java
@@ -20,6 +20,7 @@
 package org.apache.kerby.kerberos.kerb.spec.pa.pkinit;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
 import org.apache.kerby.kerberos.kerb.spec.base.Realm;
@@ -35,8 +36,8 @@ public class Krb5PrincipalName extends KrbSequenceType {
     private static final int PRINCIPAL_NAME = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(REALM, Realm.class),
-            new Asn1FieldInfo(PRINCIPAL_NAME, PrincipalName.class)
+            new ExplicitField(REALM, Realm.class),
+            new ExplicitField(PRINCIPAL_NAME, PrincipalName.class)
     };
 
     public Krb5PrincipalName() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PaPkAsRep.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PaPkAsRep.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PaPkAsRep.java
index 5c6000e..49cc980 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PaPkAsRep.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PaPkAsRep.java
@@ -22,6 +22,8 @@ package org.apache.kerby.kerberos.kerb.spec.pa.pkinit;
 import org.apache.kerby.asn1.type.Asn1Choice;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
+import org.apache.kerby.asn1.type.ImplicitField;
 
 /**
  PA-PK-AS-REP ::= CHOICE {
@@ -34,8 +36,8 @@ public class PaPkAsRep extends Asn1Choice {
     private static final int ENCKEY_PACK = 1;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(DH_INFO, DHRepInfo.class),
-            new Asn1FieldInfo(ENCKEY_PACK, Asn1OctetString.class, true)
+            new ExplicitField(DH_INFO, DHRepInfo.class),
+            new ImplicitField(ENCKEY_PACK, Asn1OctetString.class)
     };
 
     public PaPkAsRep() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PaPkAsReq.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PaPkAsReq.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PaPkAsReq.java
index 53c1b0d..7e740c2 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PaPkAsReq.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PaPkAsReq.java
@@ -21,6 +21,8 @@ package org.apache.kerby.kerberos.kerb.spec.pa.pkinit;
 
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
+import org.apache.kerby.asn1.type.ImplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
 /**
@@ -36,9 +38,9 @@ public class PaPkAsReq extends KrbSequenceType {
     private static final int KDC_PKID = 2;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(SIGNED_AUTH_PACK, Asn1OctetString.class, true),
-            new Asn1FieldInfo(TRUSTED_CERTIFIERS, TrustedCertifiers.class),
-            new Asn1FieldInfo(KDC_PKID, Asn1OctetString.class, true)
+            new ImplicitField(SIGNED_AUTH_PACK, Asn1OctetString.class),
+            new ExplicitField(TRUSTED_CERTIFIERS, TrustedCertifiers.class),
+            new ImplicitField(KDC_PKID, Asn1OctetString.class)
     };
 
     public PaPkAsReq() {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/a8a07691/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PkAuthenticator.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PkAuthenticator.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PkAuthenticator.java
index 4d3909e..c24fad2 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PkAuthenticator.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/pa/pkinit/PkAuthenticator.java
@@ -22,6 +22,7 @@ package org.apache.kerby.kerberos.kerb.spec.pa.pkinit;
 import org.apache.kerby.asn1.type.Asn1FieldInfo;
 import org.apache.kerby.asn1.type.Asn1Integer;
 import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.ExplicitField;
 import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
 import org.apache.kerby.kerberos.kerb.spec.KrbSequenceType;
 
@@ -47,10 +48,10 @@ public class PkAuthenticator extends KrbSequenceType {
     private static final int PA_CHECKSUM = 3;
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
-            new Asn1FieldInfo(CUSEC, Asn1Integer.class),
-            new Asn1FieldInfo(CTIME, KerberosTime.class),
-            new Asn1FieldInfo(NONCE, Asn1Integer.class),
-            new Asn1FieldInfo(PA_CHECKSUM, Asn1OctetString.class)
+            new ExplicitField(CUSEC, Asn1Integer.class),
+            new ExplicitField(CTIME, KerberosTime.class),
+            new ExplicitField(NONCE, Asn1Integer.class),
+            new ExplicitField(PA_CHECKSUM, Asn1OctetString.class)
     };
 
     public PkAuthenticator() {


[05/17] directory-kerby git commit: DIRKRB-474 Refined asn1 APIs, getting rid of the questionable encoding option; Made it more general, not too friendly to Kerberos, considering CMS & X509 types

Posted by pl...@apache.org.
DIRKRB-474 Refined asn1 APIs, getting rid of the questionable encoding option; Made it more general, not too friendly to Kerberos, considering CMS & X509 types


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/1f4b21c8
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/1f4b21c8
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/1f4b21c8

Branch: refs/heads/pkinit-support
Commit: 1f4b21c8601602d511baffe8ba8c588abd560dcb
Parents: b7a062e
Author: Kai Zheng <ka...@intel.com>
Authored: Thu Nov 26 19:29:16 2015 +0800
Committer: Kai Zheng <ka...@intel.com>
Committed: Thu Nov 26 19:29:16 2015 +0800

----------------------------------------------------------------------
 .../org/apache/kerby/asn1/Asn1OutputBuffer.java |   5 -
 .../org/apache/kerby/asn1/EncodingOption.java   | 202 -------------------
 .../org/apache/kerby/asn1/TaggingOption.java    |   4 +-
 .../kerby/asn1/type/AbstractAsn1Type.java       | 148 +++++++++-----
 .../apache/kerby/asn1/type/Asn1BmpString.java   |   3 +-
 .../org/apache/kerby/asn1/type/Asn1Boolean.java |   2 +-
 .../org/apache/kerby/asn1/type/Asn1Choice.java  |   6 -
 .../apache/kerby/asn1/type/Asn1Collection.java  |   7 +-
 .../kerby/asn1/type/Asn1CollectionType.java     |   7 +-
 .../apache/kerby/asn1/type/Asn1EnumType.java    |  11 +-
 .../org/apache/kerby/asn1/type/Asn1Simple.java  |   7 +-
 .../org/apache/kerby/asn1/type/Asn1Tagging.java |  55 +++--
 .../org/apache/kerby/asn1/type/Asn1Type.java    |  96 ++++++++-
 .../kerby/asn1/type/TaggingCollection.java      |  82 ++++++--
 .../apache/kerby/asn1/type/TaggingSequence.java |   5 +-
 .../org/apache/kerby/asn1/type/TaggingSet.java  |   5 +-
 .../org/apache/kerby/asn1/PersonnelRecord.java  |  15 +-
 .../org/apache/kerby/asn1/TestAsn1Boolean.java  |   8 +-
 .../org/apache/kerby/asn1/TestAsn1Integer.java  |   4 +-
 .../kerby/asn1/TestAsn1ObjectIdentifier.java    |   4 +-
 .../org/apache/kerby/asn1/TestAsn1UtcTime.java  |   4 +-
 .../apache/kerby/asn1/TestTaggingEncoding.java  |  12 +-
 .../kerberos/kerb/spec/KrbAppSequenceType.java  |   2 +-
 23 files changed, 321 insertions(+), 373 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java
index 76e4d2b..f50d092 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1OutputBuffer.java
@@ -40,11 +40,6 @@ public class Asn1OutputBuffer {
         objects.add(value);
     }
 
-    public void write(Asn1Type value, EncodingOption option) {
-        value.setEncodingOption(option);
-        objects.add(value);
-    }
-
     public ByteBuffer getOutput() {
         int len = encodingLength();
         ByteBuffer byteBuffer = ByteBuffer.allocate(len);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/EncodingOption.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/EncodingOption.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/EncodingOption.java
deleted file mode 100644
index d9627e0..0000000
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/EncodingOption.java
+++ /dev/null
@@ -1,202 +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.asn1;
-
-/**
- * A class used to hold the various encoding options for a type.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class EncodingOption {
-    /**
-     * Encoding type
-     */
-    protected static enum EncodingType {
-        BER,
-        DER,
-        CER;
-    }
-
-    private EncodingType encodingType;
-    private boolean isPrimitive;
-    private boolean isDefLen;
-    private boolean isImplicit;
-
-    /**
-     * The default constructor with default values.
-     */
-    public EncodingOption() {
-        this.encodingType = EncodingType.BER;
-        this.isPrimitive = true;
-        this.isImplicit = true;
-    }
-
-    /** 
-     * A mask to determinate if a Tag is CONSTRUCTED. The fifth bit should be set to 1 if
-     * the type is constructed (0010-0000).
-     */
-    public static final int CONSTRUCTED_FLAG = 0x20;
-
-    public static boolean isConstructed(int tag) {
-        return (tag & CONSTRUCTED_FLAG) != 0;
-    }
-
-    /**
-     * Use primitive.
-     */
-    public void usePrimitive() {
-        this.isPrimitive = true;
-    }
-
-    /**
-     * Tells if the EncodingOption is PRIMITIVE
-     * 
-     * @return true if using PRIMITIVE, false otherwise
-     */
-    public boolean isPrimitive() {
-        return this.isPrimitive;
-    }
-
-    /**
-     * Use constructed.
-     */
-    public void useConstructed() {
-        this.isPrimitive = false;
-        useNonDefLen();
-    }
-
-    /**
-     * Tells if it's constructed (not primitive).
-     * 
-     * @return true if it's constructed, false otherwise
-     */
-    public boolean isConstructed() {
-        return !isPrimitive;
-    }
-
-    /**
-     * Use definitive length, only makes sense when it's constructed.
-     */
-    public void useDefLen() {
-        if (isPrimitive()) {
-            throw new IllegalArgumentException("It's only for constructed");
-        }
-        this.isDefLen = true;
-    }
-
-    /**
-     * Use non-definitive length, only makes sense when it's constructed.
-     */
-    public void useNonDefLen() {
-        if (isPrimitive()) {
-            throw new IllegalArgumentException("It's only for constructed");
-        }
-        this.isDefLen = false;
-    }
-
-    /**
-     * Tells if it's definitive length or not.
-     * @return The boolean value
-     */
-    public boolean isDefLen() {
-        return this.isDefLen;
-    }
-
-    /**
-     * Use implicit, which will discard the value set by useExplicit.
-     */
-    public void useImplicit() {
-        this.isImplicit = true;
-    }
-
-    /**
-     * Tells if it's is IMPLICIT
-     * 
-     * @return true if using IMPLICIT, false otherwise
-     */
-    public boolean isImplicit() {
-        return isImplicit;
-    }
-
-    /**
-     * Use explicit, which will discard the value set by useImplicit.
-     */
-    public void useExplicit() {
-        this.isImplicit = false;
-    }
-
-    /**
-     * Tells if it's is EXPLICIT
-     * 
-     * @return true if using EXPLICIT, false otherwise
-     */
-    public boolean isExplicit() {
-        return !isImplicit;
-    }
-
-    /**
-     * Set encoding type as DER.
-     */
-    public void useDer() {
-        this.encodingType = EncodingType.DER;
-    }
-
-    /**
-     * Tells if it's is DER
-     * 
-     * @return true if using DER, false otherwise
-     */
-    public boolean isDer() {
-        return encodingType == EncodingType.DER;
-    }
-
-    /**
-     * Set encoding type as BER.
-     */
-    public void useBer() {
-        this.encodingType = EncodingType.BER;
-    }
-
-    /**
-     * Tells if it's is BER
-     *
-     * @return true if using BER, false otherwise
-     */
-    public boolean isBer() {
-        return encodingType == EncodingType.BER;
-    }
-
-    /**
-     * Set encoding type as CER.
-     */
-    public void useCer() {
-        this.encodingType = EncodingType.CER;
-    }
-
-    /**
-     * Tells if it's is CER
-     * 
-     * @return true if using CER, false otherwise
-     */
-    public boolean isCer() {
-        return encodingType == EncodingType.CER;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/TaggingOption.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/TaggingOption.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/TaggingOption.java
index f72d3e9..8bb0419 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/TaggingOption.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/TaggingOption.java
@@ -19,6 +19,8 @@
  */
 package org.apache.kerby.asn1;
 
+import org.apache.kerby.asn1.type.Asn1Type;
+
 /**
  * Tagging option for tagging an ASN1 type.
  */
@@ -83,7 +85,7 @@ public final class TaggingOption {
     public int tagFlags(boolean isTaggedConstructed) {
         boolean isConstructed = isImplicit ? isTaggedConstructed : true;
         TagClass tagClass = isAppSpecific ? TagClass.APPLICATION : TagClass.CONTEXT_SPECIFIC;
-        int flags = tagClass.getValue() | (isConstructed ? EncodingOption.CONSTRUCTED_FLAG : 0x00);
+        int flags = tagClass.getValue() | (isConstructed ? Asn1Type.CONSTRUCTED_FLAG : 0x00);
 
         return flags;
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
index 74bf6e3..7446c7c 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/AbstractAsn1Type.java
@@ -19,7 +19,6 @@
  */
 package org.apache.kerby.asn1.type;
 
-import org.apache.kerby.asn1.EncodingOption;
 import org.apache.kerby.asn1.LimitedByteBuffer;
 import org.apache.kerby.asn1.TagClass;
 import org.apache.kerby.asn1.TaggingOption;
@@ -34,14 +33,19 @@ import java.nio.ByteBuffer;
  * @param <T> the type of the value encoded/decoded or wrapped by this
  */
 public abstract class AbstractAsn1Type<T> implements Asn1Type {
+
     private TagClass tagClass = TagClass.UNKNOWN;
     private int tagNo = -1;
-    private int tagFlags = -1;
-    private EncodingOption encodingOption = new EncodingOption();
+    private int tagFlags = 0;
     private int encodingLen = -1;
     // The wrapped real value.
     private T value;
 
+    // encoding options
+    private EncodingType encodingType = EncodingType.BER;
+    private boolean isImplicit = true;
+    private boolean isDefinitiveLength = false;
+
     /**
      * Default constructor, generally for decoding as a value container
      * @param tagClass The tag class
@@ -81,22 +85,8 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
         this.tagClass = tagClass;
         this.tagNo = tagNo;
         this.value = value;
-    }
 
-    /**
-     * Set encoding option
-     * @param encodingOption The encoding option
-     */
-    public void setEncodingOption(EncodingOption encodingOption) {
-        this.encodingOption = encodingOption;
-    }
-
-    /**
-     * Get encoding option
-     * @return encoding option
-     */
-    public EncodingOption getEncodingOption() {
-        return this.encodingOption;
+        this.tagFlags |= tagClass.getValue();
     }
 
     public T getValue() {
@@ -107,10 +97,20 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
         this.value = value;
     }
 
-    protected TagClass tagClass() {
+    @Override
+    public TagClass tagClass() {
         return tagClass;
     }
 
+    protected void setTagClass(TagClass tagClass) {
+        this.tagClass = tagClass;
+    }
+
+    @Override
+    public int tagFlags() {
+        return tagFlags;
+    }
+
     @Override
     public int tagNo() {
         return tagNo;
@@ -125,6 +125,70 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
     }
 
     @Override
+    public void usePrimitive(boolean isPrimitive) {
+        if (isPrimitive) {
+            tagFlags &= ~CONSTRUCTED_FLAG;
+        } else {
+            tagFlags |= CONSTRUCTED_FLAG;
+        }
+    }
+
+    @Override
+    public boolean isPrimitive() {
+        return (tagFlags & CONSTRUCTED_FLAG) == 0;
+    }
+
+    @Override
+    public void useDefinitiveLength(boolean isDefinitiveLength) {
+        this.isDefinitiveLength = isDefinitiveLength;
+    }
+
+    @Override
+    public boolean isDefinitiveLength() {
+        return isDefinitiveLength;
+    }
+
+    @Override
+    public void useImplicit(boolean isImplicit) {
+        this.isImplicit = isImplicit;
+    }
+
+    @Override
+    public boolean isImplicit() {
+        return isImplicit;
+    }
+
+    @Override
+    public void useDER() {
+        this.encodingType = EncodingType.DER;
+    }
+
+    @Override
+    public boolean isDER() {
+        return encodingType == EncodingType.DER;
+    }
+
+    @Override
+    public void useBER() {
+        this.encodingType = EncodingType.BER;
+    }
+
+    @Override
+    public boolean isBER() {
+        return encodingType == EncodingType.BER;
+    }
+
+    @Override
+    public void useCER() {
+        this.encodingType = EncodingType.CER;
+    }
+
+    @Override
+    public boolean isCER() {
+        return encodingType == EncodingType.CER;
+    }
+
+    @Override
     public byte[] encode() {
         ByteBuffer byteBuffer = ByteBuffer.allocate(encodingLength());
         encode(byteBuffer);
@@ -152,18 +216,6 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
     }
 
     @Override
-    public int tagFlags() {
-        if (tagFlags == -1) {
-            int flags = tagClass.getValue();
-            if (isConstructed()) {
-                flags |= EncodingOption.CONSTRUCTED_FLAG;
-            }
-            return flags;
-        }
-        return tagFlags;
-    }
-
-    @Override
     public int encodingLength() {
         if (encodingLen == -1) {
             int bodyLen = encodingBodyLength();
@@ -172,14 +224,6 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
         return encodingLen;
     }
 
-    public boolean isConstructed() {
-        if (tagFlags != -1) {
-            return (tagFlags & EncodingOption.CONSTRUCTED_FLAG) != 0;
-        } else {
-            return false;
-        }
-    }
-
     public boolean isUniversal() {
         return tagClass.isUniversal();
     }
@@ -209,27 +253,27 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
     protected void decode(LimitedByteBuffer content) throws IOException {
         int tag = readTag(content);
         int tagNo = readTagNo(content, tag);
-        int tagFlags = tag & 0xe0;
+        int tmpTagFlags = tag & 0xe0;
         int length = readLength(content);
 
-        decode(tagFlags, tagNo, new LimitedByteBuffer(content, length));
+        decode(tmpTagFlags, tagNo, new LimitedByteBuffer(content, length));
     }
 
     public void decode(int tagFlags, int tagNo,
                        LimitedByteBuffer content) throws IOException {
-        if (this.tagClass != TagClass.UNKNOWN && this.tagClass
+        if (tagClass() != TagClass.UNKNOWN && tagClass()
                 != TagClass.fromTagFlags(tagFlags)) {
             throw new IOException("Unexpected tagFlags " + tagFlags
-                    + ", expecting " + this.tagClass);
+                    + ", expecting " + tagClass());
         }
-        if (this.tagNo != -1 && this.tagNo != tagNo) {
+        if (tagNo() != -1 && tagNo() != tagNo) {
             throw new IOException("Unexpected tagNo " + tagNo + ", "
-                    + "expecting " + this.tagNo);
+                    + "expecting " + tagNo());
         }
 
-        this.tagClass = TagClass.fromTagFlags(tagFlags);
-        this.tagFlags = tagFlags;
-        this.tagNo = tagNo;
+        setTagClass(TagClass.fromTagFlags(tagFlags));
+        setTagFlags(tagFlags);
+        setTagNo(tagNo);
 
         decodeBody(content);
     }
@@ -254,7 +298,7 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
 
     @Override
     public void taggedEncode(ByteBuffer buffer, TaggingOption taggingOption) {
-        int taggingTagFlags = taggingOption.tagFlags(isConstructed());
+        int taggingTagFlags = taggingOption.tagFlags(!isPrimitive());
         encodeTag(buffer, taggingTagFlags, taggingOption.getTagNo());
         int taggingBodyLen = taggingOption.isImplicit() ? encodingBodyLength()
                 : encodingLength();
@@ -285,14 +329,14 @@ public abstract class AbstractAsn1Type<T> implements Asn1Type {
         int taggingLength = readLength(content);
         LimitedByteBuffer newContent = new LimitedByteBuffer(content, taggingLength);
 
-        int tagFlags = taggingTag & 0xe0;
-        taggedDecode(tagFlags, taggingTagNo, newContent, taggingOption);
+        int tmpTagFlags = taggingTag & 0xe0;
+        taggedDecode(tmpTagFlags, taggingTagNo, newContent, taggingOption);
     }
 
     protected void taggedDecode(int taggingTagFlags, int taggingTagNo,
                                 LimitedByteBuffer content,
                                 TaggingOption taggingOption) throws IOException {
-        int expectedTaggingTagFlags = taggingOption.tagFlags(isConstructed());
+        int expectedTaggingTagFlags = taggingOption.tagFlags(!isPrimitive());
         if (expectedTaggingTagFlags != taggingTagFlags) {
             throw new IOException("Unexpected tag flags " + taggingTagFlags
                     + ", expecting " + expectedTaggingTagFlags);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1BmpString.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1BmpString.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1BmpString.java
index 4949be0..5f1712d 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1BmpString.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1BmpString.java
@@ -19,7 +19,6 @@
  */
 package org.apache.kerby.asn1.type;
 
-import org.apache.kerby.asn1.EncodingOption;
 import org.apache.kerby.asn1.LimitedByteBuffer;
 import org.apache.kerby.asn1.UniversalTag;
 
@@ -39,7 +38,7 @@ public class Asn1BmpString extends Asn1Simple<String> {
         return getValue().length() * 2;
     }
 
-    protected void toBytes(EncodingOption encodingOption) {
+    protected void toBytes() {
         String strValue = getValue();
         int len = strValue.length();
         byte[] bytes = new byte[len * 2];

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Boolean.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Boolean.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Boolean.java
index 3b70e52..7b9be41 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Boolean.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Boolean.java
@@ -75,7 +75,7 @@ public class Asn1Boolean extends Asn1Simple<Boolean> {
         } else if ((bytes[0] & 0xff) == 0xff) {
             // DER only accepts 0xFF as true
             setValue(true);
-        } else if (getEncodingOption().isBer()) {
+        } else if (isBER()) {
             // BER accepts any non-zero as true
             setValue(true);
         } else {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Choice.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Choice.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Choice.java
index 77116fc..e251e11 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Choice.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Choice.java
@@ -37,12 +37,6 @@ public class Asn1Choice extends AbstractAsn1Type<Asn1Type> {
         setValue(this);
         this.fieldInfos = fieldInfos.clone();
         this.fields = new Asn1Type[fieldInfos.length];
-        getEncodingOption().useConstructed();
-    }
-
-    @Override
-    public boolean isConstructed() {
-        return true;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Collection.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Collection.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Collection.java
index af7fbd2..54a2e9d 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Collection.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Collection.java
@@ -35,12 +35,7 @@ public class Asn1Collection extends AbstractAsn1Type<List<Asn1Item>> {
     public Asn1Collection(TagClass tagClass, int tagNo) {
         super(tagClass, tagNo);
         setValue(new ArrayList<Asn1Item>());
-        getEncodingOption().useConstructed();
-    }
-
-    @Override
-    public boolean isConstructed() {
-        return true;
+        usePrimitive(false);
     }
 
     public void addItem(Asn1Type value) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java
index 194ae8c..2fdb34b 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1CollectionType.java
@@ -38,12 +38,7 @@ public abstract class Asn1CollectionType extends AbstractAsn1Type<Asn1Collection
         setValue(this);
         this.fieldInfos = fieldInfos.clone();
         this.fields = new Asn1Type[fieldInfos.length];
-        getEncodingOption().useConstructed();
-    }
-
-    @Override
-    public boolean isConstructed() {
-        return true;
+        usePrimitive(false);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1EnumType.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1EnumType.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1EnumType.java
index 42eabc6..12e5e65 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1EnumType.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1EnumType.java
@@ -6,19 +6,22 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.kerby.asn1.type;
 
+/**
+ * A helper interface used by Asn1Enumerated.
+ */
 public interface Asn1EnumType {
     int getIntValue();
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Simple.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Simple.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Simple.java
index 877c2f3..deb2de8 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Simple.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Simple.java
@@ -47,7 +47,7 @@ public abstract class Asn1Simple<T> extends AbstractAsn1Type<T> {
      */
     public Asn1Simple(UniversalTag tagNo, T value) {
         super(TagClass.UNIVERSAL, tagNo.getValue(), value);
-        getEncodingOption().usePrimitive();
+        usePrimitive(true);
     }
 
     protected byte[] getBytes() {
@@ -100,11 +100,6 @@ public abstract class Asn1Simple<T> extends AbstractAsn1Type<T> {
         }
     }
 
-    @Override
-    public boolean isConstructed() {
-        return false;
-    }
-
     protected void toValue() throws IOException { }
 
     protected void toBytes() { }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Tagging.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Tagging.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Tagging.java
index d9c0d28..dd7d394 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Tagging.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Tagging.java
@@ -31,65 +31,56 @@ import java.nio.ByteBuffer;
  */
 public class Asn1Tagging<T extends Asn1Type> extends AbstractAsn1Type<T> {
 
-    public Asn1Tagging(boolean isAppSpecific) {
-        this(-1, null, isAppSpecific);
-    }
-
-    public Asn1Tagging(int tagNo, T value, boolean isAppSpecific) {
-        super(isAppSpecific ? TagClass.APPLICATION : TagClass.CONTEXT_SPECIFIC, tagNo, value);
-        getEncodingOption().useExplicit();
+    public Asn1Tagging(int tagNo, T value,
+                       boolean isAppSpecific, boolean isImplicit) {
+        super(isAppSpecific ? TagClass.APPLICATION : TagClass.CONTEXT_SPECIFIC,
+            tagNo, value);
         if (value == null) {
             initValue();
         }
+        useImplicit(isImplicit);
     }
 
     @Override
-    protected int encodingBodyLength() {
-        AbstractAsn1Type<?> value = (AbstractAsn1Type<?>) getValue();
-        if (getEncodingOption().isExplicit()) {
-            return value.encodingLength();
-        } else if (getEncodingOption().isImplicit()) {
-            return value.encodingBodyLength();
+    public void useImplicit(boolean isImplicit) {
+        super.useImplicit(isImplicit);
+
+        if (!isImplicit) {
+            //In effect, explicitly tagged types are structured types consisting
+            // of one component, the underlying type.
+            super.usePrimitive(false);
         } else {
-            throw new RuntimeException("Invalid decoding option, "
-                    + "only allowing explicit/implicit");
+            super.usePrimitive(getValue().isPrimitive());
         }
     }
 
     @Override
-    public boolean isConstructed() {
-        if (getEncodingOption().isExplicit()) {
-            return true;
-        } else if (getEncodingOption().isImplicit()) {
-            AbstractAsn1Type<?> value = (AbstractAsn1Type<?>) getValue();
-            return value.isConstructed();
+    protected int encodingBodyLength() {
+        AbstractAsn1Type<?> value = (AbstractAsn1Type<?>) getValue();
+        if (isImplicit()) {
+            return value.encodingBodyLength();
+        } else {
+            return value.encodingLength();
         }
-        return false;
     }
 
     @Override
     protected void encodeBody(ByteBuffer buffer) {
         AbstractAsn1Type<?> value = (AbstractAsn1Type<?>) getValue();
-        if (getEncodingOption().isExplicit()) {
-            value.encode(buffer);
-        } else if (getEncodingOption().isImplicit()) {
+        if (isImplicit()) {
             value.encodeBody(buffer);
         } else {
-            throw new RuntimeException("Invalid decoding option, "
-                    + "only allowing explicit/implicit");
+            value.encode(buffer);
         }
     }
 
     @Override
     protected void decodeBody(LimitedByteBuffer content) throws IOException {
         AbstractAsn1Type<?> value = (AbstractAsn1Type<?>) getValue();
-        if (getEncodingOption().isExplicit()) {
-            value.decode(content);
-        } else if (getEncodingOption().isImplicit()) {
+        if (isImplicit()) {
             value.decodeBody(content);
         } else {
-            throw new RuntimeException("Invalid decoding option, "
-                    + "only allowing explicit/implicit");
+            value.decode(content);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Type.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Type.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Type.java
index c77418b..271e795 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Type.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/Asn1Type.java
@@ -19,7 +19,7 @@
  */
 package org.apache.kerby.asn1.type;
 
-import org.apache.kerby.asn1.EncodingOption;
+import org.apache.kerby.asn1.TagClass;
 import org.apache.kerby.asn1.TaggingOption;
 
 import java.io.IOException;
@@ -30,6 +30,27 @@ import java.nio.ByteBuffer;
  */
 public interface Asn1Type {
     /**
+     * A mask to determinate if a Tag is CONSTRUCTED. The fifth bit should be
+     * set to 1 if the type is constructed (0010-0000).
+     */
+    int CONSTRUCTED_FLAG = 0x20;
+
+    /**
+     * Encoding type
+     */
+    enum EncodingType {
+        BER,
+        DER,
+        CER;
+    }
+
+    /**
+     *
+     * @return The tag class
+     */
+    TagClass tagClass();
+
+    /**
      *
      * @return The tag flags
      */
@@ -42,11 +63,76 @@ public interface Asn1Type {
     int tagNo();
 
     /**
-     * Set encoding option.
-     * See {@link org.apache.kerby.asn1.EncodingOption}.
-     * @param encodingOption The encoding option
+     * Use primitive or constructed.
+     */
+    void usePrimitive(boolean isPrimitive);
+
+    /**
+     * Tells if it is PRIMITIVE or not.
+     *
+     * @return true if using PRIMITIVE, false otherwise
+     */
+    boolean isPrimitive();
+
+    /**
+     * Use definitive length or not.
+     * Note definitive length only makes sense when it's constructed.
+     */
+    void useDefinitiveLength(boolean isDefinitiveLength);
+
+    /**
+     * Tells if it's definitive length or not.
+     * @return The boolean value
+     */
+    boolean isDefinitiveLength();
+
+    /**
+     * Use implicit or not.
+     */
+    void useImplicit(boolean isImplicit);
+
+    /**
+     * Tells if it's is IMPLICIT or not.
+     *
+     * @return true if using IMPLICIT, false otherwise
+     */
+    boolean isImplicit();
+
+    /**
+     * Set encoding type as DER.
+     */
+    void useDER();
+
+    /**
+     * Tells if it's is DER
+     *
+     * @return true if using DER, false otherwise
+     */
+    boolean isDER();
+
+    /**
+     * Set encoding type as BER.
+     */
+    void useBER();
+
+    /**
+     * Tells if it's is BER
+     *
+     * @return true if using BER, false otherwise
+     */
+    boolean isBER();
+
+    /**
+     * Set encoding type as CER.
+     */
+    void useCER();
+
+    /**
+     * Tells if it's is CER
+     *
+     * @return true if using CER, false otherwise
      */
-    void setEncodingOption(EncodingOption encodingOption);
+    boolean isCER();
 
     /**
      * Get length of encoding bytes by just calculating without real encoding.

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingCollection.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingCollection.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingCollection.java
index d316b7b..1d810a3 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingCollection.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingCollection.java
@@ -19,7 +19,6 @@
  */
 package org.apache.kerby.asn1.type;
 
-import org.apache.kerby.asn1.EncodingOption;
 import org.apache.kerby.asn1.LimitedByteBuffer;
 import org.apache.kerby.asn1.TagClass;
 
@@ -27,38 +26,97 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 
 /**
- * For tagging a collection type with tagNo, either application specific or context specific class
+ * For tagging a collection type with tagNo, either application specific or
+ * context specific class
  */
 public abstract class TaggingCollection extends AbstractAsn1Type<Asn1CollectionType> {
     private Asn1Tagging<Asn1CollectionType> tagging;
     private Asn1CollectionType tagged;
 
-    public TaggingCollection(int taggingTagNo, Asn1FieldInfo[] tags, boolean isAppSpecific) {
-        super(isAppSpecific ? TagClass.APPLICATION : TagClass.CONTEXT_SPECIFIC, taggingTagNo);
+    public TaggingCollection(int taggingTagNo, Asn1FieldInfo[] tags,
+                             boolean isAppSpecific, boolean isImplicit) {
+        super(isAppSpecific ? TagClass.APPLICATION : TagClass.CONTEXT_SPECIFIC,
+            taggingTagNo);
         this.tagged = createTaggedCollection(tags);
         setValue(tagged);
-        this.tagging = new Asn1Tagging<Asn1CollectionType>(taggingTagNo, tagged, isAppSpecific);
-        getEncodingOption().useExplicit();
+        this.tagging = new Asn1Tagging<Asn1CollectionType>(taggingTagNo,
+            tagged, isAppSpecific, isImplicit);
     }
 
     protected abstract Asn1CollectionType createTaggedCollection(Asn1FieldInfo[] tags);
 
     @Override
-    public void setEncodingOption(EncodingOption encodingOption) {
-        tagging.setEncodingOption(encodingOption);
+    public int tagFlags() {
+        return tagging.tagFlags();
     }
 
     @Override
-    public EncodingOption getEncodingOption() {
-        return tagging.getEncodingOption();
+    public int tagNo() {
+        return tagging.tagNo();
     }
 
     @Override
-    public boolean isConstructed() {
-        return tagging.isConstructed();
+    public void usePrimitive(boolean isPrimitive) {
+        tagging.usePrimitive(isPrimitive);
     }
 
     @Override
+    public boolean isPrimitive() {
+        return tagging.isPrimitive();
+    }
+
+    @Override
+    public void useDefinitiveLength(boolean isDefinitiveLength) {
+        tagging.useDefinitiveLength(isDefinitiveLength);
+    }
+
+    @Override
+    public boolean isDefinitiveLength() {
+        return tagging.isDefinitiveLength();
+    }
+
+    @Override
+    public void useImplicit(boolean isImplicit) {
+        tagging.useImplicit(isImplicit);
+    }
+
+    @Override
+    public boolean isImplicit() {
+        return tagging.isImplicit();
+    }
+
+    @Override
+    public void useDER() {
+        tagging.useDER();
+    }
+
+    @Override
+    public boolean isDER() {
+        return tagging.isDER();
+    }
+
+    @Override
+    public void useBER() {
+        tagging.useBER();
+    }
+
+    @Override
+    public boolean isBER() {
+        return tagging.isBER();
+    }
+
+    @Override
+    public void useCER() {
+        tagging.useCER();
+    }
+
+    @Override
+    public boolean isCER() {
+        return tagging.isCER();
+    }
+
+
+    @Override
     protected int encodingBodyLength() {
         return tagging.encodingBodyLength();
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingSequence.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingSequence.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingSequence.java
index 90ecaed..eab2aaf 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingSequence.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingSequence.java
@@ -24,8 +24,9 @@ package org.apache.kerby.asn1.type;
  */
 public class TaggingSequence extends TaggingCollection {
 
-    public TaggingSequence(int taggingTagNo, Asn1FieldInfo[] tags, boolean isAppSpecific) {
-        super(taggingTagNo, tags, isAppSpecific);
+    public TaggingSequence(int taggingTagNo, Asn1FieldInfo[] tags,
+                           boolean isAppSpecific, boolean isImplicit) {
+        super(taggingTagNo, tags, isAppSpecific, isImplicit);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingSet.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingSet.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingSet.java
index c4807d0..444102b 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingSet.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/type/TaggingSet.java
@@ -24,8 +24,9 @@ package org.apache.kerby.asn1.type;
  */
 public class TaggingSet extends TaggingCollection {
 
-    public TaggingSet(int taggingTagNo, Asn1FieldInfo[] tags, boolean isAppSpecific) {
-        super(taggingTagNo, tags, isAppSpecific);
+    public TaggingSet(int taggingTagNo, Asn1FieldInfo[] tags,
+                      boolean isAppSpecific, boolean isImplicit) {
+        super(taggingTagNo, tags, isAppSpecific, isImplicit);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java
index a5c10f8..cee7d3b 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/PersonnelRecord.java
@@ -51,8 +51,7 @@ public class PersonnelRecord extends TaggingSet {
     };
 
     public PersonnelRecord() {
-        super(0, fieldInfos, true);
-        getEncodingOption().useImplicit();
+        super(0, fieldInfos, true, true);
     }
 
     public void setName(Name name) {
@@ -158,8 +157,7 @@ public class PersonnelRecord extends TaggingSet {
         };
 
         public Name() {
-            super(1, tags, true);
-            getEncodingOption().useImplicit();
+            super(1, tags, true, true);
         }
 
         public Name(String givenName, String initial, String familyName) {
@@ -196,20 +194,17 @@ public class PersonnelRecord extends TaggingSet {
 
     public static class EmployeeNumber extends Asn1Tagging<Asn1Integer> {
         public EmployeeNumber(Integer value) {
-            super(2, new Asn1Integer(value), true);
-            getEncodingOption().useImplicit();
+            super(2, new Asn1Integer(value), true, true);
         }
 
         public EmployeeNumber() {
-            super(2, new Asn1Integer(), true);
-            getEncodingOption().useImplicit();
+            super(2, new Asn1Integer(), true, true);
         }
     }
 
     public static class Date extends Asn1Tagging<Asn1VisibleString> {
         public Date(String value) {
-            super(3, new Asn1VisibleString(value), true);
-            getEncodingOption().useImplicit();
+            super(3, new Asn1VisibleString(value), true, true);
         }
         public Date() {
             this(null);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Boolean.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Boolean.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Boolean.java
index 947f30f..177ddef 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Boolean.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Boolean.java
@@ -39,9 +39,9 @@ public class TestAsn1Boolean {
         byte[] expected = Util.hex2bytes(expectedEncoding);
         Asn1Boolean aValue = new Asn1Boolean(value);
         if (isDer) {
-            aValue.getEncodingOption().useDer();
+            aValue.useDER();
         } else {
-            aValue.getEncodingOption().useBer();
+            aValue.useBER();
         }
         byte[] encodingBytes = aValue.encode();
         assertThat(encodingBytes).isEqualTo(expected);
@@ -59,9 +59,9 @@ public class TestAsn1Boolean {
                                   boolean isDer) throws IOException {
         Asn1Boolean decoded = new Asn1Boolean();
         if (isDer) {
-            decoded.getEncodingOption().useDer();
+            decoded.useDER();
         } else {
-            decoded.getEncodingOption().useBer();
+            decoded.useBER();
         }
         decoded.decode(Util.hex2bytes(content));
         assertThat(decoded.getValue()).isEqualTo(expectedValue);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Integer.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Integer.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Integer.java
index f9a774e..8eb4b4d 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Integer.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1Integer.java
@@ -44,7 +44,7 @@ public class TestAsn1Integer {
     private void testEncodingWith(int value, String expectedEncoding) {
         byte[] expected = Util.hex2bytes(expectedEncoding);
         Asn1Integer aValue = new Asn1Integer(value);
-        aValue.getEncodingOption().useDer();
+        aValue.useDER();
         byte[] encodingBytes = aValue.encode();
         assertThat(encodingBytes).isEqualTo(expected);
     }
@@ -64,7 +64,7 @@ public class TestAsn1Integer {
 
     private void testDecodingWith(int expectedValue, String content) throws IOException {
         Asn1Integer decoded = new Asn1Integer();
-        decoded.getEncodingOption().useDer();
+        decoded.useDER();
         decoded.decode(Util.hex2bytes(content));
         assertThat(decoded.getValue().intValue()).isEqualTo(expectedValue);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1ObjectIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1ObjectIdentifier.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1ObjectIdentifier.java
index cb97922..726c23e 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1ObjectIdentifier.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1ObjectIdentifier.java
@@ -45,7 +45,7 @@ public class TestAsn1ObjectIdentifier {
     private void testEncodingWith(String oid, String expectedEncoding) {
         byte[] expected = Util.hex2bytes(expectedEncoding);
         Asn1ObjectIdentifier aValue = new Asn1ObjectIdentifier(oid);
-        aValue.getEncodingOption().useDer();
+        aValue.useDER();
         byte[] encodingBytes = aValue.encode();
         assertThat(encodingBytes).isEqualTo(expected);
     }
@@ -58,7 +58,7 @@ public class TestAsn1ObjectIdentifier {
 
     private void testDecodingWith(String expectedValue, String content) throws IOException {
         Asn1ObjectIdentifier decoded = new Asn1ObjectIdentifier();
-        decoded.getEncodingOption().useDer();
+        decoded.useDER();
         decoded.decode(Util.hex2bytes(content));
         assertThat(decoded.getValue()).isEqualTo(expectedValue);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1UtcTime.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1UtcTime.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1UtcTime.java
index 6d4d2a2..ebc1509 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1UtcTime.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestAsn1UtcTime.java
@@ -48,7 +48,7 @@ public class TestAsn1UtcTime {
     private void testEncodingWith(Date value, String expectedEncoding) {
         byte[] expected = Util.hex2bytes(expectedEncoding);
         Asn1UtcTime aValue = new Asn1UtcTime(value);
-        aValue.getEncodingOption().useDer();
+        aValue.useDER();
         byte[] encodingBytes = aValue.encode();
         assertThat(encodingBytes).isEqualTo(expected);
     }
@@ -64,7 +64,7 @@ public class TestAsn1UtcTime {
 
     private void testDecodingWith(Date expectedValue, String content) throws IOException {
         Asn1UtcTime decoded = new Asn1UtcTime();
-        decoded.getEncodingOption().useDer();
+        decoded.useDER();
         decoded.decode(Util.hex2bytes(content));
         assertThat(decoded.getValue()).isEqualTo(expectedValue);
     }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestTaggingEncoding.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestTaggingEncoding.java b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestTaggingEncoding.java
index 26fb3a2..6956b46 100644
--- a/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestTaggingEncoding.java
+++ b/kerby-asn1/src/test/java/org/apache/kerby/asn1/TestTaggingEncoding.java
@@ -87,8 +87,7 @@ public class TestTaggingEncoding {
 
     public static class Type2 extends Asn1Tagging<Type1> {
         public Type2(Type1 value) {
-            super(3, value, true);
-            getEncodingOption().useImplicit();
+            super(3, value, true, true);
         }
         public Type2() {
             this(null);
@@ -97,8 +96,7 @@ public class TestTaggingEncoding {
 
     public static class Type3 extends Asn1Tagging<Type2> {
         public Type3(Type2 value) {
-            super(2, value, false);
-            getEncodingOption().useExplicit();
+            super(2, value, false, false);
         }
         public Type3() {
             this(null);
@@ -107,8 +105,7 @@ public class TestTaggingEncoding {
 
     public static class Type4 extends Asn1Tagging<Type3> {
         public Type4(Type3 value) {
-            super(7, value, true);
-            getEncodingOption().useImplicit();
+            super(7, value, true, true);
         }
         public Type4() {
             this(null);
@@ -117,8 +114,7 @@ public class TestTaggingEncoding {
 
     public static class Type5 extends Asn1Tagging<Type2> {
         public Type5(Type2 value) {
-            super(2, value, false);
-            getEncodingOption().useImplicit();
+            super(2, value, false, true);
         }
         public Type5() {
             this(null);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/1f4b21c8/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java
index 05e87f1..6e4e1bd 100644
--- a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/spec/KrbAppSequenceType.java
@@ -28,7 +28,7 @@ import org.apache.kerby.asn1.type.TaggingSequence;
  */
 public abstract class KrbAppSequenceType extends TaggingSequence {
     public KrbAppSequenceType(int tagNo, Asn1FieldInfo[] fieldInfos) {
-        super(tagNo, fieldInfos, true);
+        super(tagNo, fieldInfos, true, false); // Kerberos favors explicit
     }
 
     protected int getFieldAsInt(int index) {