Class KerberosCredMessage

  • All Implemented Interfaces:

    public final class KerberosCredMessage
    extends Object
    implements Destroyable
    This class encapsulates a Kerberos 5 KRB_CRED message which can be used to send Kerberos credentials from one principal to another.

    A KRB_CRED message is defined in Section 5.8.1 of the Kerberos Protocol Specification (RFC 4120) as:

        KRB-CRED        ::= [APPLICATION 22] SEQUENCE {
                pvno            [0] INTEGER (5),
                msg-type        [1] INTEGER (22),
                tickets         [2] SEQUENCE OF Ticket,
                enc-part        [3] EncryptedData -- EncKrbCredPart
    • Constructor Detail

      • KerberosCredMessage

        public KerberosCredMessage​(KerberosPrincipal sender,
                                   KerberosPrincipal recipient,
                                   byte[] message)
        Constructs a KerberosCredMessage object.

        The contents of the message argument are copied; subsequent modification of the byte array does not affect the newly created object.

        sender - the sender of the message
        recipient - the recipient of the message
        message - the DER encoded KRB_CRED message
        NullPointerException - if any of sender, recipient or message is null
    • Method Detail

      • getEncoded

        public byte[] getEncoded()
        Returns the DER encoded form of the KRB_CRED message.
        a newly allocated byte array that contains the encoded form
        IllegalStateException - if the object is destroyed
      • destroy

        public void destroy()
        Destroys this object by clearing out the message.
        Specified by:
        destroy in interface Destroyable
      • toString

        public String toString()
        Returns an informative textual representation of this KerberosCredMessage.
        toString in class Object
        an informative textual representation of this KerberosCredMessage.
      • equals

        public boolean equals​(Object other)
        Compares the specified object with this KerberosCredMessage for equality. Returns true if the given object is also a KerberosCredMessage and the two KerberosCredMessage instances are equivalent. More formally two KerberosCredMessage instances are equal if they have equal sender, recipient, and encoded KRB_CRED messages. A destroyed KerberosCredMessage object is only equal to itself.
        equals in class Object
        other - the object to compare to
        true if the specified object is equal to this KerberosCredMessage, false otherwise.
        See Also:
        Object.hashCode(), HashMap