From 4912253423cb1c182cf42d26502f841f103f83c2 Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Sat, 30 Jan 2010 01:58:19 +0000 Subject: PR classpath/41686 Implement KerberosTicket.getSessionKeyType() 2010-01-30 Andrew John Hughes PR classpath/41686 * javax/security/auth/kerberos/KerberosTicket.java: Fix formatting. (toString()): Add full implementation. (getSessionKeyType()): Implemented. * javax/security/auth/kerberos/KeyImpl.java: (toString()): Implemented. --- ChangeLog | 10 +++++ javax/security/auth/kerberos/KerberosTicket.java | 51 +++++++++++++++++++----- javax/security/auth/kerberos/KeyImpl.java | 9 +++++ 3 files changed, 61 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index bde302af1..c13d9ca18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-01-30 Andrew John Hughes + + PR classpath/41686 + * javax/security/auth/kerberos/KerberosTicket.java: + Fix formatting. + (toString()): Add full implementation. + (getSessionKeyType()): Implemented. + * javax/security/auth/kerberos/KeyImpl.java: + (toString()): Implemented. + 2010-01-30 Andrew John Hughes * autogen.sh: diff --git a/javax/security/auth/kerberos/KerberosTicket.java b/javax/security/auth/kerberos/KerberosTicket.java index 85e253749..ff70b9f4e 100644 --- a/javax/security/auth/kerberos/KerberosTicket.java +++ b/javax/security/auth/kerberos/KerberosTicket.java @@ -54,7 +54,7 @@ import javax.security.auth.Refreshable; * This class represents a Kerberos ticket. See the Kerberos * authentication RFC for more information: * RFC 1510. - * + * * @since 1.4 */ public class KerberosTicket @@ -86,16 +86,16 @@ public class KerberosTicket /** * Create a new ticket given all the facts about it. - * + * * Note that flags may be null or "short"; any flags not specified * will be taken to be false. - * + * * If the key is not renewable, then renewTill may be null. - * + * * If authTime is null, then it is taken to be the same as startTime. - * + * * If clientAddresses is null, then the ticket can be used anywhere. - * + * * @param asn1Encoding the contents of the ticket, as ASN1 * @param client the client principal * @param server the server principal @@ -279,7 +279,7 @@ public class KerberosTicket { return (Date) startTime.clone(); } - + /** * Return the end time for this ticket. */ @@ -287,7 +287,7 @@ public class KerberosTicket { return (Date) endTime.clone(); } - + /** * Return the renewal time for this ticket. For a non-renewable * ticket, this will return null. @@ -334,6 +334,39 @@ public class KerberosTicket public String toString() { - return "FIXME bob"; + return getClass().getName() + + "[client=" + client + + ",server=" + server + + ",sessionKey=" + sessionKey + + ",flags=" + flags + + ",authTime=" + authTime + + ",startTime= " + startTime + + ",endTime=" + endTime + + ",renewTill=" + renewTill + + ",clientAddresses=" + clientAddresses + + "]"; + } + + /** + *

+ * Returns the type of the session key in accordance with + * RFC1510. This usually corresponds to the encryption + * algorithm used by the key, though more than one algorithm + * may use the same key type (e.g. DES with different checksum + * mechanisms and chaining modes). Negative values are reserved + * for local use. Non-negative values are for officially assigned + * type fields. The RFC defines: + *

+ *
    + *
  • 0 — null
  • + *
  • 1 — DES (in CBC mode with either MD4 or MD5 checksums)
  • + *
+ * + * @return the type of session key used by this ticket. + */ + public final int getSessionKeyType() + { + return sessionKey.type; } + } diff --git a/javax/security/auth/kerberos/KeyImpl.java b/javax/security/auth/kerberos/KeyImpl.java index 6773dfa3e..a7cf3d212 100644 --- a/javax/security/auth/kerberos/KeyImpl.java +++ b/javax/security/auth/kerberos/KeyImpl.java @@ -90,4 +90,13 @@ final class KeyImpl implements Serializable, SecretKey // FIXME. return null; } + + public String toString() + { + return getClass().getName() + + "[type=" + type + + ",algorithm=" + algorithm + + "]"; + } + } -- cgit v1.2.1