You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pl...@apache.org on 2015/11/27 08:09:53 UTC
directory-kerby git commit: DIRKRB-463 Cryptographic Message Syntax
(CMS) support.
Repository: directory-kerby
Updated Branches:
refs/heads/master 93bcd6fe5 -> ac93a2010
DIRKRB-463 Cryptographic Message Syntax (CMS) support.
Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/ac93a201
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/ac93a201
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/ac93a201
Branch: refs/heads/master
Commit: ac93a2010fce13333c80047f4fbd48b529b74f9d
Parents: 93bcd6f
Author: plusplusjiajia <ji...@intel.com>
Authored: Fri Nov 27 15:15:56 2015 +0800
Committer: plusplusjiajia <ji...@intel.com>
Committed: Fri Nov 27 15:15:56 2015 +0800
----------------------------------------------------------------------
kerby-pkix/pom.xml | 1 +
.../org/apache/kerby/cms/type/Attribute.java | 66 +++++++++
.../cms/type/AttributeCertificateInfoV1.java | 147 +++++++++++++++++++
.../kerby/cms/type/AttributeCertificateV1.java | 73 +++++++++
.../kerby/cms/type/AttributeCertificateV2.java | 29 ++++
.../org/apache/kerby/cms/type/Certificate.java | 76 ++++++++++
.../kerby/cms/type/CertificateChoices.java | 93 ++++++++++++
.../apache/kerby/cms/type/CertificateList.java | 77 ++++++++++
.../apache/kerby/cms/type/CertificateSet.java | 29 ++++
.../org/apache/kerby/cms/type/CmsVersion.java | 53 +++++++
.../apache/kerby/cms/type/CompressedData.java | 77 ++++++++++
.../org/apache/kerby/cms/type/ContentInfo.java | 69 +++++++++
.../cms/type/DigestAlgorithmIdentifier.java | 28 ++++
.../cms/type/DigestAlgorithmIdentifiers.java | 28 ++++
.../kerby/cms/type/EncapsulatedContentInfo.java | 64 ++++++++
.../kerby/cms/type/ExtendedCertificate.java | 70 +++++++++
.../kerby/cms/type/ExtendedCertificateInfo.java | 71 +++++++++
.../kerby/cms/type/IssuerAndSerialNumber.java | 66 +++++++++
.../kerby/cms/type/OtherCertificateFormat.java | 63 ++++++++
.../cms/type/OtherRevocationInfoFormat.java | 62 ++++++++
.../cms/type/RelativeDistinguishedName.java | 29 ++++
.../kerby/cms/type/RevocationInfoChoice.java | 60 ++++++++
.../kerby/cms/type/RevocationInfoChoices.java | 28 ++++
.../org/apache/kerby/cms/type/Signature.java | 28 ++++
.../cms/type/SignatureAlgorithmIdentifier.java | 28 ++++
.../apache/kerby/cms/type/SignatureValue.java | 28 ++++
.../apache/kerby/cms/type/SignedAttributes.java | 28 ++++
.../org/apache/kerby/cms/type/SignedData.java | 108 ++++++++++++++
.../apache/kerby/cms/type/SignerIdentifier.java | 66 +++++++++
.../org/apache/kerby/cms/type/SignerInfo.java | 119 +++++++++++++++
.../org/apache/kerby/cms/type/SignerInfos.java | 28 ++++
.../java/org/apache/kerby/cms/type/Subject.java | 65 ++++++++
.../kerby/cms/type/UnsignedAttributes.java | 28 ++++
33 files changed, 1885 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/pom.xml
----------------------------------------------------------------------
diff --git a/kerby-pkix/pom.xml b/kerby-pkix/pom.xml
index 77abf62..3c3d5be 100644
--- a/kerby-pkix/pom.xml
+++ b/kerby-pkix/pom.xml
@@ -30,6 +30,7 @@
<dependency>
<groupId>org.apache.kerby</groupId>
<artifactId>kerby-asn1</artifactId>
+ <version>${project.version}</version>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Attribute.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Attribute.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Attribute.java
new file mode 100644
index 0000000..cffd5ed
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Attribute.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.AttributeValues;
+
+/**
+ * Ref. RFC 5652
+ * <pre>
+ * Attribute ::= SEQUENCE {
+ * attrType OBJECT IDENTIFIER,
+ * attrValues SET OF AttributeValue
+ * }
+ *
+ * AttributeValue ::= ANY
+ * </pre>
+ */
+public class Attribute extends Asn1SequenceType {
+ private static final int ATTR_TYPE = 0;
+ private static final int ATTR_VALUES = 1;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+ new Asn1FieldInfo(ATTR_TYPE, Asn1ObjectIdentifier.class),
+ new Asn1FieldInfo(ATTR_VALUES, AttributeValues.class),
+ };
+
+ public Attribute() {
+ super(fieldInfos);
+ }
+
+ public Asn1ObjectIdentifier getAttrType() {
+ return getFieldAs(ATTR_TYPE, Asn1ObjectIdentifier.class);
+ }
+
+ public void setAttrType(Asn1ObjectIdentifier attrType) {
+ setFieldAs(ATTR_TYPE, attrType);
+ }
+
+ public AttributeValues getAttrValues() {
+ return getFieldAs(ATTR_VALUES, AttributeValues.class);
+ }
+
+ public void setAttrValues(AttributeValues values) {
+ setFieldAs(ATTR_VALUES, values);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateInfoV1.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateInfoV1.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateInfoV1.java
new file mode 100644
index 0000000..9b6c395
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateInfoV1.java
@@ -0,0 +1,147 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+import org.apache.kerby.x509.type.AttCertIssuer;
+import org.apache.kerby.x509.type.AttCertValidityPeriod;
+import org.apache.kerby.x509.type.Attributes;
+import org.apache.kerby.x509.type.CertificateSerialNumber;
+import org.apache.kerby.x509.type.Extensions;
+
+/**
+ * AttributeCertificateInfoV1 ::= SEQUENCE {
+ * version AttCertVersionV1 DEFAULT v1,
+ * subject Subject,
+ * issuer GeneralNames,
+ * signature AlgorithmIdentifier,
+ * serialNumber CertificateSerialNumber,
+ * attCertValidityPeriod AttCertValidityPeriod,
+ * attributes SEQUENCE OF Attribute,
+ * issuerUniqueID UniqueIdentifier OPTIONAL,
+ * extensions Extensions OPTIONAL
+ * }
+ *
+ * AttCertVersionV1 ::= INTEGER { v1(0) }
+ */
+public class AttributeCertificateInfoV1 extends Asn1SequenceType {
+
+ private static final int VERSION = 0;
+ private static final int SUBJECT = 1;
+ private static final int ISSUER = 2;
+ private static final int SIGNATURE = 3;
+ private static final int SERIAL_NUMBER = 4;
+ private static final int ATTR_CERT_VALIDITY_PERIOD = 5;
+ private static final int ATTRIBUTES = 6;
+ private static final int ISSUER_UNIQUE_ID = 7;
+ private static final int EXTENSIONS = 8;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new Asn1FieldInfo(VERSION, Asn1Integer.class),
+ new Asn1FieldInfo(SUBJECT, Subject.class),
+ new Asn1FieldInfo(ISSUER, AttCertIssuer.class),
+ new Asn1FieldInfo(SIGNATURE, AlgorithmIdentifier.class),
+ new Asn1FieldInfo(SERIAL_NUMBER, CertificateSerialNumber.class),
+ new Asn1FieldInfo(ATTR_CERT_VALIDITY_PERIOD, AttCertValidityPeriod.class),
+ new Asn1FieldInfo(ATTRIBUTES, Attributes.class),
+ new Asn1FieldInfo(ISSUER_UNIQUE_ID, Asn1BitString.class),
+ new Asn1FieldInfo(EXTENSIONS, Extensions.class)
+ };
+
+ public AttributeCertificateInfoV1() {
+ super(fieldInfos);
+ }
+
+ public int getVersion() {
+ return getFieldAsInteger(VERSION);
+ }
+
+ public void setVersion(int version) {
+ setFieldAsInt(VERSION, version);
+ }
+
+ public Subject getSubject() {
+ return getFieldAs(SUBJECT, Subject.class);
+ }
+
+ public void setSubject(Subject subject) {
+ setFieldAs(SUBJECT, subject);
+ }
+
+ public AttCertIssuer getIssuer() {
+ return getFieldAs(ISSUER, AttCertIssuer.class);
+ }
+
+ public void setIssuer(AttCertIssuer attCertIssuer) {
+ setFieldAs(ISSUER, attCertIssuer);
+ }
+
+ public AlgorithmIdentifier getSignature() {
+ return getFieldAs(SIGNATURE, AlgorithmIdentifier.class);
+ }
+
+ public void setSignature(AlgorithmIdentifier signature) {
+ setFieldAs(SIGNATURE, signature);
+ }
+
+ public CertificateSerialNumber getSerialNumber() {
+ return getFieldAs(SERIAL_NUMBER, CertificateSerialNumber.class);
+ }
+
+ public void setSerialNumber(CertificateSerialNumber certificateSerialNumber) {
+ setFieldAs(SERIAL_NUMBER, certificateSerialNumber);
+ }
+
+ public AttCertValidityPeriod getAttrCertValidityPeriod() {
+ return getFieldAs(ATTR_CERT_VALIDITY_PERIOD, AttCertValidityPeriod.class);
+ }
+
+ public void setAttrCertValidityPeriod(AttCertValidityPeriod attrCertValidityPeriod) {
+ setFieldAs(ATTR_CERT_VALIDITY_PERIOD, attrCertValidityPeriod);
+ }
+
+ public Attributes getAttributes() {
+ return getFieldAs(ATTRIBUTES, Attributes.class);
+ }
+
+ public void setAttributes(Attributes attributes) {
+ setFieldAs(ATTRIBUTES, attributes);
+ }
+
+ public byte[] getIssuerUniqueID() {
+ return getFieldAs(ISSUER_UNIQUE_ID, Asn1BitString.class).getValue();
+ }
+
+ public void setIssuerUniqueId(byte[] issuerUniqueId) {
+ setFieldAs(ISSUER_UNIQUE_ID, new Asn1BitString(issuerUniqueId));
+ }
+
+ public Extensions getExtensions() {
+ return getFieldAs(EXTENSIONS, Extensions.class);
+ }
+
+ public void setExtensions(Extensions extensions) {
+ setFieldAs(EXTENSIONS, extensions);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV1.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV1.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV1.java
new file mode 100644
index 0000000..4556c39
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV1.java
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+import org.apache.kerby.x509.type.AttributeCertificateInfo;
+
+/**
+ * AttributeCertificateV1 ::= SEQUENCE {
+ * acInfo AttributeCertificateInfoV1,
+ * signatureAlgorithm AlgorithmIdentifier,
+ * signature BIT STRING
+ * }
+ */
+public class AttributeCertificateV1 extends Asn1SequenceType {
+ private static final int ACI_INFO = 0;
+ private static final int SIGNATURE_ALGORITHM = 1;
+ private static final int SIGNATURE = 2;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new Asn1FieldInfo(ACI_INFO, AttributeCertificateInfoV1.class),
+ new Asn1FieldInfo(SIGNATURE_ALGORITHM, AlgorithmIdentifier.class),
+ new Asn1FieldInfo(SIGNATURE, Asn1BitString.class)
+ };
+
+ public AttributeCertificateV1(Asn1FieldInfo[] tags) {
+ super(tags);
+ }
+
+ public AttributeCertificateInfo getAcinfo() {
+ return getFieldAs(ACI_INFO, AttributeCertificateInfo.class);
+ }
+
+ public void setAciInfo(AttributeCertificateInfo aciInfo) {
+ setFieldAs(ACI_INFO, aciInfo);
+ }
+
+ public AlgorithmIdentifier getSignatureAlgorithm() {
+ return getFieldAs(SIGNATURE_ALGORITHM, AlgorithmIdentifier.class);
+ }
+
+ public void setSignatureAlgorithm(AlgorithmIdentifier signatureAlgorithm) {
+ setFieldAs(SIGNATURE_ALGORITHM, signatureAlgorithm);
+ }
+
+ public Asn1BitString getSignatureValue() {
+ return getFieldAs(SIGNATURE, Asn1BitString.class);
+ }
+
+ public void setSignatureValue(Asn1BitString signatureValue) {
+ setFieldAs(SIGNATURE, signatureValue);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV2.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV2.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV2.java
new file mode 100644
index 0000000..df21d03
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/AttributeCertificateV2.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.x509.type.AttributeCertificate;
+
+/**
+ * AttributeCertificateV2 ::= AttributeCertificate
+ */
+public class AttributeCertificateV2 extends AttributeCertificate {
+
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Certificate.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Certificate.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Certificate.java
new file mode 100644
index 0000000..53a570f
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Certificate.java
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+import org.apache.kerby.x509.type.TBSCertificate;
+
+/**
+ * <pre>
+ * Certificate ::= SEQUENCE {
+ * tbsCertificate TBSCertificate,
+ * signatureAlgorithm AlgorithmIdentifier,
+ * signature BIT STRING
+ * }
+ * </pre>
+ */
+public class Certificate extends Asn1SequenceType {
+
+ private static final int TBS_CERTIFICATE = 0;
+ private static final int SIGNATURE_ALGORITHM = 1;
+ private static final int SIGNATURE = 2;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new Asn1FieldInfo(TBS_CERTIFICATE, TBSCertificate.class),
+ new Asn1FieldInfo(SIGNATURE_ALGORITHM, AlgorithmIdentifier.class),
+ new Asn1FieldInfo(SIGNATURE, Asn1BitString.class)
+ };
+
+ public Certificate() {
+ super(fieldInfos);
+ }
+
+ public TBSCertificate getTBSCertificate() {
+ return getFieldAs(TBS_CERTIFICATE, TBSCertificate.class);
+ }
+
+ public void setTbsCertificate(TBSCertificate tbsCertificate) {
+ setFieldAs(TBS_CERTIFICATE, tbsCertificate);
+ }
+
+ public AlgorithmIdentifier getSignatureAlgorithm() {
+ return getFieldAs(SIGNATURE_ALGORITHM, AlgorithmIdentifier.class);
+ }
+
+ public void setSignatureAlgorithm(AlgorithmIdentifier signatureAlgorithm) {
+ setFieldAs(SIGNATURE_ALGORITHM, signatureAlgorithm);
+ }
+
+ public Asn1BitString getSignature() {
+ return getFieldAs(SIGNATURE, Asn1BitString.class);
+ }
+
+ public void setSignature(Asn1BitString signature) {
+ setFieldAs(SIGNATURE, signature);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateChoices.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateChoices.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateChoices.java
new file mode 100644
index 0000000..cb6a601
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateChoices.java
@@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ImplicitField;
+
+/**
+ * CertificateChoices ::= CHOICE {
+ * certificate Certificate,
+ * extendedCertificate [0] IMPLICIT ExtendedCertificate, -- Obsolete
+ * v1AttrCert [1] IMPLICIT AttributeCertificateV1, -- Obsolete
+ * v2AttrCert [2] IMPLICIT AttributeCertificateV2,
+ * other [3] IMPLICIT OtherCertificateFormat }
+ */
+public class CertificateChoices extends Asn1Choice {
+
+ private static final int CERTIFICATE = 0;
+ private static final int EXTENDED_CERTIFICATE = 1;
+ private static final int V1_ATTR_CERT = 2;
+ private static final int V2_ATTR_CERT = 3;
+ private static final int OTHER = 4;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new Asn1FieldInfo(CERTIFICATE, Certificate.class),
+ new ImplicitField(EXTENDED_CERTIFICATE, 0, ExtendedCertificate.class),
+ new ImplicitField(V1_ATTR_CERT, 1, AttributeCertificateV1.class),
+ new ImplicitField(V2_ATTR_CERT, 2, AttributeCertificateV2.class),
+ new ImplicitField(OTHER, 3, OtherCertificateFormat.class),
+ };
+
+ public CertificateChoices() {
+ super(fieldInfos);
+ }
+
+ public Certificate getCertificate() {
+ return getFieldAs(CERTIFICATE, Certificate.class);
+ }
+
+ public void setCertificate(Certificate certificate) {
+ setFieldAs(CERTIFICATE, certificate);
+ }
+
+ public ExtendedCertificate getExtendedCertificate() {
+ return getFieldAs(EXTENDED_CERTIFICATE, ExtendedCertificate.class);
+ }
+
+ public void setExtendedCertificate(ExtendedCertificate extendedCertificate) {
+ setFieldAs(EXTENDED_CERTIFICATE, extendedCertificate);
+ }
+
+ public AttributeCertificateV1 getV1AttrCert() {
+ return getFieldAs(V1_ATTR_CERT, AttributeCertificateV1.class);
+ }
+
+ public void setV1AttrCert(AttributeCertificateV1 v1AttrCert) {
+ setFieldAs(V1_ATTR_CERT, v1AttrCert);
+ }
+
+ public AttributeCertificateV2 getV2AttrCert() {
+ return getFieldAs(V2_ATTR_CERT, AttributeCertificateV2.class);
+ }
+
+ public void setV2AttrCert(AttributeCertificateV2 v2AttrCert) {
+ setFieldAs(V2_ATTR_CERT, v2AttrCert);
+ }
+
+ public OtherCertificateFormat getOther() {
+ return getFieldAs(OTHER, OtherCertificateFormat.class);
+ }
+
+ public void setOther(OtherCertificateFormat other) {
+ setFieldAs(OTHER, other);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateList.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateList.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateList.java
new file mode 100644
index 0000000..a456f96
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateList.java
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+import org.apache.kerby.x509.type.TBSCertList;
+
+/**
+ * Ref. RFC-2459
+ *
+ * <pre>
+ * CertificateList ::= SEQUENCE {
+ * tbsCertList TBSCertList,
+ * signatureAlgorithm AlgorithmIdentifier,
+ * signatureValue BIT STRING
+ * }
+ * </pre>
+ */
+public class CertificateList extends Asn1SequenceType {
+ private static final int TBS_CERT_LIST = 0;
+ private static final int SIGNATURE_ALGORITHMS = 1;
+ private static final int SIGNATURE_VALUE = 2;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new Asn1FieldInfo(TBS_CERT_LIST, TBSCertList.class),
+ new Asn1FieldInfo(SIGNATURE_ALGORITHMS, AlgorithmIdentifier.class),
+ new Asn1FieldInfo(SIGNATURE_VALUE, Asn1BitString.class)
+ };
+
+ public CertificateList() {
+ super(fieldInfos);
+ }
+
+ public TBSCertList getTBSCertList() {
+ return getFieldAs(TBS_CERT_LIST, TBSCertList.class);
+ }
+
+ public void setTBSCertList(TBSCertList tbsCertList) {
+ setFieldAs(TBS_CERT_LIST, tbsCertList);
+ }
+
+ public AlgorithmIdentifier getSignatureAlgorithm() {
+ return getFieldAs(SIGNATURE_ALGORITHMS, AlgorithmIdentifier.class);
+ }
+
+ public void setSignatureAlgorithms(AlgorithmIdentifier signatureAlgorithms) {
+ setFieldAs(SIGNATURE_ALGORITHMS, signatureAlgorithms);
+ }
+
+ public Asn1BitString getSignature() {
+ return getFieldAs(SIGNATURE_VALUE, Asn1BitString.class);
+ }
+
+ public void setSignatureValue(Asn1BitString signatureValue) {
+ setFieldAs(SIGNATURE_VALUE, signatureValue);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateSet.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateSet.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateSet.java
new file mode 100644
index 0000000..6fd36f9
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CertificateSet.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1SetOf;
+
+/**
+ * CertificateSet ::= SET OF CertificateChoices
+ */
+public class CertificateSet extends Asn1SetOf<CertificateChoices> {
+
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CmsVersion.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CmsVersion.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CmsVersion.java
new file mode 100644
index 0000000..bde3992
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CmsVersion.java
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1EnumType;
+import org.apache.kerby.asn1.type.Asn1Integer;
+
+/**
+ * CMSVersion ::= INTEGER
+ * { v0(0), v1(1), v2(2), v3(3), v4(4), v5(5) }
+ */
+
+enum CmsVersionEnum implements Asn1EnumType {
+ V0,
+ V1,
+ V2,
+ V3,
+ V4,
+ V5;
+
+ @Override
+ public int getValue() {
+ return ordinal();
+ }
+}
+
+public class CmsVersion extends Asn1Integer {
+
+ public CmsVersion() {
+ this(CmsVersionEnum.V0);
+ }
+
+ public CmsVersion(CmsVersionEnum version) {
+ super(version.getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CompressedData.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CompressedData.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CompressedData.java
new file mode 100644
index 0000000..f678173
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/CompressedData.java
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+
+/**
+ * Ref. RFC 3274
+ *
+ * <pre>
+ * CompressedData ::= SEQUENCE {
+ * version CMSVersion,
+ * compressionAlgorithm CompressionAlgorithmIdentifier,
+ * encapContentInfo EncapsulatedContentInfo
+ * }
+ * </pre>
+ */
+public class CompressedData extends Asn1SequenceType {
+
+ private static final int VERSION = 0;
+ private static final int COMPRESSION_ALGORITHM = 1;
+ private static final int ENCAP_CONTENT_INFO = 2;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new Asn1FieldInfo(VERSION, CmsVersion.class),
+ new Asn1FieldInfo(COMPRESSION_ALGORITHM, AlgorithmIdentifier.class),
+ new Asn1FieldInfo(ENCAP_CONTENT_INFO, EncapsulatedContentInfo.class)
+ };
+
+ public CompressedData() {
+ super(fieldInfos);
+ }
+
+ public CmsVersion getVersion() {
+ return getFieldAs(VERSION, CmsVersion.class);
+ }
+
+ public void setVersion(CmsVersion version) {
+ setFieldAs(VERSION, version);
+ }
+
+ public AlgorithmIdentifier getCompressionAlgorithm() {
+ return getFieldAs(COMPRESSION_ALGORITHM, AlgorithmIdentifier.class);
+ }
+
+ public void setCompressionAlgorithm(AlgorithmIdentifier compressionAlgorithm) {
+ setFieldAs(COMPRESSION_ALGORITHM, compressionAlgorithm);
+ }
+
+ public EncapsulatedContentInfo getEncapContentInfo() {
+ return getFieldAs(ENCAP_CONTENT_INFO, EncapsulatedContentInfo.class);
+ }
+
+ public void setEncapContentInfo(EncapsulatedContentInfo encapContentInfo) {
+ setFieldAs(ENCAP_CONTENT_INFO, encapContentInfo);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java
new file mode 100644
index 0000000..8190ff1
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentInfo.java
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1Any;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.Asn1Type;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ * Ref. RFC 5652
+ *
+ * <pre>
+ * ContentInfo ::= SEQUENCE {
+ * contentType ContentType,
+ * content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL
+ * }
+ *
+ * ContentType ::= OBJECT IDENTIFIER
+ * </pre>
+ */
+public class ContentInfo extends Asn1SequenceType {
+ private static final int CONTENT_TYPE = 0;
+ private static final int CONTENT = 1;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+ new Asn1FieldInfo(CONTENT_TYPE, Asn1ObjectIdentifier.class),
+ new ExplicitField(CONTENT, 0, Asn1Any.class),
+ };
+
+ public ContentInfo() {
+ super(fieldInfos);
+ }
+
+ public Asn1ObjectIdentifier getContentType() {
+ return getFieldAs(CONTENT_TYPE, Asn1ObjectIdentifier.class);
+ }
+
+ public void setContentType(Asn1ObjectIdentifier contentType) {
+ setFieldAs(CONTENT_TYPE, contentType);
+ }
+
+ public Asn1Type getContent() {
+ return getFieldAsAny(CONTENT);
+ }
+
+ public void setContent(Asn1Type content) {
+ setFieldAsAny(CONTENT, content);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifier.java
new file mode 100644
index 0000000..8c0d11f
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifier.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+
+/**
+ * DigestAlgorithmIdentifier ::= AlgorithmIdentifier
+ */
+public class DigestAlgorithmIdentifier extends AlgorithmIdentifier {
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifiers.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifiers.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifiers.java
new file mode 100644
index 0000000..93c180d
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/DigestAlgorithmIdentifiers.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1SetOf;
+
+/**
+ * DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
+ */
+public class DigestAlgorithmIdentifiers extends Asn1SetOf<DigestAlgorithmIdentifier> {
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java
new file mode 100644
index 0000000..02f1765
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncapsulatedContentInfo.java
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ExplicitField;
+
+/**
+ * EncapsulatedContentInfo ::= SEQUENCE {
+ * eContentType ContentType,
+ * eContent [0] EXPLICIT OCTET STRING OPTIONAL
+ * }
+ *
+ * ContentType ::= OBJECT IDENTIFIER
+ */
+public class EncapsulatedContentInfo extends Asn1SequenceType {
+ private static final int CONTENT_TYPE = 0;
+ private static final int CONTENT = 1;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+ new Asn1FieldInfo(CONTENT_TYPE, Asn1ObjectIdentifier.class),
+ new ExplicitField(CONTENT, 0, Asn1OctetString.class)
+ };
+
+ public EncapsulatedContentInfo() {
+ super(fieldInfos);
+ }
+
+ public Asn1ObjectIdentifier getContentType() {
+ return getFieldAs(CONTENT_TYPE, Asn1ObjectIdentifier.class);
+ }
+
+ public void setContentType(Asn1ObjectIdentifier contentType) {
+ setFieldAs(CONTENT_TYPE, contentType);
+ }
+
+ public byte[] getContent() {
+ return getFieldAsOctets(CONTENT);
+ }
+
+ public void setContent(byte[] content) {
+ setFieldAsOctets(CONTENT, content);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java
new file mode 100644
index 0000000..6c5371d
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * ExtendedCertificate ::= SEQUENCE {
+ * extendedCertificateInfo ExtendedCertificateInfo,
+ * signatureAlgorithm SignatureAlgorithmIdentifier,
+ * signature Signature
+ * }
+ */
+public class ExtendedCertificate extends Asn1SequenceType {
+ private static final int EXTENDED_CERTIFICATE_INFO = 0;
+ private static final int SIGNATURE_ALGORITHMS = 1;
+ private static final int SIGNATURE = 2;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new Asn1FieldInfo(EXTENDED_CERTIFICATE_INFO, ExtendedCertificateInfo.class),
+ new Asn1FieldInfo(SIGNATURE_ALGORITHMS, SignatureAlgorithmIdentifier.class),
+ new Asn1FieldInfo(SIGNATURE, Signature.class)
+ };
+
+ public ExtendedCertificate() {
+ super(fieldInfos);
+ }
+
+ public ExtendedCertificateInfo getExtendedCertificateInfo() {
+ return getFieldAs(EXTENDED_CERTIFICATE_INFO, ExtendedCertificateInfo.class);
+ }
+
+ public void setCmsVersion(ExtendedCertificateInfo extendedCertificateInfo) {
+ setFieldAs(EXTENDED_CERTIFICATE_INFO, extendedCertificateInfo);
+ }
+
+ public SignatureAlgorithmIdentifier getSignatureAlgorithmIdentifier() {
+ return getFieldAs(SIGNATURE_ALGORITHMS, SignatureAlgorithmIdentifier.class);
+ }
+
+ public void setSignatureAlgorithmIdentifier(SignatureAlgorithmIdentifier signatureAlgorithmIdentifier) {
+ setFieldAs(SIGNATURE_ALGORITHMS, signatureAlgorithmIdentifier);
+ }
+
+ public Signature getSignature() {
+ return getFieldAs(SIGNATURE, Signature.class);
+ }
+
+ public void setSignature(Signature signature) {
+ setFieldAs(SIGNATURE, signature);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificateInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificateInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificateInfo.java
new file mode 100644
index 0000000..49c8e04
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificateInfo.java
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+/**
+ * ExtendedCertificateInfo ::= SEQUENCE {
+ * version CMSVersion,
+ * certificate Certificate,
+ * attributes UnauthAttributes
+ * }
+ */
+public class ExtendedCertificateInfo extends Asn1SequenceType {
+ private static final int CMS_VERSION = 0;
+ private static final int CERTIFICATE = 1;
+ private static final int ATTRIBUTES = 2;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new Asn1FieldInfo(CMS_VERSION, CmsVersion.class),
+ new Asn1FieldInfo(CERTIFICATE, SignatureAlgorithmIdentifier.class),
+ new Asn1FieldInfo(ATTRIBUTES, Signature.class)
+ };
+
+ public ExtendedCertificateInfo() {
+ super(fieldInfos);
+ }
+
+ public CmsVersion getCmsVersion() {
+ return getFieldAs(CMS_VERSION, CmsVersion.class);
+ }
+
+ public void setCmsVersion(CmsVersion version) {
+ setFieldAs(CMS_VERSION, version);
+ }
+
+ public SignatureAlgorithmIdentifier getCertificate() {
+ return getFieldAs(CERTIFICATE, SignatureAlgorithmIdentifier.class);
+ }
+
+ public void setCertificate(SignatureAlgorithmIdentifier signatureAlgorithmIdentifier) {
+ setFieldAs(CERTIFICATE, signatureAlgorithmIdentifier);
+ }
+
+ public Signature getAttributes() {
+ return getFieldAs(ATTRIBUTES, Signature.class);
+ }
+
+ public void setAttributes(Signature signature) {
+ setFieldAs(ATTRIBUTES, signature);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/IssuerAndSerialNumber.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/IssuerAndSerialNumber.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/IssuerAndSerialNumber.java
new file mode 100644
index 0000000..a9a7135
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/IssuerAndSerialNumber.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x500.type.Name;
+
+/**
+ * Ref. RFC5652
+ * <pre>
+ * IssuerAndSerialNumber ::= SEQUENCE {
+ * issuer Name,
+ * serialNumber CertificateSerialNumber
+ * }
+ *
+ * CertificateSerialNumber ::= INTEGER -- See RFC 5280
+ * </pre>
+ */
+public class IssuerAndSerialNumber extends Asn1SequenceType {
+ private static final int ISSUER = 0;
+ private static final int SERIAL_NUMBER = 1;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+ new Asn1FieldInfo(ISSUER, Name.class),
+ new Asn1FieldInfo(SERIAL_NUMBER, Asn1Integer.class)
+ };
+
+ public IssuerAndSerialNumber() {
+ super(fieldInfos);
+ }
+
+ public Name getIssuer() {
+ return getFieldAs(ISSUER, Name.class);
+ }
+
+ public void setIssuer(Name name) {
+ setFieldAs(ISSUER, name);
+ }
+
+ public Asn1Integer getSerialNumber() {
+ return getFieldAs(SERIAL_NUMBER, Asn1Integer.class);
+ }
+
+ public void setSerialNumber(int serialNumber) {
+ setFieldAsInt(SERIAL_NUMBER, serialNumber);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherCertificateFormat.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherCertificateFormat.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherCertificateFormat.java
new file mode 100644
index 0000000..c206197
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherCertificateFormat.java
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1Any;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.Asn1Type;
+
+/**
+ * OtherCertificateFormat ::= SEQUENCE {
+ * otherCertFormat OBJECT IDENTIFIER,
+ * otherCert ANY DEFINED BY otherCertFormat
+ * }
+ */
+public class OtherCertificateFormat extends Asn1SequenceType {
+
+ private static final int OTHER_CERT_FORMAT = 0;
+ private static final int OTHER_CERT = 1;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new Asn1FieldInfo(OTHER_CERT_FORMAT, Asn1ObjectIdentifier.class),
+ new Asn1FieldInfo(OTHER_CERT, Asn1Any.class),
+ };
+
+ public OtherCertificateFormat() {
+ super(fieldInfos);
+ }
+
+ public Asn1ObjectIdentifier getOtherCertFormat() {
+ return getFieldAs(OTHER_CERT_FORMAT, Asn1ObjectIdentifier.class);
+ }
+
+ public void setOtherCertFormat(Asn1ObjectIdentifier otherCertFormat) {
+ setFieldAs(OTHER_CERT_FORMAT, otherCertFormat);
+ }
+
+ public Asn1Type getOtherCert() {
+ return getFieldAsAny(OTHER_CERT);
+ }
+
+ public void setOtherCert(Asn1Type otherCert) {
+ setFieldAsAny(OTHER_CERT, otherCert);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRevocationInfoFormat.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRevocationInfoFormat.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRevocationInfoFormat.java
new file mode 100644
index 0000000..5110212
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRevocationInfoFormat.java
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1Any;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.Asn1Type;
+
+/**
+ * OtherRevocationInfoFormat ::= SEQUENCE {
+ * otherRevInfoFormat OBJECT IDENTIFIER,
+ * otherRevInfo ANY DEFINED BY otherRevInfoFormat
+ * }
+ */
+public class OtherRevocationInfoFormat extends Asn1SequenceType {
+ private static final int OTHER_REV_INFO_FORMAT = 0;
+ private static final int OTHER_REV_INFO = 1;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new Asn1FieldInfo(OTHER_REV_INFO_FORMAT, Asn1ObjectIdentifier.class),
+ new Asn1FieldInfo(OTHER_REV_INFO, Asn1Any.class)
+ };
+
+ public OtherRevocationInfoFormat() {
+ super(fieldInfos);
+ }
+
+ public Asn1ObjectIdentifier getOtherRevInfoFormat() {
+ return getFieldAs(OTHER_REV_INFO_FORMAT, Asn1ObjectIdentifier.class);
+ }
+
+ public void setOtherRevInfoFormat(Asn1ObjectIdentifier otherRevInfoFormat) {
+ setFieldAs(OTHER_REV_INFO_FORMAT, otherRevInfoFormat);
+ }
+
+ public Asn1Type getOtherRevInfo() {
+ return getFieldAsAny(OTHER_REV_INFO);
+ }
+
+ public void setOtherRevInfo(Asn1Type otherRevInfo) {
+ setFieldAsAny(OTHER_REV_INFO, otherRevInfo);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RelativeDistinguishedName.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RelativeDistinguishedName.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RelativeDistinguishedName.java
new file mode 100644
index 0000000..34cee62
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RelativeDistinguishedName.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1SetOf;
+import org.apache.kerby.x500.type.AttributeTypeAndValue;
+
+/**
+ * RelativeDistinguishedName ::= SET SIZE (1..MAX) OF AttributeTypeAndValue
+ */
+public class RelativeDistinguishedName extends Asn1SetOf<AttributeTypeAndValue> {
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoice.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoice.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoice.java
new file mode 100644
index 0000000..15e1b3d
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoice.java
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ImplicitField;
+
+/**
+ * RevocationInfoChoice ::= CHOICE {
+ * crl CertificateList,
+ * other [1] IMPLICIT OtherRevocationInfoFormat
+ * }
+ */
+public class RevocationInfoChoice extends Asn1Choice {
+ private static final int CRL = 0;
+ private static final int OTHER = 1;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new Asn1FieldInfo(CRL, CertificateList.class),
+ new ImplicitField(OTHER, 1, OtherRevocationInfoFormat.class)
+ };
+
+ public RevocationInfoChoice() {
+ super(fieldInfos);
+ }
+
+ public CertificateList getCRL() {
+ return getFieldAs(CRL, CertificateList.class);
+ }
+
+ public void setCRL(CertificateList crl) {
+ setFieldAs(CRL, crl);
+ }
+
+ public OtherRevocationInfoFormat getOther() {
+ return getFieldAs(OTHER, OtherRevocationInfoFormat.class);
+ }
+
+ public void setOther(OtherRevocationInfoFormat other) {
+ setFieldAs(OTHER, other);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoices.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoices.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoices.java
new file mode 100644
index 0000000..f8d0fd1
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RevocationInfoChoices.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1SetOf;
+
+/**
+ * RevocationInfoChoices ::= SET OF RevocationInfoChoice
+ */
+public class RevocationInfoChoices extends Asn1SetOf<RevocationInfoChoice> {
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Signature.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Signature.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Signature.java
new file mode 100644
index 0000000..af5ab42
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Signature.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+
+/**
+ * Signature ::= BIT STRING
+ */
+public class Signature extends Asn1BitString {
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureAlgorithmIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureAlgorithmIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureAlgorithmIdentifier.java
new file mode 100644
index 0000000..854ccb0
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureAlgorithmIdentifier.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+
+/**
+ * SignatureAlgorithmIdentifier ::= AlgorithmIdentifier
+ */
+public class SignatureAlgorithmIdentifier extends AlgorithmIdentifier {
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureValue.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureValue.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureValue.java
new file mode 100644
index 0000000..597ad40
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignatureValue.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1OctetString;
+
+/**
+ * SignatureValue ::= OCTET STRING
+ */
+public class SignatureValue extends Asn1OctetString {
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedAttributes.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedAttributes.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedAttributes.java
new file mode 100644
index 0000000..f15c1a1
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedAttributes.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1SetOf;
+
+/**
+ * SignedAttributes ::= SET SIZE (1..MAX) OF Attribute
+ */
+public class SignedAttributes extends Asn1SetOf<Attribute> {
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedData.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedData.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedData.java
new file mode 100644
index 0000000..ecf20eb
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignedData.java
@@ -0,0 +1,108 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ImplicitField;
+
+/**
+ * Ref. RFC 5652
+ * <pre>
+ * SignedData ::= SEQUENCE {
+ * version CMSVersion,
+ * digestAlgorithms DigestAlgorithmIdentifiers,
+ * encapContentInfo EncapsulatedContentInfo,
+ * certificates [0] IMPLICIT CertificateSet OPTIONAL,
+ * crls [1] IMPLICIT RevocationInfoChoices OPTIONAL,
+ * signerInfos SignerInfos
+ * }
+ * </pre>
+ *
+ */
+public class SignedData extends Asn1SequenceType {
+ private static final int CMS_VERSION = 0;
+ private static final int DIGEST_ALGORITHMS = 1;
+ private static final int ENCAP_CONTENT_INFO = 2;
+ private static final int CERTIFICATES = 3;
+ private static final int CRLS = 4;
+ private static final int SIGNER_INFOS = 5;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+ new Asn1FieldInfo(CMS_VERSION, CmsVersion.class),
+ new Asn1FieldInfo(DIGEST_ALGORITHMS, DigestAlgorithmIdentifiers.class),
+ new Asn1FieldInfo(ENCAP_CONTENT_INFO, EncapsulatedContentInfo.class),
+ new ImplicitField(CERTIFICATES, 0, CertificateSet.class),
+ new ImplicitField(CRLS, 1, RevocationInfoChoices.class),
+ new Asn1FieldInfo(SIGNER_INFOS, SignerInfos.class)
+ };
+
+ public SignedData() {
+ super(fieldInfos);
+ }
+
+ public int getVersion() {
+ return getFieldAsInteger(CMS_VERSION);
+ }
+
+ public void setVersion(int version) {
+ setFieldAsInt(CMS_VERSION, version);
+ }
+
+ public DigestAlgorithmIdentifiers getDigestAlgorithms() {
+ return getFieldAs(DIGEST_ALGORITHMS, DigestAlgorithmIdentifiers.class);
+ }
+
+ public void setDigestAlgorithms(DigestAlgorithmIdentifiers digestAlgorithms) {
+ setFieldAs(DIGEST_ALGORITHMS, digestAlgorithms);
+ }
+
+ public EncapsulatedContentInfo getEncapContentInfo() {
+ return getFieldAs(ENCAP_CONTENT_INFO, EncapsulatedContentInfo.class);
+ }
+
+ public void setEncapContentInfo(EncapsulatedContentInfo contentInfo) {
+ setFieldAs(ENCAP_CONTENT_INFO, contentInfo);
+ }
+
+ public CertificateSet getCertificates() {
+ return getFieldAs(CERTIFICATES, CertificateSet.class);
+ }
+
+ public void setCertificates(CertificateSet certificates) {
+ setFieldAs(CERTIFICATES, certificates);
+ }
+
+ public RevocationInfoChoices getCrls() {
+ return getFieldAs(CRLS, RevocationInfoChoices.class);
+ }
+
+ public void setCrls(RevocationInfoChoices crls) {
+ setFieldAs(CRLS, crls);
+ }
+
+ public SignerInfos getSignerInfos() {
+ return getFieldAs(SIGNER_INFOS, SignerInfos.class);
+ }
+
+ public void setSignerInfos(SignerInfos signerInfos) {
+ setFieldAs(SIGNER_INFOS, signerInfos);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerIdentifier.java
new file mode 100644
index 0000000..c5668c8
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerIdentifier.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
+import org.apache.kerby.x509.type.SubjectKeyIdentifier;
+
+/**
+ * Ref. RFC 5652
+ * <pre>
+ * SignerIdentifier ::= CHOICE {
+ * issuerAndSerialNumber IssuerAndSerialNumber,
+ * subjectKeyIdentifier [0] SubjectKeyIdentifier
+ * }
+ *
+ * SubjectKeyIdentifier ::= OCTET STRING
+ * </pre>
+ */
+public class SignerIdentifier extends Asn1Choice {
+ private static final int ISSUER_AND_SERIAL_NUMBER = 0;
+ private static final int SUBJECT_KEY_IDENTIFIER = 1;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+ new Asn1FieldInfo(ISSUER_AND_SERIAL_NUMBER, IssuerAndSerialNumber.class),
+ new ExplicitField(SUBJECT_KEY_IDENTIFIER, 0, SubjectKeyIdentifier.class)
+ };
+
+ public SignerIdentifier() {
+ super(fieldInfos);
+ }
+
+ public IssuerAndSerialNumber getIssuerAndSerialNumber() {
+ return getFieldAs(ISSUER_AND_SERIAL_NUMBER, IssuerAndSerialNumber.class);
+ }
+
+ public void setIssuerAndSerialNumber(IssuerAndSerialNumber issuerAndSerialNumber) {
+ setFieldAs(ISSUER_AND_SERIAL_NUMBER, issuerAndSerialNumber);
+ }
+
+ public SubjectKeyIdentifier getSubjectKeyIdentifier() {
+ return getFieldAs(SUBJECT_KEY_IDENTIFIER, SubjectKeyIdentifier.class);
+ }
+
+ public void setSubjectKeyIdentifier(SubjectKeyIdentifier subjectKeyIdentifier) {
+ setFieldAs(SUBJECT_KEY_IDENTIFIER, subjectKeyIdentifier);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfo.java
new file mode 100644
index 0000000..879d73d
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfo.java
@@ -0,0 +1,119 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.ImplicitField;
+
+/**
+ * Ref. RFC 5652
+ *
+ * SignerInfo ::= SEQUENCE {
+ * version CMSVersion,
+ * sid SignerIdentifier,
+ * digestAlgorithm DigestAlgorithmIdentifier,
+ * signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
+ * signatureAlgorithm SignatureAlgorithmIdentifier,
+ * signature SignatureValue,
+ * unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL
+ * }
+ *
+ * </pre>
+ */
+public class SignerInfo extends Asn1SequenceType {
+ private static final int CMS_VERSION = 0;
+ private static final int SID = 1;
+ private static final int DIGEST_ALGORITHM = 2;
+ private static final int SIGNED_ATTRS = 3;
+ private static final int SIGNATURE_ALGORITHMS = 4;
+ private static final int SIGNATURE = 5;
+ private static final int UNSIGNED_ATTRS = 6;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+ new Asn1FieldInfo(CMS_VERSION, CmsVersion.class),
+ new Asn1FieldInfo(SID, SignerIdentifier.class),
+ new Asn1FieldInfo(DIGEST_ALGORITHM, DigestAlgorithmIdentifier.class),
+ new ImplicitField(SIGNED_ATTRS, 0, SignedAttributes.class),
+ new Asn1FieldInfo(SIGNATURE_ALGORITHMS, SignatureAlgorithmIdentifier.class),
+ new Asn1FieldInfo(SIGNATURE, SignatureValue.class),
+ new ImplicitField(UNSIGNED_ATTRS, 1, UnsignedAttributes.class)
+ };
+
+ public SignerInfo() {
+ super(fieldInfos);
+ }
+
+ public int getCmsVersion() {
+ return getFieldAsInteger(CMS_VERSION);
+ }
+
+ public void setCmsVersion(int version) {
+ setFieldAsInt(CMS_VERSION, version);
+ }
+
+ public SignerIdentifier getSignerIdentifier() {
+ return getFieldAs(SID, SignerIdentifier.class);
+ }
+
+ public void setSignerIdentifier(SignerIdentifier signerIdentifier) {
+ setFieldAs(SID, signerIdentifier);
+ }
+
+ public DigestAlgorithmIdentifier getDigestAlgorithmIdentifier() {
+ return getFieldAs(DIGEST_ALGORITHM, DigestAlgorithmIdentifier.class);
+ }
+
+ public void setDigestAlgorithmIdentifier(DigestAlgorithmIdentifier digestAlgorithmIdentifier) {
+ setFieldAs(DIGEST_ALGORITHM, digestAlgorithmIdentifier);
+ }
+
+ public SignedAttributes getSignedAttributes() {
+ return getFieldAs(SIGNED_ATTRS, SignedAttributes.class);
+ }
+
+ public void setSignedAttributes(SignedAttributes signedAttributes) {
+ setFieldAs(SIGNED_ATTRS, signedAttributes);
+ }
+
+ public SignatureAlgorithmIdentifier getSignatureAlgorithmIdentifier() {
+ return getFieldAs(SIGNATURE_ALGORITHMS, SignatureAlgorithmIdentifier.class);
+ }
+
+ public void setSignatureAlgorithmIdentifier(SignatureAlgorithmIdentifier signatureAlgorithmIdentifier) {
+ setFieldAs(SIGNATURE_ALGORITHMS, signatureAlgorithmIdentifier);
+ }
+
+ public SignatureValue getSignatureValue() {
+ return getFieldAs(SIGNATURE, SignatureValue.class);
+ }
+
+ public void setSignatureValue(SignatureValue signatureValue) {
+ setFieldAs(SIGNATURE, signatureValue);
+ }
+
+ public UnsignedAttributes getUnsignedAttributes() {
+ return getFieldAs(UNSIGNED_ATTRS, UnsignedAttributes.class);
+ }
+
+ public void setUnsignedAttributes(UnsignedAttributes unsignedAttributes) {
+ setFieldAs(UNSIGNED_ATTRS, unsignedAttributes);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfos.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfos.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfos.java
new file mode 100644
index 0000000..4474e1a
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/SignerInfos.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1SetOf;
+
+/**
+ * SignerInfos ::= SET OF SignerInfo
+ */
+public class SignerInfos extends Asn1SetOf<SignerInfo> {
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Subject.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Subject.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Subject.java
new file mode 100644
index 0000000..a59690b
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/Subject.java
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.type.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.ExplicitField;
+import org.apache.kerby.x509.type.GeneralNames;
+import org.apache.kerby.x509.type.IssuerSerial;
+
+/**
+ * subject CHOICE {
+ * baseCertificateID [0] IssuerSerial,
+ * -- associated with a Public Key Certificate
+ * subjectName [1] GeneralNames
+ * -- associated with a name
+ * },
+ *
+ */
+public class Subject extends Asn1Choice {
+ private static final int BASE_CERTIFICATE_ID = 0;
+ private static final int SUBJECT_NAME = 1;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+ new ExplicitField(BASE_CERTIFICATE_ID, IssuerSerial.class),
+ new ExplicitField(SUBJECT_NAME, GeneralNames.class)
+ };
+
+ public Subject() {
+ super(fieldInfos);
+ }
+
+ public IssuerSerial getBaseCertificateID() {
+ return getFieldAs(BASE_CERTIFICATE_ID, IssuerSerial.class);
+ }
+
+ public void setBaseCertificateID(IssuerSerial baseCertificateID) {
+ setFieldAs(BASE_CERTIFICATE_ID, baseCertificateID);
+ }
+
+ public GeneralNames getSubjectName() {
+ return getFieldAs(SUBJECT_NAME, GeneralNames.class);
+ }
+
+ public void setSubjectName(GeneralNames subjectName) {
+ setFieldAs(SUBJECT_NAME, subjectName);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/ac93a201/kerby-pkix/src/main/java/org/apache/kerby/cms/type/UnsignedAttributes.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/UnsignedAttributes.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/UnsignedAttributes.java
new file mode 100644
index 0000000..4eecd35
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/UnsignedAttributes.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.cms.type;
+
+import org.apache.kerby.asn1.type.Asn1SetOf;
+
+/**
+ * UnsignedAttributes ::= SET SIZE (1..MAX) OF Attribute
+ */
+public class UnsignedAttributes extends Asn1SetOf<Attribute> {
+}