directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject directory-kerby git commit: DIRKRB-504 EnvelopedData CMS support.
Date Thu, 17 Dec 2015 07:20:13 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master 174880304 -> b3d51fb89


DIRKRB-504 EnvelopedData 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/b3d51fb8
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/b3d51fb8
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/b3d51fb8

Branch: refs/heads/master
Commit: b3d51fb89824475c906d02fc55ca9bad812859c6
Parents: 1748803
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Thu Dec 17 15:26:49 2015 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Thu Dec 17 15:26:49 2015 +0800

----------------------------------------------------------------------
 .../ContentEncryptionAlgorithmIdentifier.java   |  28 +++++
 .../kerby/cms/type/EncryptedContentInfo.java    |  92 ++++++++++++++
 .../org/apache/kerby/cms/type/EncryptedKey.java |  28 +++++
 .../apache/kerby/cms/type/EnvelopedData.java    | 123 +++++++++++++++++++
 .../kerby/cms/type/ExtendedCertificate.java     |   2 +-
 .../apache/kerby/cms/type/KEKIdentifier.java    |  86 +++++++++++++
 .../apache/kerby/cms/type/KEKRecipientInfo.java |  96 +++++++++++++++
 .../cms/type/KeyAgreeRecipientIdentifier.java   |  74 +++++++++++
 .../kerby/cms/type/KeyAgreeRecipientInfo.java   | 111 +++++++++++++++++
 .../type/KeyDerivationAlgorithmIdentifier.java  |  28 +++++
 .../type/KeyEncryptionAlgorithmIdentifier.java  |  28 +++++
 .../kerby/cms/type/KeyTransRecipientInfo.java   |  96 +++++++++++++++
 .../cms/type/OriginatorIdentifierOrKey.java     |  86 +++++++++++++
 .../apache/kerby/cms/type/OriginatorInfo.java   |  75 +++++++++++
 .../kerby/cms/type/OriginatorPublicKey.java     |  75 +++++++++++
 .../kerby/cms/type/OtherKeyAttribute.java       |  76 ++++++++++++
 .../kerby/cms/type/OtherRecipientInfo.java      |  76 ++++++++++++
 .../kerby/cms/type/PasswordRecipientInfo.java   |  98 +++++++++++++++
 .../kerby/cms/type/RecipientEncryptedKey.java   |  73 +++++++++++
 .../kerby/cms/type/RecipientEncryptedKeys.java  |  28 +++++
 .../kerby/cms/type/RecipientIdentifier.java     |  75 +++++++++++
 .../apache/kerby/cms/type/RecipientInfo.java    | 107 ++++++++++++++++
 .../apache/kerby/cms/type/RecipientInfos.java   |  28 +++++
 .../kerby/cms/type/RecipientKeyIdentifier.java  |  86 +++++++++++++
 .../kerby/cms/type/UnprotectedAttributes.java   |  28 +++++
 25 files changed, 1702 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentEncryptionAlgorithmIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentEncryptionAlgorithmIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentEncryptionAlgorithmIdentifier.java
new file mode 100644
index 0000000..764db7c
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ContentEncryptionAlgorithmIdentifier.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;
+
+/**
+ * ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
+ */
+public class ContentEncryptionAlgorithmIdentifier extends AlgorithmIdentifier {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncryptedContentInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncryptedContentInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncryptedContentInfo.java
new file mode 100644
index 0000000..c6d5872
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EncryptedContentInfo.java
@@ -0,0 +1,92 @@
+/**
+ *  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.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.ImplicitField;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.cms.type.EncryptedContentInfo.MyEnum.*;
+
+/**
+ * EncryptedContentInfo ::= SEQUENCE {
+ *   contentType ContentType,
+ *   contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
+ *   encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL }
+ *
+ * ContentType ::= OBJECT IDENTIFIER
+ *
+ * EncryptedContent ::= OCTET STRING
+ */
+public class EncryptedContentInfo extends Asn1SequenceType {
+    protected enum MyEnum implements EnumType {
+        CONTENT_TYPE,
+        CONTENT_ENCRYPTION_ALGORITHM,
+        ENCRYPTED_CONTENT;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(CONTENT_TYPE, Asn1ObjectIdentifier.class),
+            new Asn1FieldInfo(CONTENT_ENCRYPTION_ALGORITHM, ContentEncryptionAlgorithmIdentifier.class),
+            new ImplicitField(ENCRYPTED_CONTENT, 0, Asn1OctetString.class)
+    };
+
+    public EncryptedContentInfo() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getContentType() {
+        return getFieldAs(CONTENT_TYPE, Asn1ObjectIdentifier.class);
+    }
+
+    public void setContentType(Asn1ObjectIdentifier contentType) {
+        setFieldAs(CONTENT_TYPE, contentType);
+    }
+
+    public ContentEncryptionAlgorithmIdentifier getContentEncryptionAlgorithmIdentifier() {
+        return getFieldAs(CONTENT_ENCRYPTION_ALGORITHM, ContentEncryptionAlgorithmIdentifier.class);
+    }
+
+    public void setContentEncryptionAlgorithmIdentifier(ContentEncryptionAlgorithmIdentifier
+                                                                contentEncryptionAlgorithmIdentifier) {
+        setFieldAs(CONTENT_ENCRYPTION_ALGORITHM, contentEncryptionAlgorithmIdentifier);
+    }
+
+    public Asn1OctetString getEncryptedContent() {
+        return getFieldAs(ENCRYPTED_CONTENT, Asn1OctetString.class);
+    }
+
+    public void setEncryptedContent(Asn1OctetString encryptedContent) {
+        setFieldAs(ENCRYPTED_CONTENT, encryptedContent);
+    }
+}

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

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EnvelopedData.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EnvelopedData.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EnvelopedData.java
new file mode 100644
index 0000000..d516e72
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/EnvelopedData.java
@@ -0,0 +1,123 @@
+/**
+ *  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.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.ImplicitField;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.cms.type.EnvelopedData.MyEnum.*;
+
+/**
+ * EnvelopedData ::= SEQUENCE {
+ *   version CMSVersion,
+ *   originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
+ *   recipientInfos RecipientInfos,
+ *   encryptedContentInfo EncryptedContentInfo,
+ *   unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL
+ * }
+ *
+ * OriginatorInfo ::= SEQUENCE {
+ *   certs [0] IMPLICIT CertificateSet OPTIONAL,
+ *   crls [1] IMPLICIT RevocationInfoChoices OPTIONAL
+ * }
+ *
+ * RecipientInfos ::= SET SIZE (1..MAX) OF RecipientInfo
+ *
+ * EncryptedContentInfo ::= SEQUENCE {
+ *   contentType ContentType,
+ *   contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
+ *   encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
+ * }
+ *
+ * EncryptedContent ::= OCTET STRING
+ *
+ * UnprotectedAttributes ::= SET SIZE (1..MAX) OF Attribute
+ */
+public class EnvelopedData extends Asn1SequenceType {
+
+    protected enum MyEnum implements EnumType {
+        CMS_VERSION,
+        ORIGINATOR_INFO,
+        RECIPIENT_INFOS,
+        ENCRYPTED_CONTENT_INFO,
+        UNPROTECTED_ATTRS;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+            new Asn1FieldInfo(CMS_VERSION, CmsVersion.class),
+            new ImplicitField(ORIGINATOR_INFO, 0, OriginatorInfo.class),
+            new Asn1FieldInfo(RECIPIENT_INFOS, RecipientInfos.class),
+            new Asn1FieldInfo(ENCRYPTED_CONTENT_INFO, EncryptedContentInfo.class),
+            new ImplicitField(UNPROTECTED_ATTRS, 1, UnprotectedAttributes.class)
+    };
+
+    public EnvelopedData() {
+        super(fieldInfos);
+    }
+
+    public CmsVersion getCmsVersion() {
+        return getFieldAs(CMS_VERSION, CmsVersion.class);
+    }
+
+    public void setCmsVersion(CmsVersion cmsVersion) {
+        setFieldAs(CMS_VERSION, cmsVersion);
+    }
+
+    public OriginatorInfo getOriginatorInfo() {
+        return getFieldAs(ORIGINATOR_INFO, OriginatorInfo.class);
+    }
+
+    public void setOriginatorInfo(OriginatorInfo originatorInfo) {
+        setFieldAs(ORIGINATOR_INFO, originatorInfo);
+    }
+    public RecipientInfos getRecipientInfos() {
+        return getFieldAs(RECIPIENT_INFOS, RecipientInfos.class);
+    }
+
+    public void setRecipientInfos(RecipientInfos recipientInfos) {
+        setFieldAs(RECIPIENT_INFOS, recipientInfos);
+    }
+    public EncryptedContentInfo getEncryptedContentInfo() {
+        return getFieldAs(ENCRYPTED_CONTENT_INFO, EncryptedContentInfo.class);
+    }
+
+    public void setEncryptedContentInfo(EncryptedContentInfo encryptedContentInfo) {
+        setFieldAs(ENCRYPTED_CONTENT_INFO, encryptedContentInfo);
+    }
+    public UnprotectedAttributes getUnprotectedAttributes() {
+        return getFieldAs(UNPROTECTED_ATTRS, UnprotectedAttributes.class);
+    }
+
+    public void setUnprotectedAttributes(UnprotectedAttributes unprotectedAttributes) {
+        setFieldAs(UNPROTECTED_ATTRS, unprotectedAttributes);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java
index ca46571..8553796 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/ExtendedCertificate.java
@@ -63,7 +63,7 @@ public class ExtendedCertificate extends Asn1SequenceType {
         return getFieldAs(EXTENDED_CERTIFICATE_INFO, ExtendedCertificateInfo.class);
     }
 
-    public void setCmsVersion(ExtendedCertificateInfo extendedCertificateInfo) {
+    public void setExtendedCertificateInfo(ExtendedCertificateInfo extendedCertificateInfo) {
         setFieldAs(EXTENDED_CERTIFICATE_INFO, extendedCertificateInfo);
     }
 

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KEKIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KEKIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KEKIdentifier.java
new file mode 100644
index 0000000..aa8467c
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KEKIdentifier.java
@@ -0,0 +1,86 @@
+/**
+ *  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.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.type.Asn1GeneralizedTime;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.cms.type.KEKIdentifier.MyEnum.*;
+
+/**
+ * KEKIdentifier ::= SEQUENCE {
+ *   keyIdentifier OCTET STRING,
+ *   date GeneralizedTime OPTIONAL,
+ *   other OtherKeyAttribute OPTIONAL }
+ */
+public class KEKIdentifier extends Asn1SequenceType {
+    protected enum MyEnum implements EnumType {
+        KEY_IDENTIFIER,
+        DATE,
+        OTHER;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(KEY_IDENTIFIER, Asn1OctetString.class),
+            new Asn1FieldInfo(DATE, Asn1GeneralizedTime.class),
+            new Asn1FieldInfo(OTHER, OtherKeyAttribute.class)
+    };
+
+    public KEKIdentifier() {
+        super(fieldInfos);
+    }
+
+    public Asn1OctetString getKeyIdentifier() {
+        return getFieldAs(KEY_IDENTIFIER, Asn1OctetString.class);
+    }
+
+    public void setKeyIdentifier(Asn1OctetString keyIdentifier) {
+        setFieldAs(KEY_IDENTIFIER, keyIdentifier);
+    }
+
+    public Asn1GeneralizedTime getDate() {
+        return getFieldAs(DATE, Asn1GeneralizedTime.class);
+    }
+
+    public void setDate(Asn1GeneralizedTime date) {
+        setFieldAs(DATE, date);
+    }
+
+    public OtherKeyAttribute getOther() {
+        return getFieldAs(OTHER, OtherKeyAttribute.class);
+    }
+
+    public void setOther(OtherKeyAttribute other) {
+        setFieldAs(OTHER, other);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KEKRecipientInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KEKRecipientInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KEKRecipientInfo.java
new file mode 100644
index 0000000..87d9528
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KEKRecipientInfo.java
@@ -0,0 +1,96 @@
+/**
+ *  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.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.cms.type.KEKRecipientInfo.MyEnum.*;
+
+/**
+ * KEKRecipientInfo ::= SEQUENCE {
+ *   version CMSVersion,  -- always set to 4
+ *   kekid KEKIdentifier,
+ *   keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
+ *   encryptedKey EncryptedKey }
+ */
+public class KEKRecipientInfo extends Asn1SequenceType {
+    protected enum MyEnum implements EnumType {
+        VERSION,
+        KE_KID,
+        KEY_ENCRYPTION_ALGORITHM,
+        ENCRYPTED_KEY;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(VERSION, CmsVersion.class),
+            new Asn1FieldInfo(KE_KID, KEKIdentifier.class),
+            new Asn1FieldInfo(KEY_ENCRYPTION_ALGORITHM, KeyEncryptionAlgorithmIdentifier.class),
+            new Asn1FieldInfo(ENCRYPTED_KEY, EncryptedKey.class)
+    };
+
+    public KEKRecipientInfo() {
+        super(fieldInfos);
+    }
+
+    public CmsVersion getVersion() {
+        return getFieldAs(VERSION, CmsVersion.class);
+    }
+
+    public void setVersion(CmsVersion version) {
+        setFieldAs(VERSION, version);
+    }
+
+    public KEKIdentifier getKEKIdentifier() {
+        return getFieldAs(KE_KID, KEKIdentifier.class);
+    }
+
+    public void setKEKIdentifier(KEKIdentifier kekIdentifier) {
+        setFieldAs(KE_KID, kekIdentifier);
+    }
+
+    public KeyEncryptionAlgorithmIdentifier getKeyEncryptionAlgorithmIdentifier() {
+        return getFieldAs(KEY_ENCRYPTION_ALGORITHM, KeyEncryptionAlgorithmIdentifier.class);
+    }
+
+    public void setKeyEncryptionAlgorithmIdentifier(KeyEncryptionAlgorithmIdentifier
+                                                            keyEncryptionAlgorithmIdentifier) {
+        setFieldAs(KEY_ENCRYPTION_ALGORITHM, keyEncryptionAlgorithmIdentifier);
+    }
+
+    public EncryptedKey getEncryptedKey() {
+        return getFieldAs(ENCRYPTED_KEY, EncryptedKey.class);
+    }
+
+    public void setEncryptedKey(EncryptedKey encryptedKey) {
+        setFieldAs(ENCRYPTED_KEY, encryptedKey);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyAgreeRecipientIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyAgreeRecipientIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyAgreeRecipientIdentifier.java
new file mode 100644
index 0000000..7f41001
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyAgreeRecipientIdentifier.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.cms.type;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.ImplicitField;
+import org.apache.kerby.asn1.type.Asn1Choice;
+
+import static org.apache.kerby.cms.type.KeyAgreeRecipientIdentifier.MyEnum.*;
+
+/**
+ * KeyAgreeRecipientIdentifier ::= CHOICE {
+ *   issuerAndSerialNumber IssuerAndSerialNumber,
+ *   rKeyId [0] IMPLICIT RecipientKeyIdentifier }
+ */
+public class KeyAgreeRecipientIdentifier extends Asn1Choice {
+    protected enum MyEnum implements EnumType {
+        ISSUER_AND_SERIAL_NUMBER,
+        R_KEY_ID;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+            new Asn1FieldInfo(ISSUER_AND_SERIAL_NUMBER, IssuerAndSerialNumber.class),
+            new ImplicitField(R_KEY_ID, 0, RecipientKeyIdentifier.class)
+    };
+
+    public KeyAgreeRecipientIdentifier() {
+        super(fieldInfos);
+    }
+
+    public IssuerAndSerialNumber getIssuerAndSerialNumber() {
+        return getChoiceValueAs(ISSUER_AND_SERIAL_NUMBER, IssuerAndSerialNumber.class);
+    }
+
+    public void setIssuerAndSerialNumber(IssuerAndSerialNumber issuerAndSerialNumber) {
+        setChoiceValue(ISSUER_AND_SERIAL_NUMBER, issuerAndSerialNumber);
+    }
+
+    public RecipientKeyIdentifier getRecipientKeyIdentifier() {
+        return getChoiceValueAs(R_KEY_ID, RecipientKeyIdentifier.class);
+    }
+
+    public void setRecipientKeyIdentifier(RecipientKeyIdentifier recipientKeyIdentifier) {
+        setChoiceValue(R_KEY_ID, recipientKeyIdentifier);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyAgreeRecipientInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyAgreeRecipientInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyAgreeRecipientInfo.java
new file mode 100644
index 0000000..509d1f9
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyAgreeRecipientInfo.java
@@ -0,0 +1,111 @@
+/**
+ *  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.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.cms.type.KeyAgreeRecipientInfo.MyEnum.*;
+
+/**
+ * KeyAgreeRecipientInfo ::= SEQUENCE {
+ *   version CMSVersion,  -- always set to 3
+ *   originator [0] EXPLICIT OriginatorIdentifierOrKey,
+ *   ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
+ *   keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
+ *   recipientEncryptedKeys RecipientEncryptedKeys }
+ *
+ * UserKeyingMaterial ::= OCTET STRING
+ */
+public class KeyAgreeRecipientInfo extends Asn1SequenceType {
+    protected enum MyEnum implements EnumType {
+        VERSION,
+        ORIGINATOR,
+        UKM,
+        KEY_ENCRYPTION_ALGORITHM,
+        RECIPIENT_ENCRYPTED_KEY;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(VERSION, CmsVersion.class),
+            new ExplicitField(ORIGINATOR, 0, OriginatorIdentifierOrKey.class),
+            new ExplicitField(UKM, 1, Asn1OctetString.class),
+            new Asn1FieldInfo(KEY_ENCRYPTION_ALGORITHM, KeyEncryptionAlgorithmIdentifier.class),
+            new Asn1FieldInfo(RECIPIENT_ENCRYPTED_KEY, RecipientEncryptedKeys.class)
+    };
+
+    public KeyAgreeRecipientInfo() {
+        super(fieldInfos);
+    }
+
+    public CmsVersion getVersion() {
+        return getFieldAs(VERSION, CmsVersion.class);
+    }
+
+    public void setVersion(CmsVersion version) {
+        setFieldAs(VERSION, version);
+    }
+
+    public OriginatorIdentifierOrKey getOriginator() {
+        return getFieldAs(ORIGINATOR, OriginatorIdentifierOrKey.class);
+    }
+
+    public void setOriginator(OriginatorIdentifierOrKey originator) {
+        setFieldAs(ORIGINATOR, originator);
+    }
+
+    public Asn1OctetString getUkm() {
+        return getFieldAs(UKM, Asn1OctetString.class);
+    }
+
+    public void setUkm(Asn1OctetString ukm) {
+        setFieldAs(UKM, ukm);
+    }
+
+    public KeyEncryptionAlgorithmIdentifier getKeyEncryptionAlgorithmIdentifier() {
+        return getFieldAs(KEY_ENCRYPTION_ALGORITHM, KeyEncryptionAlgorithmIdentifier.class);
+    }
+
+    public void setkeyEncryptionAlgorithmIdentifier(KeyEncryptionAlgorithmIdentifier
+                                                            keyEncryptionAlgorithmIdentifier) {
+        setFieldAs(KEY_ENCRYPTION_ALGORITHM, keyEncryptionAlgorithmIdentifier);
+    }
+
+    public RecipientEncryptedKeys getRecipientEncryptedKeys() {
+        return getFieldAs(RECIPIENT_ENCRYPTED_KEY, RecipientEncryptedKeys.class);
+    }
+
+    public void setRecipientEncryptedKeys(RecipientEncryptedKeys recipientEncryptedKeys) {
+        setFieldAs(RECIPIENT_ENCRYPTED_KEY, recipientEncryptedKeys);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyDerivationAlgorithmIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyDerivationAlgorithmIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyDerivationAlgorithmIdentifier.java
new file mode 100644
index 0000000..2d35125
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyDerivationAlgorithmIdentifier.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;
+
+/**
+ * KeyDerivationAlgorithmIdentifier ::= AlgorithmIdentifier
+ */
+public class KeyDerivationAlgorithmIdentifier extends AlgorithmIdentifier {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyEncryptionAlgorithmIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyEncryptionAlgorithmIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyEncryptionAlgorithmIdentifier.java
new file mode 100644
index 0000000..8788172
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyEncryptionAlgorithmIdentifier.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;
+
+/**
+ * KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
+ */
+public class KeyEncryptionAlgorithmIdentifier extends AlgorithmIdentifier {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyTransRecipientInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyTransRecipientInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyTransRecipientInfo.java
new file mode 100644
index 0000000..07c3c75
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/KeyTransRecipientInfo.java
@@ -0,0 +1,96 @@
+/**
+ *  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.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.cms.type.KeyTransRecipientInfo.MyEnum.*;
+
+/**
+ * KeyTransRecipientInfo ::= SEQUENCE {
+ *   version CMSVersion,  -- always set to 0 or 2
+ *   rid RecipientIdentifier,
+ *   keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
+ *   encryptedKey EncryptedKey }
+ */
+public class KeyTransRecipientInfo extends Asn1SequenceType {
+    protected enum MyEnum implements EnumType {
+        VERSION,
+        RID,
+        KEY_ENCRYPTION_ALGORITHM,
+        ENCRYPTED_KEY;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(VERSION, CmsVersion.class),
+            new Asn1FieldInfo(RID, RecipientIdentifier.class),
+            new Asn1FieldInfo(KEY_ENCRYPTION_ALGORITHM, KeyEncryptionAlgorithmIdentifier.class),
+            new Asn1FieldInfo(ENCRYPTED_KEY, EncryptedKey.class)
+    };
+
+    public KeyTransRecipientInfo() {
+        super(fieldInfos);
+    }
+
+    public CmsVersion getVersion() {
+        return getFieldAs(VERSION, CmsVersion.class);
+    }
+
+    public void setVersion(CmsVersion version) {
+        setFieldAs(VERSION, version);
+    }
+
+    public RecipientIdentifier getRid() {
+        return getFieldAs(RID, RecipientIdentifier.class);
+    }
+
+    public void setRid(RecipientIdentifier rid) {
+        setFieldAs(RID, rid);
+    }
+
+    public KeyEncryptionAlgorithmIdentifier getKeyEncryptionAlgorithmIdentifier() {
+        return getFieldAs(KEY_ENCRYPTION_ALGORITHM, KeyEncryptionAlgorithmIdentifier.class);
+    }
+
+    public void setKeyEncryptionAlgorithmIdentifier(KeyEncryptionAlgorithmIdentifier
+                                                            keyEncryptionAlgorithmIdentifier) {
+        setFieldAs(KEY_ENCRYPTION_ALGORITHM, keyEncryptionAlgorithmIdentifier);
+    }
+
+    public EncryptedKey getEncryptedKey() {
+        return getFieldAs(ENCRYPTED_KEY, EncryptedKey.class);
+    }
+
+    public void setEncryptedKey(EncryptedKey encryptedKey) {
+        setFieldAs(ENCRYPTED_KEY, encryptedKey);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OriginatorIdentifierOrKey.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OriginatorIdentifierOrKey.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OriginatorIdentifierOrKey.java
new file mode 100644
index 0000000..a1ce3cd
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OriginatorIdentifierOrKey.java
@@ -0,0 +1,86 @@
+/**
+ *  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.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.x509.type.SubjectKeyIdentifier;
+
+import static org.apache.kerby.cms.type.OriginatorIdentifierOrKey.MyEnum.*;
+
+/**
+ * OriginatorIdentifierOrKey ::= CHOICE {
+ *   issuerAndSerialNumber IssuerAndSerialNumber,
+ *   subjectKeyIdentifier [0] SubjectKeyIdentifier,
+ *   originatorKey [1] OriginatorPublicKey }
+ */
+public class OriginatorIdentifierOrKey extends Asn1Choice {
+    protected enum MyEnum implements EnumType {
+        ISSUER_AND_SERIAL_NUMBER,
+        SUBJECT_KEY_IDENTIFIER,
+        ORIGINATOR_KEY;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+            new Asn1FieldInfo(ISSUER_AND_SERIAL_NUMBER, IssuerAndSerialNumber.class),
+            new ExplicitField(SUBJECT_KEY_IDENTIFIER, 0, SubjectKeyIdentifier.class),
+            new ExplicitField(ORIGINATOR_KEY, 1, OriginatorPublicKey.class)
+    };
+
+    public OriginatorIdentifierOrKey() {
+        super(fieldInfos);
+    }
+
+    public IssuerAndSerialNumber getIssuerAndSerialNumber() {
+        return getChoiceValueAs(ISSUER_AND_SERIAL_NUMBER, IssuerAndSerialNumber.class);
+    }
+
+    public void setIssuerAndSerialNumber(IssuerAndSerialNumber issuerAndSerialNumber) {
+        setChoiceValue(ISSUER_AND_SERIAL_NUMBER, issuerAndSerialNumber);
+    }
+
+    public SubjectKeyIdentifier getSubjectKeyIdentifier() {
+        return getChoiceValueAs(SUBJECT_KEY_IDENTIFIER, SubjectKeyIdentifier.class);
+    }
+
+    public void setSubjectKeyIdentifier(SubjectKeyIdentifier subjectKeyIdentifier) {
+        setChoiceValue(SUBJECT_KEY_IDENTIFIER, subjectKeyIdentifier);
+    }
+
+    public OriginatorPublicKey getOriginatorPublicKey() {
+        return getChoiceValueAs(ORIGINATOR_KEY, OriginatorPublicKey.class);
+    }
+
+    public void setOriginatorPublicKey(OriginatorPublicKey originatorPublicKey) {
+        setChoiceValue(ORIGINATOR_KEY, originatorPublicKey);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OriginatorInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OriginatorInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OriginatorInfo.java
new file mode 100644
index 0000000..7e9d2ba
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OriginatorInfo.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.cms.type;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.ImplicitField;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.cms.type.OriginatorInfo.MyEnum.*;
+
+/**
+ * OriginatorInfo ::= SEQUENCE {
+ *   certs [0] IMPLICIT CertificateSet OPTIONAL,
+ *   crls [1] IMPLICIT RevocationInfoChoices OPTIONAL
+ * }
+ */
+public class OriginatorInfo extends Asn1SequenceType {
+    protected enum MyEnum implements EnumType {
+        CERTS,
+        CRLS;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+            new ImplicitField(CERTS, CertificateSet.class),
+            new ImplicitField(CRLS, RevocationInfoChoices.class)
+    };
+
+    public OriginatorInfo() {
+        super(fieldInfos);
+    }
+
+    public CertificateSet getCerts() {
+        return getFieldAs(CERTS, CertificateSet.class);
+    }
+
+    public void setCerts(CertificateSet certs) {
+        setFieldAs(CERTS, certs);
+    }
+
+    public RevocationInfoChoices getCrls() {
+        return getFieldAs(CRLS, RevocationInfoChoices.class);
+    }
+
+    public void setCrls(RevocationInfoChoices crls) {
+        setFieldAs(CRLS, crls);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OriginatorPublicKey.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OriginatorPublicKey.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OriginatorPublicKey.java
new file mode 100644
index 0000000..4dc23b9
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OriginatorPublicKey.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.cms.type;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+
+import static org.apache.kerby.cms.type.OriginatorPublicKey.MyEnum.*;
+
+/**
+ * OriginatorPublicKey ::= SEQUENCE {
+ *   algorithm AlgorithmIdentifier,
+ *   publicKey BIT STRING }
+ */
+public class OriginatorPublicKey extends Asn1SequenceType {
+    protected enum MyEnum implements EnumType {
+        ALGORITHM,
+        PUBLIC_KEY;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(ALGORITHM, AlgorithmIdentifier.class),
+            new Asn1FieldInfo(PUBLIC_KEY, Asn1BitString.class)
+    };
+
+    public OriginatorPublicKey() {
+        super(fieldInfos);
+    }
+
+    public AlgorithmIdentifier getAlgorithm() {
+        return getFieldAs(ALGORITHM, AlgorithmIdentifier.class);
+    }
+
+    public void setAlgorithm(AlgorithmIdentifier algorithm) {
+        setFieldAs(ALGORITHM, algorithm);
+    }
+
+    public Asn1BitString getPublicKey() {
+        return getFieldAs(PUBLIC_KEY, Asn1BitString.class);
+    }
+
+    public void setPublicKey(Asn1BitString publicKey) {
+        setFieldAs(PUBLIC_KEY, publicKey);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherKeyAttribute.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherKeyAttribute.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherKeyAttribute.java
new file mode 100644
index 0000000..3b95d4e
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherKeyAttribute.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.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.type.Asn1Any;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.asn1.type.Asn1Type;
+
+import static org.apache.kerby.cms.type.OtherKeyAttribute.MyEnum.*;
+
+/**
+ * OtherKeyAttribute ::= SEQUENCE {
+ *   keyAttrId OBJECT IDENTIFIER,
+ *   keyAttr ANY DEFINED BY keyAttrId OPTIONAL }
+ */
+public class OtherKeyAttribute extends Asn1SequenceType {
+    protected enum MyEnum implements EnumType {
+        KEY_ATTR_ID,
+        KEY_ATTR;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(KEY_ATTR_ID, Asn1ObjectIdentifier.class),
+            new Asn1FieldInfo(KEY_ATTR, Asn1Any.class)
+    };
+
+    public OtherKeyAttribute() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getAlgorithm() {
+        return getFieldAs(KEY_ATTR_ID, Asn1ObjectIdentifier.class);
+    }
+
+    public void setAlgorithm(Asn1ObjectIdentifier keyAttrId) {
+        setFieldAs(KEY_ATTR_ID, keyAttrId);
+    }
+
+    public <T extends Asn1Type> T getKeyAttrAs(Class<T> t) {
+        return getFieldAsAny(KEY_ATTR, t);
+    }
+
+    public void setKeyAttr(Asn1Type keyAttr) {
+        setFieldAsAny(KEY_ATTR, keyAttr);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRecipientInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRecipientInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRecipientInfo.java
new file mode 100644
index 0000000..4032a3d
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/OtherRecipientInfo.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.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.type.Asn1Any;
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.type.Asn1ObjectIdentifier;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.cms.type.OtherRecipientInfo.MyEnum.*;
+
+/**
+ * OtherRecipientInfo ::= SEQUENCE {
+ *   oriType OBJECT IDENTIFIER,
+ *   oriValue ANY DEFINED BY oriType }
+ */
+public class OtherRecipientInfo extends Asn1SequenceType {
+    protected enum MyEnum implements EnumType {
+        ORI_TYPE,
+        ORI_VALUE;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(ORI_TYPE, Asn1ObjectIdentifier.class),
+            new Asn1FieldInfo(ORI_VALUE, Asn1Any.class)
+    };
+
+    public OtherRecipientInfo() {
+        super(fieldInfos);
+    }
+
+    public Asn1ObjectIdentifier getOriType() {
+        return getFieldAs(ORI_TYPE, Asn1ObjectIdentifier.class);
+    }
+
+    public void setOriType(Asn1ObjectIdentifier oriType) {
+        setFieldAs(ORI_TYPE, oriType);
+    }
+
+    public Asn1BitString getPublicKey() {
+        return getFieldAs(ORI_VALUE, Asn1BitString.class);
+    }
+
+    public void setOriValue(Asn1BitString oriValue) {
+        setFieldAs(ORI_VALUE, oriValue);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/PasswordRecipientInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/PasswordRecipientInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/PasswordRecipientInfo.java
new file mode 100644
index 0000000..61158d1
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/PasswordRecipientInfo.java
@@ -0,0 +1,98 @@
+/**
+ *  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.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.cms.type.PasswordRecipientInfo.MyEnum.*;
+
+/**
+ * PasswordRecipientInfo ::= SEQUENCE {
+ *   version CMSVersion,   -- always set to 0
+ *   keyDerivationAlgorithm [0] KeyDerivationAlgorithmIdentifier OPTIONAL,
+ *   keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
+ *   encryptedKey EncryptedKey }
+ */
+public class PasswordRecipientInfo extends Asn1SequenceType {
+    protected enum MyEnum implements EnumType {
+        VERSION,
+        KEY_DERIVATION_ALGORIGHM,
+        KEY_ENCRYPTION_ALGORITHMS,
+        ENCRYPTED_KEY;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(VERSION, CmsVersion.class),
+            new ExplicitField(KEY_DERIVATION_ALGORIGHM, 0, KeyDerivationAlgorithmIdentifier.class),
+            new Asn1FieldInfo(KEY_ENCRYPTION_ALGORITHMS, KeyEncryptionAlgorithmIdentifier.class),
+            new Asn1FieldInfo(ENCRYPTED_KEY, EncryptedKey.class)
+    };
+
+    public PasswordRecipientInfo() {
+        super(fieldInfos);
+    }
+
+    public CmsVersion getVersion() {
+        return getFieldAs(VERSION, CmsVersion.class);
+    }
+
+    public void setVersion(CmsVersion version) {
+        setFieldAs(VERSION, version);
+    }
+
+    public KeyDerivationAlgorithmIdentifier getKeyDerivationAlgorithmIdentifier() {
+        return getFieldAs(KEY_DERIVATION_ALGORIGHM, KeyDerivationAlgorithmIdentifier.class);
+    }
+
+    public void setKeyDerivationAlgorithmIdentifier(KeyDerivationAlgorithmIdentifier
+                                                            keyDerivationAlgorithmIdentifier) {
+        setFieldAs(KEY_DERIVATION_ALGORIGHM, keyDerivationAlgorithmIdentifier);
+    }
+
+    public KeyEncryptionAlgorithmIdentifier getKeyEncryptionAlgorithmIdentifier() {
+        return getFieldAs(KEY_ENCRYPTION_ALGORITHMS, KeyEncryptionAlgorithmIdentifier.class);
+    }
+
+    public void setKeyEncryptionAlgorithmIdentifier(KeyEncryptionAlgorithmIdentifier
+                                                            keyEncryptionAlgorithmIdentifier) {
+        setFieldAs(KEY_ENCRYPTION_ALGORITHMS, keyEncryptionAlgorithmIdentifier);
+    }
+
+    public EncryptedKey getEncryptedKey() {
+        return getFieldAs(ENCRYPTED_KEY, EncryptedKey.class);
+    }
+
+    public void setEncryptedKey(EncryptedKey encryptedKey) {
+        setFieldAs(ENCRYPTED_KEY, encryptedKey);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientEncryptedKey.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientEncryptedKey.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientEncryptedKey.java
new file mode 100644
index 0000000..2f02311
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientEncryptedKey.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.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+
+import static org.apache.kerby.cms.type.RecipientEncryptedKey.MyEnum.*;
+
+/**
+ * RecipientEncryptedKey ::= SEQUENCE {
+ *   rid KeyAgreeRecipientIdentifier,
+ *   encryptedKey EncryptedKey }
+ */
+public class RecipientEncryptedKey extends Asn1SequenceType {
+    protected enum MyEnum implements EnumType {
+        RID,
+        ENCRYPTED_KEY;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(RID, KeyAgreeRecipientIdentifier.class),
+            new Asn1FieldInfo(ENCRYPTED_KEY, EncryptedKey.class)
+    };
+
+    public RecipientEncryptedKey() {
+        super(fieldInfos);
+    }
+
+    public KeyAgreeRecipientIdentifier getRid() {
+        return getFieldAs(RID, KeyAgreeRecipientIdentifier.class);
+    }
+
+    public void setRid(KeyAgreeRecipientIdentifier rid) {
+        setFieldAs(RID, rid);
+    }
+
+    public EncryptedKey getEncryptedKey() {
+        return getFieldAs(ENCRYPTED_KEY, EncryptedKey.class);
+    }
+
+    public void setEncryptedKey(EncryptedKey encryptedKey) {
+        setFieldAs(ENCRYPTED_KEY, encryptedKey);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientEncryptedKeys.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientEncryptedKeys.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientEncryptedKeys.java
new file mode 100644
index 0000000..ddd1e83
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientEncryptedKeys.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.Asn1SequenceOf;
+
+/**
+ * RecipientEncryptedKeys ::= SEQUENCE OF RecipientEncryptedKey
+ */
+public class RecipientEncryptedKeys extends Asn1SequenceOf<RecipientEncryptedKey> {
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientIdentifier.java
new file mode 100644
index 0000000..7171511
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientIdentifier.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.cms.type;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.x509.type.SubjectKeyIdentifier;
+
+import static org.apache.kerby.cms.type.RecipientIdentifier.MyEnum.*;
+
+/**
+ * RecipientIdentifier ::= CHOICE {
+ *   issuerAndSerialNumber IssuerAndSerialNumber,
+ *   subjectKeyIdentifier [0] SubjectKeyIdentifier }
+ */
+public class RecipientIdentifier extends Asn1Choice {
+    protected enum MyEnum implements EnumType {
+        ISSUER_AND_SERIAL_NUMBER,
+        SUBJECT_KEY_IDENTIFIER;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[]{
+            new Asn1FieldInfo(ISSUER_AND_SERIAL_NUMBER, IssuerAndSerialNumber.class),
+            new ExplicitField(SUBJECT_KEY_IDENTIFIER, 0, SubjectKeyIdentifier.class)
+    };
+
+    public RecipientIdentifier() {
+        super(fieldInfos);
+    }
+
+    public IssuerAndSerialNumber getIssuerAndSerialNumber() {
+        return getChoiceValueAs(ISSUER_AND_SERIAL_NUMBER, IssuerAndSerialNumber.class);
+    }
+
+    public void setIssuerAndSerialNumber(IssuerAndSerialNumber issuerAndSerialNumber) {
+        setChoiceValue(ISSUER_AND_SERIAL_NUMBER, issuerAndSerialNumber);
+    }
+
+    public SubjectKeyIdentifier getSubjectKeyIdentifier() {
+        return getChoiceValueAs(SUBJECT_KEY_IDENTIFIER, SubjectKeyIdentifier.class);
+    }
+
+    public void setSubjectKeyIdentifier(SubjectKeyIdentifier subjectKeyIdentifier) {
+        setChoiceValue(SUBJECT_KEY_IDENTIFIER, subjectKeyIdentifier);
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientInfo.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientInfo.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientInfo.java
new file mode 100644
index 0000000..5866c2c
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientInfo.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.cms.type;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.asn1.type.Asn1Choice;
+
+import static org.apache.kerby.cms.type.RecipientInfo.MyEnum.*;
+
+/**
+ * RecipientInfo ::= CHOICE {
+ *   ktri KeyTransRecipientInfo,
+ *   kari [1] KeyAgreeRecipientInfo,
+ *   kekri [2] KEKRecipientInfo,
+ *   pwri [3] PasswordRecipientInfo,
+ *   ori [4] OtherRecipientInfo }
+ */
+public class RecipientInfo extends Asn1Choice {
+    protected enum MyEnum implements EnumType {
+        KTRI,
+        KARI,
+        KEKRI,
+        PWRI,
+        ORI;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(KTRI, KeyTransRecipientInfo.class),
+            new ExplicitField(KARI, 1, KeyAgreeRecipientInfo.class),
+            new ExplicitField(KEKRI, 2, KEKRecipientInfo.class),
+            new ExplicitField(PWRI, 3, PasswordRecipientInfo.class),
+            new ExplicitField(ORI, 4, OtherRecipientInfo.class)
+    };
+
+    public RecipientInfo() {
+        super(fieldInfos);
+    }
+
+    public KeyTransRecipientInfo getKtri() {
+        return getChoiceValueAs(KTRI, KeyTransRecipientInfo.class);
+    }
+
+    public void setKtri(KeyTransRecipientInfo ktri) {
+        setChoiceValue(KTRI, ktri);
+    }
+
+    public KeyAgreeRecipientInfo getKari() {
+        return getChoiceValueAs(KARI, KeyAgreeRecipientInfo.class);
+    }
+
+    public void setKari(KeyAgreeRecipientInfo kari) {
+        setChoiceValue(KARI, kari);
+    }
+
+    public KEKRecipientInfo getKekri() {
+        return getChoiceValueAs(KEKRI, KEKRecipientInfo.class);
+    }
+
+    public void setKekri(KEKRecipientInfo kekri) {
+        setChoiceValue(KEKRI, kekri);
+    }
+
+    public PasswordRecipientInfo getPwri() {
+        return getChoiceValueAs(PWRI, PasswordRecipientInfo.class);
+    }
+
+    public void setPwri(PasswordRecipientInfo pwri) {
+        setChoiceValue(PWRI, pwri);
+    }
+
+    public OtherRecipientInfo getori() {
+        return getChoiceValueAs(ORI, OtherRecipientInfo.class);
+    }
+
+    public void setOri(OtherRecipientInfo ori) {
+        setChoiceValue(ORI, ori);
+    }
+}

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

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/b3d51fb8/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientKeyIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientKeyIdentifier.java b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientKeyIdentifier.java
new file mode 100644
index 0000000..43719a3
--- /dev/null
+++ b/kerby-pkix/src/main/java/org/apache/kerby/cms/type/RecipientKeyIdentifier.java
@@ -0,0 +1,86 @@
+/**
+ *  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.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
+import org.apache.kerby.asn1.type.Asn1GeneralizedTime;
+import org.apache.kerby.asn1.type.Asn1SequenceType;
+import org.apache.kerby.x509.type.SubjectKeyIdentifier;
+
+import static org.apache.kerby.cms.type.RecipientKeyIdentifier.MyEnum.*;
+
+/**
+ * RecipientKeyIdentifier ::= SEQUENCE {
+ *   subjectKeyIdentifier SubjectKeyIdentifier,
+ *   date GeneralizedTime OPTIONAL,
+ *   other OtherKeyAttribute OPTIONAL }
+ */
+public class RecipientKeyIdentifier extends Asn1SequenceType {
+    protected enum MyEnum implements EnumType {
+        SUBJECT_KEY_IDENTIFIER,
+        DATE,
+        OTHER;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
+
+    static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+            new Asn1FieldInfo(SUBJECT_KEY_IDENTIFIER, SubjectKeyIdentifier.class),
+            new Asn1FieldInfo(DATE, Asn1GeneralizedTime.class),
+            new Asn1FieldInfo(OTHER, OtherKeyAttribute.class)
+    };
+
+    public RecipientKeyIdentifier() {
+        super(fieldInfos);
+    }
+
+    public SubjectKeyIdentifier getSubjectKeyIdentifier() {
+        return getFieldAs(SUBJECT_KEY_IDENTIFIER, SubjectKeyIdentifier.class);
+    }
+
+    public void setKeyIdentifier(SubjectKeyIdentifier subjectKeyIdentifier) {
+        setFieldAs(SUBJECT_KEY_IDENTIFIER, subjectKeyIdentifier);
+    }
+
+    public Asn1GeneralizedTime getDate() {
+        return getFieldAs(DATE, Asn1GeneralizedTime.class);
+    }
+
+    public void setDate(Asn1GeneralizedTime date) {
+        setFieldAs(DATE, date);
+    }
+
+    public OtherKeyAttribute getOther() {
+        return getFieldAs(OTHER, OtherKeyAttribute.class);
+    }
+
+    public void setOther(OtherKeyAttribute other) {
+        setFieldAs(OTHER, other);
+    }
+}

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


Mime
View raw message