public class

KerberosTime

extends Object
implements Cloneable
java.lang.Object
   ↳ sun.security.mule.krb5.internal.KerberosTime

Class Overview

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.

Summary

Constants
boolean NOW
boolean UNADJUSTED_NOW
Fields
private static boolean DEBUG
private Config kerberosConfig
private long kerberosTime
private static long syncTime
Public Constructors
KerberosTime(Config kerberosConfig)
KerberosTime(long time, Config kerberosConfig)
KerberosTime(String time, Config kerberosConfig)
KerberosTime(DerValue encoding, Config kerberosConfig)
Constructs a KerberosTime object.
KerberosTime(Date time, Config kerberosConfig)
KerberosTime(boolean initToNow, Config kerConfig)
Public Methods
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, int clockSkew)
boolean greaterThanWRTClockSkew(KerberosTime time)
int hashCode()
boolean inClockSkew(int clockSkew, KerberosTime now)
boolean inClockSkew(KerberosTime time)
boolean inClockSkew(int clockSkew)
boolean inClockSkew()
boolean isZero()
static KerberosTime parse(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(long time)
void setTime(Date time)
Date toDate()
String toGeneralizedTimeString()
Returns a string representation of KerberosTime object.
String toString()
static String zeroPad(String s, int length)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final boolean NOW

Constant Value: true

public static final boolean UNADJUSTED_NOW

Constant Value: false

Fields

private static boolean DEBUG

private Config kerberosConfig

private long kerberosTime

private static long syncTime

Public Constructors

public KerberosTime (Config kerberosConfig)

Parameters
kerberosConfig

public KerberosTime (long time, Config kerberosConfig)

Parameters
time
kerberosConfig

public KerberosTime (String time, Config kerberosConfig)

Parameters
time
kerberosConfig
Throws
Asn1Exception

public KerberosTime (DerValue encoding, Config kerberosConfig)

Constructs a KerberosTime object.

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

public KerberosTime (Date time, Config kerberosConfig)

Parameters
time
kerberosConfig

public KerberosTime (boolean initToNow, Config kerConfig)

Parameters
initToNow
kerConfig

Public Methods

public byte[] asn1Encode ()

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.

public Object clone ()

public boolean equals (Object obj)

Parameters
obj

public static int getDefaultSkew (Config kerberosConfig)

Parameters
kerberosConfig

public int getMicroSeconds ()

public int getSeconds ()

public long getTime ()

public boolean greaterThan (KerberosTime time)

Parameters
time

public boolean greaterThanWRTClockSkew (KerberosTime time, int clockSkew)

Parameters
time
clockSkew

public boolean greaterThanWRTClockSkew (KerberosTime time)

Parameters
time

public int hashCode ()

public boolean inClockSkew (int clockSkew, KerberosTime now)

Parameters
clockSkew
now

public boolean inClockSkew (KerberosTime time)

Parameters
time

public boolean inClockSkew (int clockSkew)

Parameters
clockSkew

public boolean inClockSkew ()

public boolean isZero ()

public static KerberosTime parse (DerInputStream data, byte explicitTag, boolean optional, Config kerberosConfig)

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
kerberosConfig
Returns
  • an instance of KerberosTime.
Throws
Asn1Exception on error.
IOException

public void setMicroSeconds (int usec)

Parameters
usec

public void setMicroSeconds (Integer usec)

Parameters
usec

public void setNow ()

public void setSeconds (int sec)

Parameters
sec

public void setTime (long time)

Parameters
time

public void setTime (Date time)

Parameters
time

public Date toDate ()

public String toGeneralizedTimeString ()

Returns a string representation of KerberosTime object.

Returns
  • a string representation of this object.

public String toString ()

public static String zeroPad (String s, int length)

Parameters
s
length