You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by dr...@apache.org on 2015/11/27 07:50:17 UTC
[1/3] directory-kerby git commit: DIRKRB-473. Initially added X509
ASN1 types
Repository: directory-kerby
Updated Branches:
refs/heads/master 0cac18217 -> 93bcd6fe5
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>
[3/3] directory-kerby git commit: DIRKRB-473. Initially added X509
ASN1 types
Posted by dr...@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/master
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);
+ }
+}
[2/3] directory-kerby git commit: DIRKRB-473. Initially added X509
ASN1 types
Posted by dr...@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.&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.&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);
+ }
+}