sun.security.mule.krb5.internal
Class KerberosTime

java.lang.Object
  extended by sun.security.mule.krb5.internal.KerberosTime
All Implemented Interfaces:
Cloneable

public class KerberosTime
extends Object
implements Cloneable

Implements the ASN.1 KerberosTime type.

KerberosTime ::= GeneralizedTime -- with no fractional seconds The timestamps used in Kerberos are encoded as GeneralizedTimes. A KerberosTime value shall not include any fractional portions of the seconds. As required by the DER, it further shall not include any separators, and it shall specify the UTC time zone (Z).

This definition reflects the Network Working Group RFC 4120 specification available at http://www.ietf.org/rfc/rfc4120.txt.


Field Summary
static boolean NOW
           
static boolean UNADJUSTED_NOW
           
 
Constructor Summary
KerberosTime(boolean initToNow, Config kerConfig)
           
KerberosTime(Config kerberosConfig)
           
KerberosTime(Date time, Config kerberosConfig)
           
KerberosTime(sun.security.util.DerValue encoding, Config kerberosConfig)
          Constructs a KerberosTime object.
KerberosTime(long time, Config kerberosConfig)
           
KerberosTime(String time, Config kerberosConfig)
           
 
Method Summary
 byte[] asn1Encode()
          Encodes this object to a byte array.
 Object clone()
           
 boolean equals(Object obj)
           
static int getDefaultSkew(Config kerberosConfig)
           
 int getMicroSeconds()
           
 int getSeconds()
           
 long getTime()
           
 boolean greaterThan(KerberosTime time)
           
 boolean greaterThanWRTClockSkew(KerberosTime time)
           
 boolean greaterThanWRTClockSkew(KerberosTime time, int clockSkew)
           
 int hashCode()
           
 boolean inClockSkew()
           
 boolean inClockSkew(int clockSkew)
           
 boolean inClockSkew(int clockSkew, KerberosTime now)
           
 boolean inClockSkew(KerberosTime time)
           
 boolean isZero()
           
static KerberosTime parse(sun.security.util.DerInputStream data, byte explicitTag, boolean optional, Config kerberosConfig)
          Parse (unmarshal) a kerberostime from a DER input stream.
 void setMicroSeconds(int usec)
           
 void setMicroSeconds(Integer usec)
           
 void setNow()
           
 void setSeconds(int sec)
           
 void setTime(Date time)
           
 void setTime(long time)
           
 Date toDate()
           
 String toGeneralizedTimeString()
          Returns a string representation of KerberosTime object.
 String toString()
           
static String zeroPad(String s, int length)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NOW

public static final boolean NOW
See Also:
Constant Field Values

UNADJUSTED_NOW

public static final boolean UNADJUSTED_NOW
See Also:
Constant Field Values
Constructor Detail

KerberosTime

public KerberosTime(Config kerberosConfig)

KerberosTime

public KerberosTime(long time,
                    Config kerberosConfig)

KerberosTime

public KerberosTime(String time,
                    Config kerberosConfig)
             throws Asn1Exception
Throws:
Asn1Exception

KerberosTime

public KerberosTime(sun.security.util.DerValue encoding,
                    Config kerberosConfig)
             throws Asn1Exception,
                    IOException
Constructs a KerberosTime object.

Parameters:
encoding - a DER-encoded data.
Throws:
Asn1Exception - if an error occurs while decoding an ASN1 encoded data.
IOException - if an I/O error occurs while reading encoded data.

KerberosTime

public KerberosTime(Date time,
                    Config kerberosConfig)

KerberosTime

public KerberosTime(boolean initToNow,
                    Config kerConfig)
Method Detail

clone

public Object clone()
Overrides:
clone in class Object

zeroPad

public static String zeroPad(String s,
                             int length)

toGeneralizedTimeString

public String toGeneralizedTimeString()
Returns a string representation of KerberosTime object.

Returns:
a string representation of this object.

asn1Encode

public byte[] asn1Encode()
                  throws Asn1Exception,
                         IOException
Encodes this object to a byte array.

Returns:
a byte array of encoded data.
Throws:
Asn1Exception - if an error occurs while decoding an ASN1 encoded data.
IOException - if an I/O error occurs while reading encoded data.

getTime

public long getTime()

setTime

public void setTime(Date time)

setTime

public void setTime(long time)

toDate

public Date toDate()

setNow

public void setNow()

getMicroSeconds

public int getMicroSeconds()

setMicroSeconds

public void setMicroSeconds(int usec)

setMicroSeconds

public void setMicroSeconds(Integer usec)

inClockSkew

public boolean inClockSkew(int clockSkew)

inClockSkew

public boolean inClockSkew()

inClockSkew

public boolean inClockSkew(int clockSkew,
                           KerberosTime now)

inClockSkew

public boolean inClockSkew(KerberosTime time)

greaterThanWRTClockSkew

public boolean greaterThanWRTClockSkew(KerberosTime time,
                                       int clockSkew)

greaterThanWRTClockSkew

public boolean greaterThanWRTClockSkew(KerberosTime time)

greaterThan

public boolean greaterThan(KerberosTime time)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isZero

public boolean isZero()

getSeconds

public int getSeconds()

setSeconds

public void setSeconds(int sec)

parse

public static KerberosTime parse(sun.security.util.DerInputStream data,
                                 byte explicitTag,
                                 boolean optional,
                                 Config kerberosConfig)
                          throws Asn1Exception,
                                 IOException
Parse (unmarshal) a kerberostime from a DER input stream. This form parsing might be used when expanding a value which is part of a constructed sequence and uses explicitly tagged type.

Parameters:
data - the Der input stream value, which contains one or more marshaled value.
explicitTag - tag number.
optional - indicates if this data field is optional
Returns:
an instance of KerberosTime.
Throws:
Asn1Exception - on error.
IOException

getDefaultSkew

public static int getDefaultSkew(Config kerberosConfig)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.