|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection java.util.AbstractList java.util.ArrayList codec.asn1.ASN1AbstractCollection codec.asn1.ASN1Sequence de.fhg.igd.atlas.lsp.LSPRegisterEncoded
Represents an LSP_RegisterEncoded structure of the Location Service
Protocol (LSP).
Encapsulated in a LSPRequest
it is sent to the Location
Service Server (LSServer
)
to update or delete an entry. If successful, the LSPReply
message has the result state ACKNOWLEDGE
. This class is
normally used by the Location Sevice Client
(LSClient
) to send an
encoded register messages to update or delete an entry. Initialization
of new entries is not possible with this request!
The ASN.1 structure of this request is as follows
The implicit name is the unique identifier of an mobile object for instance the hashcode of its static part. The contact address should consist of a URL string that specifies the protocol, address, and port of a management service provided by the server, which is in possession of the specified object. The current cookie is used as authorisation mechanism by the LS-Server and LS-Proxy permitting aLSP_RegisterEncoded ::= SEQUENCE { implicitName ImplicitName, contactaddress ContactAddress, encodedNewCookie EncodedData, mac EncodedData } ImplicitName ::= OCTET STRING ContactAddress ::= OCTET STRING EncodedData ::= OCTET STRING
LSClient
to update or delete an existing entry. The new
cookie represents the authorisation code for the next registration.
To distinguish between initialization, update and deletion a special
NULL_COOKIE
is used as follows:
if (currentCookie == NULL_COOKIE)
{ Initialization (not available withLSPRegisterEncoded
) }
if (newCookie == NULL_COOKIE)
{ Delete the existing entry }otherwise update the existing entry
LSPRegisterPlain
,
LSPRequest
,
LSPReply
,
Serialized FormNested Class Summary |
Nested classes inherited from class java.util.AbstractList |
|
Field Summary | |
protected ASN1OctetString |
contactAddress_
The contact address of this request. |
protected byte[] |
currentCookie_
The plain current Cookie. |
protected ASN1OctetString |
encodedNewCookie_
The encoded cookie of this request. |
protected ASN1OctetString |
implicitName_
The implicit name of this request. |
protected boolean |
integrity_
The integrity flag for this request. |
static String |
MAC
The MAC algorithm used for checking the integrity of the message data. |
protected ASN1OctetString |
mac_
The message authentification code of this Request used for verifying the integrity of the message. |
protected byte[] |
newCookie_
The plain new Cookie. |
Fields inherited from class codec.asn1.ASN1AbstractCollection |
|
Fields inherited from class java.util.ArrayList |
|
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary | |
LSPRegisterEncoded()
Creates an instance ready for decoding. |
|
LSPRegisterEncoded(byte[] implicitName,
URL contactAddress,
byte[] newCookie,
byte[] currentCookie)
Creates an instance with the given parameters implicit name, contact address, new cookie and current cookie. |
|
LSPRegisterEncoded(LSPRegisterPlain registerPlain)
Creates an instance with the parameters of the given LSPRegisterPlain request. |
Method Summary | |
protected byte[] |
calculateXOR(byte[] b1,
byte[] b2)
Calculates the bitwise XOR of two byte arrays and returns the resulting byte array, or byte[0] if the given byte arrays don't
have the same length. |
boolean |
checkIntegrity()
Returns the integrity flag of this request |
static LSPRegisterEncoded |
createRequest(byte[] code)
Creates a new request from the given encoded request. |
protected byte[] |
generateMac(byte[] implicitName,
URL contactAddress,
byte[] newCookie,
byte[] currentCookie)
Generates the message authentification code for the given parameters implicit name, contact address and new cookie using the current cookie as initialization key for the MAC-Algorithm as follows. |
protected byte[] |
generateMac(LSPRegisterPlain registerPlain)
Generates the message authentification code for the parameters of the given plain register request as follows. |
URL |
getContactAddress()
Returns the contact address or an empty URL, if the encoded contact address is not well-formed. |
byte[] |
getCurrentCookie()
Returns the current cookie, if the integrity check has been successful ( checkIntegrity()==true ),
null otherwise. |
byte[] |
getEncoded()
Returns the DER encoded request with encoded new cookie and integrated message authentification code. |
byte[] |
getImplicitName()
Returns the implicit name. |
byte[] |
getNewCookie()
Returns the new cookie, if the integrity check has been successful ( checkIntegrity()==true ),
null otherwise. |
boolean |
runIntegrityTest(byte[] currentCookie)
Decodes the new cookie, runs the integrity test and returns true if the integrity of the
request could have been proved, false otherwise. |
String |
toString()
Returns the string representation of this request as LSPPlainRegister structure, if the
integrity check has been successful,
an errormessage, otherwise. |
Methods inherited from class codec.asn1.ASN1Sequence |
getTag |
Methods inherited from class codec.asn1.ASN1AbstractCollection |
checkConstraints, decode, encode, getCollection, getConstraint, getTagClass, getValue, isExplicit, isOptional, isType, setConstraint, setExplicit, setOptional |
Methods inherited from class java.util.ArrayList |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
equals, hashCode, iterator, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
containsAll, remove, removeAll, retainAll |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Methods inherited from interface java.util.List |
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList |
Field Detail |
public static final String MAC
protected ASN1OctetString implicitName_
protected ASN1OctetString contactAddress_
protected ASN1OctetString encodedNewCookie_
protected ASN1OctetString mac_
protected boolean integrity_
protected byte[] newCookie_
protected byte[] currentCookie_
Constructor Detail |
public LSPRegisterEncoded()
public LSPRegisterEncoded(byte[] implicitName, URL contactAddress, byte[] newCookie, byte[] currentCookie) throws GeneralSecurityException
implicitName
- The implicit name.contactAddress
- The contact address.newCookie
- The new cookie.currentCookie
- The current cookie
GeneralSecurityException
- if an error occurs while
generating the message authentification code.public LSPRegisterEncoded(LSPRegisterPlain registerPlain) throws GeneralSecurityException, NullPointerException
LSPRegisterPlain
request.
Furthermore the new cookie is encoded
and the message authentification code is
generated to enable an integrity check.
registerPlain
- The LSPRegisterPlain
structure.
GeneralSecurityException,
- if an error occurs while
generating the message authentification code.
NullPointerException,
- if registerPlain
is null
(RuntimeException).
GeneralSecurityException
NullPointerException
Method Detail |
public static LSPRegisterEncoded createRequest(byte[] code) throws CorruptedCodeException, IllegalStateException, NullPointerException
runIntegrityTest
code
- The encoded request.
CorruptedCodeException
- if the code is bad.
IllegalStateException
- if an error occurs
while decoding with DERDecoder
(RuntimeException).
NullPointerException
- if code
is null
(RuntimeException).public boolean runIntegrityTest(byte[] currentCookie) throws GeneralSecurityException
true
if the integrity of the
request could have been proved, false
otherwise.
To do this the current cookie, which is associated to
the implicit name, has to be specified by the caller.
(The implicit name of the request can be received as
result of getImplicitName
)
currentCookie
- The currentCookie.
GeneralSecurityException
- if an error occurs while
verifying the message authentification code.protected byte[] generateMac(LSPRegisterPlain registerPlain) throws GeneralSecurityException
MAC(currentCookie) [ implicitName | contactAddress | newCookie ]
registerPlain
- The LSPRegisterPlain
structure.
GeneralSecurityException
- if an error occurs while
generating the message authentification code.protected byte[] generateMac(byte[] implicitName, URL contactAddress, byte[] newCookie, byte[] currentCookie) throws GeneralSecurityException
MAC(currentCookie) [ newCookie | implicitName | contactAddress ]
implicitName
- The implicit name.contactAddress
- The contact address.newCookie
- The new cookie.currentCookie
- The current cookie
GeneralSecurityException
- if an error occurs while
generating the message authentification code.protected byte[] calculateXOR(byte[] b1, byte[] b2)
byte[0]
if the given byte arrays don't
have the same length.
public boolean checkIntegrity()
public byte[] getImplicitName()
getImplicitName
in interface LSPRegister
public URL getContactAddress()
getContactAddress
in interface LSPRegister
public byte[] getNewCookie()
checkIntegrity()==true
),
null
otherwise.
getNewCookie
in interface LSPRegister
public byte[] getCurrentCookie()
checkIntegrity()==true
),
null
otherwise.
getCurrentCookie
in interface LSPRegister
public byte[] getEncoded() throws IllegalStateException
IllegalStateException
- if an exception occures
during ASN1 encoding (RuntimeException).public String toString()
LSPPlainRegister
structure, if the
integrity check has been successful,
an errormessage, otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |