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/30 04:09:51 UTC
[10/19] directory-kerby git commit: Renamed spec package to type for
Kerberos types defined in kerb-core module to be consistent with
ASN1/X509/CMS
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaAuthnEntry.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaAuthnEntry.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaAuthnEntry.java
new file mode 100644
index 0000000..8494ef9
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaAuthnEntry.java
@@ -0,0 +1,81 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.fast;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceType;
+import org.apache.kerby.kerberos.kerb.type.pa.PaDataType;
+
+/**
+ PA-AUTHENTICATION-SET-ELEM ::= SEQUENCE {
+ pa-type [0] Int32,
+ pa-hint [1] OCTET STRING OPTIONAL,
+ pa-value [2] OCTET STRING OPTIONAL,
+ }
+ */
+public class PaAuthnEntry extends KrbSequenceType {
+ private static final int PA_TYPE = 0;
+ private static final int PA_HINT = 1;
+ private static final int PA_VALUE = 2;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(PA_TYPE, Asn1Integer.class),
+ new ExplicitField(PA_HINT, Asn1OctetString.class),
+ new ExplicitField(PA_VALUE, Asn1OctetString.class)
+ };
+
+ public PaAuthnEntry() {
+ super(fieldInfos);
+ }
+
+ public PaAuthnEntry(PaDataType type, byte[] paData) {
+ this();
+ setPaType(type);
+ setPaValue(paData);
+ }
+
+ public PaDataType getPaType() {
+ Integer value = getFieldAsInteger(PA_TYPE);
+ return PaDataType.fromValue(value);
+ }
+
+ public void setPaType(PaDataType paDataType) {
+ setFieldAsInt(PA_TYPE, paDataType.getValue());
+ }
+
+ public byte[] getPaHint() {
+ return getFieldAsOctets(PA_HINT);
+ }
+
+ public void setPaHint(byte[] paHint) {
+ setFieldAsOctets(PA_HINT, paHint);
+ }
+
+ public byte[] getPaValue() {
+ return getFieldAsOctets(PA_VALUE);
+ }
+
+ public void setPaValue(byte[] paValue) {
+ setFieldAsOctets(PA_VALUE, paValue);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaAuthnSet.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaAuthnSet.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaAuthnSet.java
new file mode 100644
index 0000000..89d03c0
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaAuthnSet.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.kerberos.kerb.type.fast;
+
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceOfType;
+
+/**
+ PA-AUTHENTICATION-SET ::= SEQUENCE OF PA-AUTHENTICATION-SET-ELEM
+ */
+public class PaAuthnSet extends KrbSequenceOfType<PaAuthnEntry> {
+
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaFxFastReply.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaFxFastReply.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaFxFastReply.java
new file mode 100644
index 0000000..f3966f6
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaFxFastReply.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.fast;
+
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.ExplicitField;
+
+/**
+ PA-FX-FAST-REPLY ::= CHOICE {
+ armored-data [0] KrbFastArmoredRep,
+ }
+ */
+public class PaFxFastReply extends Asn1Choice {
+ private static final int ARMORED_DATA = 0;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(ARMORED_DATA, KrbFastArmoredRep.class)
+ };
+
+ public PaFxFastReply() {
+ super(fieldInfos);
+ }
+
+ public KrbFastArmoredRep getFastArmoredRep() {
+ return getFieldAs(ARMORED_DATA, KrbFastArmoredRep.class);
+ }
+
+ public void setFastArmoredRep(KrbFastArmoredRep fastArmoredRep) {
+ setFieldAs(ARMORED_DATA, fastArmoredRep);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaFxFastRequest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaFxFastRequest.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaFxFastRequest.java
new file mode 100644
index 0000000..a1b26c7
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/fast/PaFxFastRequest.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.fast;
+
+import org.apache.kerby.asn1.type.Asn1Choice;
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.ExplicitField;
+
+/**
+ PA-FX-FAST-REQUEST ::= CHOICE {
+ armored-data [0] KrbFastArmoredReq,
+ }
+ */
+public class PaFxFastRequest extends Asn1Choice {
+ private static final int ARMORED_DATA = 0;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(ARMORED_DATA, KrbFastArmoredReq.class)
+ };
+
+ public PaFxFastRequest() {
+ super(fieldInfos);
+ }
+
+ public KrbFastArmoredReq getFastArmoredReq() {
+ return getFieldAs(ARMORED_DATA, KrbFastArmoredReq.class);
+ }
+
+ public void setFastArmoredReq(KrbFastArmoredReq fastArmoredReq) {
+ setFieldAs(ARMORED_DATA, fastArmoredReq);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/AsRep.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/AsRep.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/AsRep.java
new file mode 100644
index 0000000..2f13c5d
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/AsRep.java
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.kdc;
+
+import org.apache.kerby.kerberos.kerb.type.base.KrbMessageType;
+
+/**
+ AS-REP ::= [APPLICATION 11] KDC-REP
+ */
+public class AsRep extends KdcRep {
+
+ public AsRep() {
+ super(KrbMessageType.AS_REP);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/AsReq.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/AsReq.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/AsReq.java
new file mode 100644
index 0000000..d3a6765
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/AsReq.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.kdc;
+
+import org.apache.kerby.kerberos.kerb.type.base.KrbMessageType;
+
+/**
+ AS-REQ ::= [APPLICATION 10] KDC-REQ
+ */
+public class AsReq extends KdcReq {
+ public AsReq() {
+ super(KrbMessageType.AS_REQ);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/EncAsRepPart.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/EncAsRepPart.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/EncAsRepPart.java
new file mode 100644
index 0000000..19c0988
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/EncAsRepPart.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.kdc;
+
+/**
+EncASRepPart ::= [APPLICATION 25] EncKDCRepPart
+*/
+public class EncAsRepPart extends EncKdcRepPart {
+ public static final int TAG = 25;
+
+ public EncAsRepPart() {
+ super(TAG);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/EncKdcRepPart.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/EncKdcRepPart.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/EncKdcRepPart.java
new file mode 100644
index 0000000..d363ca7
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/EncKdcRepPart.java
@@ -0,0 +1,178 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.kdc;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.kerberos.kerb.type.KerberosString;
+import org.apache.kerby.kerberos.kerb.type.KerberosTime;
+import org.apache.kerby.kerberos.kerb.type.KrbAppSequenceType;
+import org.apache.kerby.kerberos.kerb.type.base.EncryptionKey;
+import org.apache.kerby.kerberos.kerb.type.base.HostAddresses;
+import org.apache.kerby.kerberos.kerb.type.base.LastReq;
+import org.apache.kerby.kerberos.kerb.type.base.PrincipalName;
+import org.apache.kerby.kerberos.kerb.type.ticket.TicketFlags;
+
+/**
+ EncKDCRepPart ::= SEQUENCE {
+ key [0] EncryptionKey,
+ last-req [1] LastReq,
+ nonce [2] UInt32,
+ key-expiration [3] KerberosTime OPTIONAL,
+ flags [4] TicketFlags,
+ authtime [5] KerberosTime,
+ starttime [6] KerberosTime OPTIONAL,
+ endtime [7] KerberosTime,
+ renew-till [8] KerberosTime OPTIONAL,
+ srealm [9] Realm,
+ sname [10] PrincipalName,
+ caddr [11] HostAddresses OPTIONAL
+ }
+ */
+public abstract class EncKdcRepPart extends KrbAppSequenceType {
+ private static final int KEY = 0;
+ private static final int LAST_REQ = 1;
+ private static final int NONCE = 2;
+ private static final int KEY_EXPIRATION = 3;
+ private static final int FLAGS = 4;
+ private static final int AUTHTIME = 5;
+ private static final int STARTTIME = 6;
+ private static final int ENDTIME = 7;
+ private static final int RENEW_TILL = 8;
+ private static final int SREALM = 9;
+ private static final int SNAME = 10;
+ private static final int CADDR = 11;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(KEY, EncryptionKey.class),
+ new ExplicitField(LAST_REQ, LastReq.class),
+ new ExplicitField(NONCE, Asn1Integer.class),
+ new ExplicitField(KEY_EXPIRATION, KerberosTime.class),
+ new ExplicitField(FLAGS, TicketFlags.class),
+ new ExplicitField(AUTHTIME, KerberosTime.class),
+ new ExplicitField(STARTTIME, KerberosTime.class),
+ new ExplicitField(ENDTIME, KerberosTime.class),
+ new ExplicitField(RENEW_TILL, KerberosTime.class),
+ new ExplicitField(SREALM, KerberosString.class),
+ new ExplicitField(SNAME, PrincipalName.class),
+ new ExplicitField(CADDR, HostAddresses.class)
+ };
+
+ public EncKdcRepPart(int tagNo) {
+ super(tagNo, fieldInfos);
+ }
+
+ public EncryptionKey getKey() {
+ return getFieldAs(KEY, EncryptionKey.class);
+ }
+
+ public void setKey(EncryptionKey key) {
+ setFieldAs(KEY, key);
+ }
+
+ public LastReq getLastReq() {
+ return getFieldAs(LAST_REQ, LastReq.class);
+ }
+
+ public void setLastReq(LastReq lastReq) {
+ setFieldAs(LAST_REQ, lastReq);
+ }
+
+ public int getNonce() {
+ return getFieldAsInt(NONCE);
+ }
+
+ public void setNonce(int nonce) {
+ setFieldAsInt(NONCE, nonce);
+ }
+
+ public KerberosTime getKeyExpiration() {
+ return getFieldAsTime(KEY_EXPIRATION);
+ }
+
+ public void setKeyExpiration(KerberosTime keyExpiration) {
+ setFieldAs(KEY_EXPIRATION, keyExpiration);
+ }
+
+ public TicketFlags getFlags() {
+ return getFieldAs(FLAGS, TicketFlags.class);
+ }
+
+ public void setFlags(TicketFlags flags) {
+ setFieldAs(FLAGS, flags);
+ }
+
+ public KerberosTime getAuthTime() {
+ return getFieldAsTime(AUTHTIME);
+ }
+
+ public void setAuthTime(KerberosTime authTime) {
+ setFieldAs(AUTHTIME, authTime);
+ }
+
+ public KerberosTime getStartTime() {
+ return getFieldAsTime(STARTTIME);
+ }
+
+ public void setStartTime(KerberosTime startTime) {
+ setFieldAs(STARTTIME, startTime);
+ }
+
+ public KerberosTime getEndTime() {
+ return getFieldAsTime(ENDTIME);
+ }
+
+ public void setEndTime(KerberosTime endTime) {
+ setFieldAs(ENDTIME, endTime);
+ }
+
+ public KerberosTime getRenewTill() {
+ return getFieldAsTime(RENEW_TILL);
+ }
+
+ public void setRenewTill(KerberosTime renewTill) {
+ setFieldAs(RENEW_TILL, renewTill);
+ }
+
+ public String getSrealm() {
+ return getFieldAsString(SREALM);
+ }
+
+ public void setSrealm(String srealm) {
+ setFieldAsString(SREALM, srealm);
+ }
+
+ public PrincipalName getSname() {
+ return getFieldAs(SNAME, PrincipalName.class);
+ }
+
+ public void setSname(PrincipalName sname) {
+ setFieldAs(SNAME, sname);
+ }
+
+ public HostAddresses getCaddr() {
+ return getFieldAs(CADDR, HostAddresses.class);
+ }
+
+ public void setCaddr(HostAddresses caddr) {
+ setFieldAs(CADDR, caddr);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/EncTgsRepPart.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/EncTgsRepPart.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/EncTgsRepPart.java
new file mode 100644
index 0000000..70fb23d
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/EncTgsRepPart.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.kdc;
+
+/**
+ EncTGSRepPart ::= [APPLICATION 26] EncKDCRepPart
+ */
+public class EncTgsRepPart extends EncKdcRepPart {
+ public static final int TAG = 26;
+
+ public EncTgsRepPart() {
+ super(TAG);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcOption.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcOption.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcOption.java
new file mode 100644
index 0000000..ef6261d
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcOption.java
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.kdc;
+
+import org.apache.kerby.asn1.type.Asn1EnumType;
+
+public enum KdcOption implements Asn1EnumType {
+ NONE(-1),
+ //RESERVED(0x80000000),
+ FORWARDABLE(0x40000000),
+ FORWARDED(0x20000000),
+ PROXIABLE(0x10000000),
+ PROXY(0x08000000),
+ ALLOW_POSTDATE(0x04000000),
+ POSTDATED(0x02000000),
+ //UNUSED(0x01000000),
+ RENEWABLE(0x00800000),
+ //UNUSED(0x00400000),
+ //RESERVED(0x00200000),
+ //RESERVED(0x00100000),
+ //RESERVED(0x00080000),
+ //RESERVED(0x00040000),
+ CNAME_IN_ADDL_TKT(0x00020000),
+ CANONICALIZE(0x00010000),
+ REQUEST_ANONYMOUS(0x00008000),
+ //RESERVED(0x00004000),
+ //RESERVED(0x00002000),
+ //RESERVED(0x00001000),
+ //RESERVED(0x00000800),
+ //RESERVED(0x00000400),
+ //RESERVED(0x00000200),
+ //RESERVED(0x00000100),
+ //RESERVED(0x00000080),
+ //RESERVED(0x00000040),
+ DISABLE_TRANSITED_CHECK(0x00000020),
+ RENEWABLE_OK(0x00000010),
+ ENC_TKT_IN_SKEY(0x00000008),
+ //UNUSED(0x00000004),
+ RENEW(0x00000002),
+ VALIDATE(0x00000001);
+
+ private final int value;
+
+ private KdcOption(int value) {
+ this.value = value;
+ }
+
+ @Override
+ public int getValue() {
+ return value;
+ }
+
+ public static KdcOption fromValue(int value) {
+ for (Asn1EnumType e : values()) {
+ if (e.getValue() == value) {
+ return (KdcOption) e;
+ }
+ }
+
+ return NONE;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcOptions.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcOptions.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcOptions.java
new file mode 100644
index 0000000..fb0c9db
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcOptions.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.kdc;
+
+import org.apache.kerby.asn1.type.Asn1Flags;
+
+public class KdcOptions extends Asn1Flags {
+
+ public KdcOptions() {
+ this(0);
+ }
+
+ public KdcOptions(int value) {
+ setFlags(value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcRep.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcRep.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcRep.java
new file mode 100644
index 0000000..9d0bd88
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcRep.java
@@ -0,0 +1,117 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.kdc;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.kerberos.kerb.type.KerberosString;
+import org.apache.kerby.kerberos.kerb.type.base.EncryptedData;
+import org.apache.kerby.kerberos.kerb.type.base.KrbMessage;
+import org.apache.kerby.kerberos.kerb.type.base.KrbMessageType;
+import org.apache.kerby.kerberos.kerb.type.base.PrincipalName;
+import org.apache.kerby.kerberos.kerb.type.pa.PaData;
+import org.apache.kerby.kerberos.kerb.type.ticket.Ticket;
+
+/**
+ KDC-REP ::= SEQUENCE {
+ pvno [0] INTEGER (5),
+ msg-type [1] INTEGER (11 -- AS -- | 13 -- TGS --),
+ padata [2] SEQUENCE OF PA-DATA OPTIONAL
+ -- NOTE: not empty --,
+ crealm [3] Realm,
+ cname [4] PrincipalName,
+ ticket [5] Ticket,
+ enc-part [6] EncryptedData
+ -- EncASRepPart or EncTGSRepPart,
+ -- as appropriate
+ }
+ */
+public class KdcRep extends KrbMessage {
+ private static final int PADATA = 2;
+ private static final int CREALM = 3;
+ private static final int CNAME = 4;
+ private static final int TICKET = 5;
+ private static final int ENC_PART = 6;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(PVNO, Asn1Integer.class),
+ new ExplicitField(MSG_TYPE, Asn1Integer.class),
+ new ExplicitField(PADATA, PaData.class),
+ new ExplicitField(CREALM, KerberosString.class),
+ new ExplicitField(CNAME, PrincipalName.class),
+ new ExplicitField(TICKET, Ticket.class),
+ new ExplicitField(ENC_PART, EncryptedData.class)
+ };
+
+ private EncKdcRepPart encPart;
+
+ public KdcRep(KrbMessageType msgType) {
+ super(msgType, fieldInfos);
+ }
+
+ public PaData getPaData() {
+ return getFieldAs(PADATA, PaData.class);
+ }
+
+ public void setPaData(PaData paData) {
+ setFieldAs(PADATA, paData);
+ }
+
+ public PrincipalName getCname() {
+ return getFieldAs(CNAME, PrincipalName.class);
+ }
+
+ public void setCname(PrincipalName sname) {
+ setFieldAs(CNAME, sname);
+ }
+
+ public String getCrealm() {
+ return getFieldAsString(CREALM);
+ }
+
+ public void setCrealm(String realm) {
+ setFieldAs(CREALM, new KerberosString(realm));
+ }
+
+ public Ticket getTicket() {
+ return getFieldAs(TICKET, Ticket.class);
+ }
+
+ public void setTicket(Ticket ticket) {
+ setFieldAs(TICKET, ticket);
+ }
+
+ public EncryptedData getEncryptedEncPart() {
+ return getFieldAs(ENC_PART, EncryptedData.class);
+ }
+
+ public void setEncryptedEncPart(EncryptedData encryptedEncPart) {
+ setFieldAs(ENC_PART, encryptedEncPart);
+ }
+
+ public EncKdcRepPart getEncPart() {
+ return encPart;
+ }
+
+ public void setEncPart(EncKdcRepPart encPart) {
+ this.encPart = encPart;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcReq.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcReq.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcReq.java
new file mode 100644
index 0000000..98b2d80
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcReq.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.kerberos.kerb.type.kdc;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.kerberos.kerb.type.base.KrbMessage;
+import org.apache.kerby.kerberos.kerb.type.base.KrbMessageType;
+import org.apache.kerby.kerberos.kerb.type.pa.PaData;
+import org.apache.kerby.kerberos.kerb.type.pa.PaDataEntry;
+
+/**
+ KDC-REQ ::= SEQUENCE {
+ -- NOTE: first tag is [1], not [0]
+ pvno [1] INTEGER (5) ,
+ msg-type [2] INTEGER (10 -- AS -- | 12 -- TGS --),
+ padata [3] SEQUENCE OF PA-DATA OPTIONAL
+ -- NOTE: not empty --,
+ req-encodeBody [4] KDC-REQ-BODY
+ }
+ */
+public class KdcReq extends KrbMessage {
+ private static final int PADATA = 2;
+ private static final int REQ_BODY = 3;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(PVNO, 1, Asn1Integer.class),
+ new ExplicitField(MSG_TYPE, 2, Asn1Integer.class),
+ new ExplicitField(PADATA, 3, PaData.class),
+ new ExplicitField(REQ_BODY, 4, KdcReqBody.class)
+ };
+
+ public KdcReq(KrbMessageType msgType) {
+ super(msgType, fieldInfos);
+ }
+
+ public PaData getPaData() {
+ return getFieldAs(PADATA, PaData.class);
+ }
+
+ public void setPaData(PaData paData) {
+ setFieldAs(PADATA, paData);
+ }
+
+ public void addPaData(PaDataEntry paDataEntry) {
+ if (getPaData() == null) {
+ setPaData(new PaData());
+ }
+ getPaData().addElement(paDataEntry);
+ }
+
+ public KdcReqBody getReqBody() {
+ return getFieldAs(REQ_BODY, KdcReqBody.class);
+ }
+
+ public void setReqBody(KdcReqBody reqBody) {
+ setFieldAs(REQ_BODY, reqBody);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcReqBody.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcReqBody.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcReqBody.java
new file mode 100644
index 0000000..f7a23c1
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/KdcReqBody.java
@@ -0,0 +1,214 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.kdc;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.kerberos.kerb.type.KerberosString;
+import org.apache.kerby.kerberos.kerb.type.KerberosTime;
+import org.apache.kerby.kerberos.kerb.type.KrbIntegers;
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceType;
+import org.apache.kerby.kerberos.kerb.type.ad.AuthorizationData;
+import org.apache.kerby.kerberos.kerb.type.base.EncryptedData;
+import org.apache.kerby.kerberos.kerb.type.base.EncryptionType;
+import org.apache.kerby.kerberos.kerb.type.base.HostAddresses;
+import org.apache.kerby.kerberos.kerb.type.base.PrincipalName;
+import org.apache.kerby.kerberos.kerb.type.ticket.Tickets;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ KDC-REQ-BODY ::= SEQUENCE {
+ kdc-options [0] KDCOptions,
+ cname [1] PrincipalName OPTIONAL
+ -- Used only in AS-REQ --,
+ realm [2] Realm
+ -- Server's realm
+ -- Also client's in AS-REQ --,
+ sname [3] PrincipalName OPTIONAL,
+ from [4] KerberosTime OPTIONAL,
+ till [5] KerberosTime,
+ rtime [6] KerberosTime OPTIONAL,
+ nonce [7] UInt32,
+ etype [8] SEQUENCE OF Int32 -- EncryptionType
+ -- in preference order --,
+ addresses [9] HostAddresses OPTIONAL,
+ enc-authorization-data [10] EncryptedData OPTIONAL
+ -- AuthorizationData --,
+ additional-tickets [11] SEQUENCE OF Ticket OPTIONAL
+ -- NOTE: not empty
+ }
+ */
+public class KdcReqBody extends KrbSequenceType {
+ private static final int KDC_OPTIONS = 0;
+ private static final int CNAME = 1;
+ private static final int REALM = 2;
+ private static final int SNAME = 3;
+ private static final int FROM = 4;
+ private static final int TILL = 5;
+ private static final int RTIME = 6;
+ private static final int NONCE = 7;
+ private static final int ETYPE = 8;
+ private static final int ADDRESSES = 9;
+ private static final int ENC_AUTHORIZATION_DATA = 10;
+ private static final int ADDITIONAL_TICKETS = 11;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(KDC_OPTIONS, KdcOptions.class),
+ new ExplicitField(CNAME, PrincipalName.class),
+ new ExplicitField(REALM, KerberosString.class),
+ new ExplicitField(SNAME, PrincipalName.class),
+ new ExplicitField(FROM, KerberosTime.class),
+ new ExplicitField(TILL, KerberosTime.class),
+ new ExplicitField(RTIME, KerberosTime.class),
+ new ExplicitField(NONCE, Asn1Integer.class),
+ new ExplicitField(ETYPE, KrbIntegers.class),
+ new ExplicitField(ADDRESSES, HostAddresses.class),
+ new ExplicitField(ENC_AUTHORIZATION_DATA, AuthorizationData.class),
+ new ExplicitField(ADDITIONAL_TICKETS, Tickets.class)
+ };
+
+ public KdcReqBody() {
+ super(fieldInfos);
+ }
+
+ private AuthorizationData authorizationData;
+
+ public KerberosTime getFrom() {
+ return getFieldAs(FROM, KerberosTime.class);
+ }
+
+ public void setFrom(KerberosTime from) {
+ setFieldAs(FROM, from);
+ }
+
+ public KerberosTime getTill() {
+ return getFieldAs(TILL, KerberosTime.class);
+ }
+
+ public void setTill(KerberosTime till) {
+ setFieldAs(TILL, till);
+ }
+
+ public KerberosTime getRtime() {
+ return getFieldAs(RTIME, KerberosTime.class);
+ }
+
+ public void setRtime(KerberosTime rtime) {
+ setFieldAs(RTIME, rtime);
+ }
+
+ public int getNonce() {
+ return getFieldAsInt(NONCE);
+ }
+
+ public void setNonce(int nonce) {
+ setFieldAsInt(NONCE, nonce);
+ }
+
+ public List<EncryptionType> getEtypes() {
+ KrbIntegers values = getFieldAs(ETYPE, KrbIntegers.class);
+ if (values == null) {
+ return Collections.emptyList();
+ }
+
+ List<EncryptionType> results = new ArrayList<EncryptionType>();
+ for (Integer value : values.getValues()) {
+ results.add(EncryptionType.fromValue(value));
+ }
+ return results;
+ }
+
+ public void setEtypes(List<EncryptionType> etypes) {
+ List<Integer> values = new ArrayList<Integer>();
+ for (EncryptionType etype: etypes) {
+ values.add(etype.getValue());
+ }
+ KrbIntegers value = new KrbIntegers(values);
+ setFieldAs(ETYPE, value);
+ }
+
+ public HostAddresses getAddresses() {
+ return getFieldAs(ADDRESSES, HostAddresses.class);
+ }
+
+ public void setAddresses(HostAddresses addresses) {
+ setFieldAs(ADDRESSES, addresses);
+ }
+
+ public EncryptedData getEncryptedAuthorizationData() {
+ return getFieldAs(ENC_AUTHORIZATION_DATA, EncryptedData.class);
+ }
+
+ public void setEncryptedAuthorizationData(EncryptedData encAuthorizationData) {
+ setFieldAs(ENC_AUTHORIZATION_DATA, encAuthorizationData);
+ }
+
+ public AuthorizationData getAuthorizationData() {
+ return authorizationData;
+ }
+
+ public void setAuthorizationData(AuthorizationData authorizationData) {
+ this.authorizationData = authorizationData;
+ }
+
+ public Tickets getAdditionalTickets() {
+ return getFieldAs(ADDITIONAL_TICKETS, Tickets.class);
+ }
+
+ public void setAdditionalTickets(Tickets additionalTickets) {
+ setFieldAs(ADDITIONAL_TICKETS, additionalTickets);
+ }
+
+ public KdcOptions getKdcOptions() {
+ return getFieldAs(KDC_OPTIONS, KdcOptions.class);
+ }
+
+ public void setKdcOptions(KdcOptions kdcOptions) {
+ setFieldAs(KDC_OPTIONS, kdcOptions);
+ }
+
+ public PrincipalName getSname() {
+ return getFieldAs(SNAME, PrincipalName.class);
+ }
+
+ public void setSname(PrincipalName sname) {
+ setFieldAs(SNAME, sname);
+ }
+
+ public PrincipalName getCname() {
+ return getFieldAs(CNAME, PrincipalName.class);
+ }
+
+ public void setCname(PrincipalName cname) {
+ setFieldAs(CNAME, cname);
+ }
+
+ public String getRealm() {
+ return getFieldAsString(REALM);
+ }
+
+ public void setRealm(String realm) {
+ setFieldAs(REALM, new KerberosString(realm));
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/TgsRep.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/TgsRep.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/TgsRep.java
new file mode 100644
index 0000000..582df95
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/TgsRep.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.kdc;
+
+import org.apache.kerby.kerberos.kerb.type.base.KrbMessageType;
+
+/**
+ TGS-REP ::= [APPLICATION 13] KDC-REP
+ */
+public class TgsRep extends KdcRep {
+ public TgsRep() {
+ super(KrbMessageType.TGS_REP);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/TgsReq.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/TgsReq.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/TgsReq.java
new file mode 100644
index 0000000..b20b413
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/kdc/TgsReq.java
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.kdc;
+
+import org.apache.kerby.kerberos.kerb.type.base.KrbMessageType;
+
+/**
+ TGS-REQ ::= [APPLICATION 12] KDC-REQ
+ */
+public class TgsReq extends KdcReq {
+
+ public TgsReq() {
+ super(KrbMessageType.TGS_REQ);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaAuthenticationSet.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaAuthenticationSet.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaAuthenticationSet.java
new file mode 100644
index 0000000..6690d98
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaAuthenticationSet.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.kerberos.kerb.type.pa;
+
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceOfType;
+
+/**
+ PA-AUTHENTICATION-SET ::= SEQUENCE OF PA-AUTHENTICATION-SET-ELEM
+ */
+public class PaAuthenticationSet extends KrbSequenceOfType<PaAuthenticationSetElem> {
+
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaAuthenticationSetElem.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaAuthenticationSetElem.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaAuthenticationSetElem.java
new file mode 100644
index 0000000..83b390e
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaAuthenticationSetElem.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.kerberos.kerb.type.pa;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceType;
+
+/**
+ PA-AUTHENTICATION-SET-ELEM ::= SEQUENCE {
+ pa-type [0] Int32,
+ -- same as padata-type.
+ pa-hint [1] OCTET STRING OPTIONAL,
+ pa-value [2] OCTET STRING OPTIONAL
+ }
+ */
+public class PaAuthenticationSetElem extends KrbSequenceType {
+ private static final int PA_TYPE = 0;
+ private static final int PA_HINT = 1;
+ private static final int PA_VALUE = 2;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(PA_TYPE, Asn1Integer.class),
+ new ExplicitField(PA_HINT, Asn1OctetString.class),
+ new ExplicitField(PA_VALUE, Asn1OctetString.class)
+ };
+
+ public PaAuthenticationSetElem() {
+ super(fieldInfos);
+ }
+
+ public PaDataType getPaType() {
+ Integer value = getFieldAsInteger(PA_TYPE);
+ return PaDataType.fromValue(value);
+ }
+
+ public void setPaType(PaDataType paDataType) {
+ setFieldAsInt(PA_TYPE, paDataType.getValue());
+ }
+
+ public byte[] getPaHint() {
+ return getFieldAsOctets(PA_HINT);
+ }
+
+ public void setPaHint(byte[] paHint) {
+ setFieldAsOctets(PA_HINT, paHint);
+ }
+
+ public byte[] getPaValue() {
+ return getFieldAsOctets(PA_VALUE);
+ }
+
+ public void setPaValue(byte[] paDataValue) {
+ setFieldAsOctets(PA_VALUE, paDataValue);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaData.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaData.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaData.java
new file mode 100644
index 0000000..bcbaaf8
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaData.java
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.pa;
+
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceOfType;
+
+/**
+ PA-DATA ::= SEQUENCE {
+ -- NOTE: first tag is [1], not [0]
+ padata-type [1] Int32,
+ padata-value [2] OCTET STRING -- might be encoded AP-REQ
+ }
+ */
+public class PaData extends KrbSequenceOfType<PaDataEntry> {
+
+ public PaDataEntry findEntry(PaDataType paType) {
+ for (PaDataEntry pae : getElements()) {
+ if (pae.getPaDataType() == paType) {
+ return pae;
+ }
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaDataEntry.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaDataEntry.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaDataEntry.java
new file mode 100644
index 0000000..ea2f131
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaDataEntry.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.kerberos.kerb.type.pa;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceType;
+
+/**
+ PA-DATA ::= SEQUENCE {
+ -- NOTE: first tag is [1], not [0]
+ padata-type [1] Int32,
+ padata-value [2] OCTET STRING -- might be encoded AP-REQ
+ }
+ */
+public class PaDataEntry extends KrbSequenceType {
+ private static final int PADATA_TYPE = 0;
+ private static final int PADATA_VALUE = 1;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(PADATA_TYPE, 1, Asn1Integer.class),
+ new ExplicitField(PADATA_VALUE, 2, Asn1OctetString.class)
+ };
+
+ public PaDataEntry() {
+ super(fieldInfos);
+ }
+
+ public PaDataEntry(PaDataType type, byte[] paData) {
+ this();
+ setPaDataType(type);
+ setPaDataValue(paData);
+ }
+
+ public PaDataType getPaDataType() {
+ Integer value = getFieldAsInteger(PADATA_TYPE);
+ return PaDataType.fromValue(value);
+ }
+
+ public void setPaDataType(PaDataType paDataType) {
+ setFieldAsInt(PADATA_TYPE, paDataType.getValue());
+ }
+
+ public byte[] getPaDataValue() {
+ return getFieldAsOctets(PADATA_VALUE);
+ }
+
+ public void setPaDataValue(byte[] paDataValue) {
+ setFieldAsOctets(PADATA_VALUE, paDataValue);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaDataType.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaDataType.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaDataType.java
new file mode 100644
index 0000000..da3807e
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaDataType.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.kerberos.kerb.type.pa;
+
+import org.apache.kerby.asn1.type.Asn1EnumType;
+
+/**
+ * From krb5.h
+ */
+public enum PaDataType implements Asn1EnumType {
+ NONE (0),
+ TGS_REQ (1),
+ AP_REQ (1),
+ ENC_TIMESTAMP (2), // RFC 4120
+ PW_SALT (3), // RFC 4120
+ ENC_ENCKEY (4), // Key encrypted within itself
+ ENC_UNIX_TIME (5), // timestamp encrypted in key. RFC 4120
+ ENC_SANDIA_SECURID (6), // SecurId passcode. RFC 4120
+ SESAME (7), // Sesame project. RFC 4120
+ OSF_DCE (8), // OSF DCE. RFC 4120
+ CYBERSAFE_SECUREID (9), // Cybersafe. RFC 4120
+ AFS3_SALT (10), // Cygnus. RFC 4120, 3961
+ ETYPE_INFO (11), // Etype info for preauth. RFC 4120
+ SAM_CHALLENGE (12), // SAM/OTP
+ SAM_RESPONSE (13), // SAM/OTP
+ PK_AS_REQ (16), // PKINIT. RFC 4556
+ PK_AS_REP (17), // PKINIT. RFC 4556
+ ETYPE_INFO2 (19), // RFC 4120
+ USE_SPECIFIED_KVNO (20), // RFC 4120
+ SVR_REFERRAL_INFO (20), // Windows 2000 referrals. RFC 6820
+ SAM_REDIRECT (21), // SAM/OTP. RFC 4120
+ GET_FROM_TYPED_DATA (22), // Embedded in typed data. RFC 4120
+ REFERRAL (25), // draft referral system
+ SAM_CHALLENGE_2 (30), // draft challenge system, updated
+ SAM_RESPONSE_2 (31), // draft challenge system, updated
+ /* MS-KILE */
+ PAC_REQUEST (128), // include Windows PAC
+ FOR_USER (129), // username protocol transition request
+ S4U_X509_USER (130), // certificate protocol transition request
+ AS_CHECKSUM (132), // AS checksum
+ FX_COOKIE (133), // RFC 6113
+ FX_FAST (136), // RFC 6113
+ FX_ERROR (137), // RFC 6113
+ ENCRYPTED_CHALLENGE (138), // RFC 6113
+ OTP_CHALLENGE (141), // RFC 6560 section 4.1
+ OTP_REQUEST (142), // RFC 6560 section 4.2
+ OTP_PIN_CHANGE (144), // RFC 6560 section 4.3
+ PKINIT_KX (147), // RFC 6112
+ ENCPADATA_REQ_ENC_PA_REP (149), // RFC 6806
+ TOKEN_REQUEST (148), // TokenPreauth
+ TOKEN_CHALLENGE (149);
+
+ private final int value;
+
+ private PaDataType(int value) {
+ this.value = value;
+ }
+
+ @Override
+ public int getValue() {
+ return value;
+ }
+
+ public static PaDataType fromValue(Integer value) {
+ if (value != null) {
+ for (Asn1EnumType e : values()) {
+ if (e.getValue() == value.intValue()) {
+ return (PaDataType) e;
+ }
+ }
+ }
+
+ return NONE;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaEncTsEnc.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaEncTsEnc.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaEncTsEnc.java
new file mode 100644
index 0000000..4ffff7c
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/PaEncTsEnc.java
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.pa;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.kerberos.kerb.type.KerberosTime;
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceType;
+
+/**
+ PA-ENC-TS-ENC ::= SEQUENCE {
+ patimestamp [0] KerberosTime -- client's time --,
+ pausec [1] Microseconds OPTIONAL
+ }
+ */
+public class PaEncTsEnc extends KrbSequenceType {
+ private static final int PATIMESTAMP = 0;
+ private static final int PAUSEC = 1;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(PATIMESTAMP, 0, KerberosTime.class),
+ new ExplicitField(PAUSEC, 1, Asn1Integer.class)
+ };
+
+ public PaEncTsEnc() {
+ super(fieldInfos);
+ }
+
+ public KerberosTime getPaTimestamp() {
+ return getFieldAsTime(PATIMESTAMP);
+ }
+
+ public void setPaTimestamp(KerberosTime paTimestamp) {
+ setFieldAs(PATIMESTAMP, paTimestamp);
+ }
+
+ public int getPaUsec() {
+ return getFieldAsInt(PAUSEC);
+ }
+
+ public void setPaUsec(int paUsec) {
+ setFieldAsInt(PAUSEC, paUsec);
+ }
+
+ public KerberosTime getAllTime() {
+ KerberosTime paTimestamp = getPaTimestamp();
+ return paTimestamp.extend(getPaUsec() / 1000);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/otp/OtpTokenInfo.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/otp/OtpTokenInfo.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/otp/OtpTokenInfo.java
new file mode 100644
index 0000000..900d2d2
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/otp/OtpTokenInfo.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.kerberos.kerb.type.pa.otp;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.Asn1Utf8String;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.kerberos.kerb.type.KerberosString;
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceType;
+import org.apache.kerby.kerberos.kerb.type.pa.pkinit.AlgorithmIdentifiers;
+
+/**
+ OTP-TOKENINFO ::= SEQUENCE {
+ flags [0] OTPFlags,
+ otp-vendor [1] UTF8String OPTIONAL,
+ otp-challenge [2] OCTET STRING (SIZE(1..MAX)) OPTIONAL,
+ otp-length [3] Int32 OPTIONAL,
+ otp-format [4] OTPFormat OPTIONAL,
+ otp-tokenID [5] OCTET STRING OPTIONAL,
+ otp-algID [6] AnyURI OPTIONAL,
+ supportedHashAlg [7] SEQUENCE OF AlgorithmIdentifier OPTIONAL,
+ iterationCount [8] Int32 OPTIONAL
+ }
+ */
+public class OtpTokenInfo extends KrbSequenceType {
+ private static final int FLAGS = 0;
+ private static final int OTP_VENDOR = 1;
+ private static final int OTP_CHALLENGE = 2;
+ private static final int OTP_LENGTH = 3;
+ private static final int OTP_FORMAT = 4;
+ private static final int OTP_TOKEN_ID = 5;
+ private static final int OTP_ALG_ID = 6;
+ private static final int SUPPORTED_HASH_ALG = 7;
+ private static final int ITERATION_COUNT = 8;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(FLAGS, Asn1OctetString.class),
+ new ExplicitField(OTP_VENDOR, Asn1Utf8String.class),
+ new ExplicitField(OTP_CHALLENGE, Asn1OctetString.class),
+ new ExplicitField(OTP_LENGTH, KerberosString.class),
+ new ExplicitField(OTP_FORMAT, Asn1OctetString.class),
+ new ExplicitField(OTP_TOKEN_ID, Asn1Utf8String.class),
+ new ExplicitField(OTP_ALG_ID, Asn1OctetString.class),
+ new ExplicitField(SUPPORTED_HASH_ALG, AlgorithmIdentifiers.class),
+ new ExplicitField(ITERATION_COUNT, Asn1Integer.class)
+ };
+
+ public OtpTokenInfo() {
+ super(fieldInfos);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/otp/PaOtpChallenge.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/otp/PaOtpChallenge.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/otp/PaOtpChallenge.java
new file mode 100644
index 0000000..cbf245c
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/otp/PaOtpChallenge.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.pa.otp;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.type.Asn1Utf8String;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.kerberos.kerb.type.KerberosString;
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceType;
+
+/**
+ PA-OTP-CHALLENGE ::= SEQUENCE {
+ nonce [0] OCTET STRING,
+ otp-service [1] UTF8String OPTIONAL,
+ otp-tokenInfo [2] SEQUENCE (SIZE(1..MAX)) OF OTP-TOKENINFO,
+ salt [3] KerberosString OPTIONAL,
+ s2kparams [4] OCTET STRING OPTIONAL,
+ }
+ */
+public class PaOtpChallenge extends KrbSequenceType {
+ private static final int NONCE = 0;
+ private static final int OTP_SERVICE = 1;
+ private static final int OTP_TOKEN_INFO = 2;
+ private static final int SALT = 3;
+ private static final int S2KPARAMS = 4;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(NONCE, Asn1OctetString.class),
+ new ExplicitField(OTP_SERVICE, Asn1Utf8String.class),
+ new ExplicitField(OTP_TOKEN_INFO, Asn1OctetString.class),
+ new ExplicitField(SALT, KerberosString.class),
+ new ExplicitField(S2KPARAMS, Asn1OctetString.class)
+ };
+
+ public PaOtpChallenge() {
+ super(fieldInfos);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/AdInitialVerifiedCas.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/AdInitialVerifiedCas.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/AdInitialVerifiedCas.java
new file mode 100644
index 0000000..ac6d4eb
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/AdInitialVerifiedCas.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.kerberos.kerb.type.pa.pkinit;
+
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceOfType;
+
+/**
+ * AD-INITIAL-VERIFIED-CAS ::= SEQUENCE OF ExternalPrincipalIdentifier
+ */
+public class AdInitialVerifiedCas extends KrbSequenceOfType<ExternalPrincipalIdentifier> {
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/AlgorithmIdentifiers.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/AlgorithmIdentifiers.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/AlgorithmIdentifiers.java
new file mode 100644
index 0000000..a64245a
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/AlgorithmIdentifiers.java
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.pa.pkinit;
+
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceOfType;
+import org.apache.kerby.x509.type.AlgorithmIdentifier;
+
+/**
+ trustedCertifiers SEQUENCE OF AlgorithmIdentifier OPTIONAL,
+ */
+public class AlgorithmIdentifiers extends KrbSequenceOfType<AlgorithmIdentifier> {
+
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/AuthPack.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/AuthPack.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/AuthPack.java
new file mode 100644
index 0000000..c387674
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/AuthPack.java
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.pa.pkinit;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceType;
+import org.apache.kerby.x509.type.SubjectPublicKeyInfo;
+
+/**
+ AuthPack ::= SEQUENCE {
+ pkAuthenticator [0] PKAuthenticator,
+ clientPublicValue [1] SubjectPublicKeyInfo OPTIONAL,
+ supportedCMSTypes [2] SEQUENCE OF AlgorithmIdentifier OPTIONAL,
+ clientDHNonce [3] DHNonce OPTIONAL
+ }
+ */
+public class AuthPack extends KrbSequenceType {
+ private static final int PK_AUTHENTICATOR = 0;
+ private static final int CLIENT_PUBLIC_VALUE = 1;
+ private static final int SUPPORTED_CMS_TYPES = 2;
+ private static final int CLIENT_DH_NONCE = 3;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(PK_AUTHENTICATOR, PkAuthenticator.class),
+ new ExplicitField(CLIENT_PUBLIC_VALUE, SubjectPublicKeyInfo.class),
+ new ExplicitField(SUPPORTED_CMS_TYPES, AlgorithmIdentifiers.class),
+ new ExplicitField(CLIENT_DH_NONCE, DHNonce.class)
+ };
+
+ public AuthPack() {
+ super(fieldInfos);
+ }
+
+ public PkAuthenticator getPkAuthenticator() {
+ return getFieldAs(PK_AUTHENTICATOR, PkAuthenticator.class);
+ }
+
+ public void setPkAuthenticator(PkAuthenticator pkAuthenticator) {
+ setFieldAs(PK_AUTHENTICATOR, pkAuthenticator);
+ }
+
+ public SubjectPublicKeyInfo getClientPublicValue() {
+ return getFieldAs(CLIENT_PUBLIC_VALUE, SubjectPublicKeyInfo.class);
+ }
+
+ public void setClientPublicValue(SubjectPublicKeyInfo clientPublicValue) {
+ setFieldAs(CLIENT_PUBLIC_VALUE, clientPublicValue);
+ }
+
+ public AlgorithmIdentifiers getsupportedCmsTypes() {
+ return getFieldAs(CLIENT_DH_NONCE, AlgorithmIdentifiers.class);
+ }
+
+ public void setsupportedCmsTypes(AlgorithmIdentifiers supportedCMSTypes) {
+ setFieldAs(CLIENT_DH_NONCE, supportedCMSTypes);
+ }
+
+ public DHNonce getClientDhNonce() {
+ return getFieldAs(CLIENT_DH_NONCE, DHNonce.class);
+ }
+
+ public void setClientDhNonce(DHNonce dhNonce) {
+ setFieldAs(CLIENT_DH_NONCE, dhNonce);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/DHNonce.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/DHNonce.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/DHNonce.java
new file mode 100644
index 0000000..e6653b8
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/DHNonce.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.kerberos.kerb.type.pa.pkinit;
+
+import org.apache.kerby.asn1.type.Asn1OctetString;
+
+/**
+ * DHNonce ::= OCTET STRING
+ */
+public class DHNonce extends Asn1OctetString {
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/DHRepInfo.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/DHRepInfo.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/DHRepInfo.java
new file mode 100644
index 0000000..1ca5697
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/DHRepInfo.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.kerberos.kerb.type.pa.pkinit;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.asn1.ImplicitField;
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceType;
+
+/**
+ DHRepInfo ::= SEQUENCE {
+ dhSignedData [0] IMPLICIT OCTET STRING,
+ serverDHNonce [1] DHNonce OPTIONAL
+ }
+ */
+public class DHRepInfo extends KrbSequenceType {
+ private static final int DH_SIGNED_DATA = 0;
+ private static final int SERVER_DH_NONCE = 1;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ImplicitField(DH_SIGNED_DATA, Asn1OctetString.class),
+ new ExplicitField(SERVER_DH_NONCE, DHNonce.class)
+ };
+
+ public DHRepInfo() {
+ super(fieldInfos);
+ }
+
+ public byte[] getDHSignedData() {
+ return getFieldAsOctets(DH_SIGNED_DATA);
+ }
+
+ public void setDHSignedData(byte[] dhSignedData) {
+ setFieldAsOctets(DH_SIGNED_DATA, dhSignedData);
+ }
+
+ public DHNonce getServerDhNonce() {
+ return getFieldAs(SERVER_DH_NONCE, DHNonce.class);
+ }
+
+ public void setServerDhNonce(DHNonce dhNonce) {
+ setFieldAs(SERVER_DH_NONCE, dhNonce);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/ExternalPrincipalIdentifier.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/ExternalPrincipalIdentifier.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/ExternalPrincipalIdentifier.java
new file mode 100644
index 0000000..d686773
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/ExternalPrincipalIdentifier.java
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.kerby.kerberos.kerb.type.pa.pkinit;
+
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1OctetString;
+import org.apache.kerby.asn1.ImplicitField;
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceType;
+
+/**
+ ExternalPrincipalIdentifier ::= SEQUENCE {
+ subjectName [0] IMPLICIT OCTET STRING OPTIONAL,
+ issuerAndSerialNumber [1] IMPLICIT OCTET STRING OPTIONAL,
+ subjectKeyIdentifier [2] IMPLICIT OCTET STRING OPTIONAL
+ }
+ */
+public class ExternalPrincipalIdentifier extends KrbSequenceType {
+ private static final int SUBJECT_NAME = 0;
+ private static final int ISSUER_AND_SERIAL_NUMBER = 1;
+ private static final int SUBJECT_KEY_IDENTIFIER = 2;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ImplicitField(SUBJECT_NAME, Asn1OctetString.class),
+ new ImplicitField(ISSUER_AND_SERIAL_NUMBER, Asn1OctetString.class),
+ new ImplicitField(SUBJECT_KEY_IDENTIFIER, Asn1OctetString.class)
+ };
+
+ public ExternalPrincipalIdentifier() {
+ super(fieldInfos);
+ }
+
+ public byte[] getSubjectName() {
+ return getFieldAsOctets(SUBJECT_NAME);
+ }
+
+ public void setSubjectName(byte[] subjectName) {
+ setFieldAsOctets(SUBJECT_NAME, subjectName);
+ }
+
+ public byte[] getIssuerSerialNumber() {
+ return getFieldAsOctets(ISSUER_AND_SERIAL_NUMBER);
+ }
+
+ public void setIssuerSerialNumber(byte[] issuerSerialNumber) {
+ setFieldAsOctets(ISSUER_AND_SERIAL_NUMBER, issuerSerialNumber);
+ }
+
+ public byte[] getSubjectKeyIdentifier() {
+ return getFieldAsOctets(SUBJECT_KEY_IDENTIFIER);
+ }
+
+ public void setSubjectKeyIdentifier(byte[] subjectKeyIdentifier) {
+ setFieldAsOctets(SUBJECT_KEY_IDENTIFIER, subjectKeyIdentifier);
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8483322e/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/KdcDHKeyInfo.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/KdcDHKeyInfo.java b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/KdcDHKeyInfo.java
new file mode 100644
index 0000000..7437f8d
--- /dev/null
+++ b/kerby-kerb/kerb-core/src/main/java/org/apache/kerby/kerberos/kerb/type/pa/pkinit/KdcDHKeyInfo.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.kerberos.kerb.type.pa.pkinit;
+
+import org.apache.kerby.asn1.type.Asn1BitString;
+import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.type.Asn1Integer;
+import org.apache.kerby.asn1.ExplicitField;
+import org.apache.kerby.kerberos.kerb.type.KerberosTime;
+import org.apache.kerby.kerberos.kerb.type.KrbSequenceType;
+
+/**
+ KDCDHKeyInfo ::= SEQUENCE {
+ subjectPublicKey [0] BIT STRING,
+ nonce [1] INTEGER (0..4294967295),
+ dhKeyExpiration [2] KerberosTime OPTIONAL,
+ }
+ */
+public class KdcDHKeyInfo extends KrbSequenceType {
+ private static final int SUBJECT_PUBLICK_KEY = 0;
+ private static final int NONCE = 1;
+ private static final int DH_KEY_EXPIRATION = 2;
+
+ static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
+ new ExplicitField(SUBJECT_PUBLICK_KEY, Asn1BitString.class),
+ new ExplicitField(NONCE, Asn1Integer.class),
+ new ExplicitField(DH_KEY_EXPIRATION, KerberosTime.class)
+ };
+
+ public KdcDHKeyInfo() {
+ super(fieldInfos);
+ }
+
+ public byte[] getSubjectPublicKey() {
+ return getFieldAsOctets(SUBJECT_PUBLICK_KEY);
+ }
+
+ public void setSubjectPublicKey(byte[] subjectPublicKey) {
+ setFieldAsOctets(SUBJECT_PUBLICK_KEY, subjectPublicKey);
+ }
+
+ public int getNonce() {
+ return getFieldAsInt(NONCE);
+ }
+
+ public void setNonce(int nonce) {
+ setFieldAsInt(NONCE, nonce);
+ }
+}