org.opcfoundation.ua.transport.tcp.impl
Class SecurityToken

java.lang.Object
  extended by org.opcfoundation.ua.transport.tcp.impl.SecurityToken

public class SecurityToken
extends Object

Security Token of a tcp connection


Constructor Summary
SecurityToken(SecurityConfiguration securityProfile, int secureChannelId, int tokenId, long creationTime, long lifetime, ByteString serverNonce, ByteString clientNonce)
          Create new security token.
 
Method Summary
protected  Mac createHmac(byte[] secret)
          createHmac.
 Mac createLocalHmac()
          Create new localHmac
 Mac createRemoteHmac()
          Crate new remoteHmac
 long getCreationTime()
          Getter for the field creationTime.
 long getLifeTime()
          getLifeTime.
 byte[] getLocalEncryptingKey()
          Getter for the field localEncryptingKey.
 byte[] getLocalInitializationVector()
          Getter for the field localInitializationVector.
 ByteString getLocalNonce()
          Getter for the field localNonce.
 byte[] getLocalSigningKey()
          Getter for the field localSigningKey.
 MessageSecurityMode getMessageSecurityMode()
          getMessageSecurityMode.
 byte[] getRemoteEncryptingKey()
          Getter for the field remoteEncryptingKey.
 byte[] getRemoteInitializationVector()
          Getter for the field remoteInitializationVector.
 ByteString getRemoteNonce()
          Getter for the field remoteNonce.
 byte[] getRemoteSigningKey()
          Getter for the field remoteSigningKey.
 long getRenewTime()
          getRenewTime.
 int getSecureChannelId()
          Getter for the field secureChannelId.
 SecurityConfiguration getSecurityConfiguration()
          Getter for the field securityConfiguration.
 SecurityPolicy getSecurityPolicy()
          getSecurityPolicy.
 int getTokenId()
          Getter for the field tokenId.
 boolean isExpired()
          Return security tokens expired status.
 boolean isTimeToRenew()
          Return security token time to renew status.
 boolean isValid()
          Return security token validity.
 void setLocalEncryptingKey(byte[] localEncryptingKey)
          Setter for the field localEncryptingKey.
 void setLocalInitializationVector(byte[] localInitializationVector)
          Setter for the field localInitializationVector.
 void setLocalSigningKey(byte[] localSigningKey)
          Setter for the field localSigningKey.
 void setRemoteEncryptingKey(byte[] remoteEncryptingKey)
          Setter for the field remoteEncryptingKey.
 void setRemoteInitializationVector(byte[] remoteInitializationVector)
          Setter for the field remoteInitializationVector.
 void setRemoteSigningKey(byte[] remoteSigningKey)
          Setter for the field remoteSigningKey.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SecurityToken

public SecurityToken(SecurityConfiguration securityProfile,
                     int secureChannelId,
                     int tokenId,
                     long creationTime,
                     long lifetime,
                     ByteString serverNonce,
                     ByteString clientNonce)
              throws ServiceResultException
Create new security token.

Parameters:
securityProfile - a SecurityConfiguration object.
secureChannelId - a int.
tokenId - a int.
creationTime - a long.
lifetime - a long.
serverNonce - an array of byte.
clientNonce - an array of byte.
Throws:
ServiceResultException - if any.
Method Detail

isValid

public boolean isValid()
Return security token validity. Security token is still valid if it has expired up to 25% after its lifetime. (See Part 6, 5.5.2.1/3)

Returns:
true if less than 125% of tokens life time has elapsed.

isTimeToRenew

public boolean isTimeToRenew()
Return security token time to renew status. True if 75% of security tokens life-time has elapsed.

Returns:
true if 75% of tokens life-time has passed

isExpired

public boolean isExpired()
Return security tokens expired status. Token is expired if its 100% of its life time has elapsed. Note, the token is valid for use until 125% of its life time has passed.

Returns:
true if 100% of security tokens life time has elapsed.

getSecurityPolicy

public SecurityPolicy getSecurityPolicy()

getSecurityPolicy.

Returns:
a SecurityPolicy object.

getSecurityConfiguration

public SecurityConfiguration getSecurityConfiguration()

Getter for the field securityConfiguration.

Returns:
a SecurityConfiguration object.

getMessageSecurityMode

public MessageSecurityMode getMessageSecurityMode()

getMessageSecurityMode.

Returns:
a MessageSecurityMode object.

getLocalSigningKey

public byte[] getLocalSigningKey()

Getter for the field localSigningKey.

Returns:
an array of byte.

setLocalSigningKey

public void setLocalSigningKey(byte[] localSigningKey)

Setter for the field localSigningKey.

Parameters:
localSigningKey - an array of byte.

getLocalEncryptingKey

public byte[] getLocalEncryptingKey()

Getter for the field localEncryptingKey.

Returns:
an array of byte.

setLocalEncryptingKey

public void setLocalEncryptingKey(byte[] localEncryptingKey)

Setter for the field localEncryptingKey.

Parameters:
localEncryptingKey - an array of byte.

getLocalInitializationVector

public byte[] getLocalInitializationVector()

Getter for the field localInitializationVector.

Returns:
an array of byte.

setLocalInitializationVector

public void setLocalInitializationVector(byte[] localInitializationVector)

Setter for the field localInitializationVector.

Parameters:
localInitializationVector - an array of byte.

getRemoteSigningKey

public byte[] getRemoteSigningKey()

Getter for the field remoteSigningKey.

Returns:
an array of byte.

setRemoteSigningKey

public void setRemoteSigningKey(byte[] remoteSigningKey)

Setter for the field remoteSigningKey.

Parameters:
remoteSigningKey - an array of byte.

getRemoteEncryptingKey

public byte[] getRemoteEncryptingKey()

Getter for the field remoteEncryptingKey.

Returns:
an array of byte.

setRemoteEncryptingKey

public void setRemoteEncryptingKey(byte[] remoteEncryptingKey)

Setter for the field remoteEncryptingKey.

Parameters:
remoteEncryptingKey - an array of byte.

getRemoteInitializationVector

public byte[] getRemoteInitializationVector()

Getter for the field remoteInitializationVector.

Returns:
an array of byte.

setRemoteInitializationVector

public void setRemoteInitializationVector(byte[] remoteInitializationVector)

Setter for the field remoteInitializationVector.

Parameters:
remoteInitializationVector - an array of byte.

createRemoteHmac

public Mac createRemoteHmac()
                     throws ServiceResultException
Crate new remoteHmac

Returns:
hmac
Throws:
ServiceResultException - if any.

createLocalHmac

public Mac createLocalHmac()
                    throws ServiceResultException
Create new localHmac

Returns:
hmac
Throws:
ServiceResultException - if any.

createHmac

protected Mac createHmac(byte[] secret)
                  throws ServiceResultException

createHmac.

Parameters:
secret - an array of byte.
Returns:
a Mac object.
Throws:
ServiceResultException - if any.

getLocalNonce

public ByteString getLocalNonce()

Getter for the field localNonce.

Returns:
an array of byte.

getRemoteNonce

public ByteString getRemoteNonce()

Getter for the field remoteNonce.

Returns:
an array of byte.

getSecureChannelId

public int getSecureChannelId()

Getter for the field secureChannelId.

Returns:
a int.

getTokenId

public int getTokenId()

Getter for the field tokenId.

Returns:
a int.

getCreationTime

public long getCreationTime()

Getter for the field creationTime.

Returns:
a long.

getLifeTime

public long getLifeTime()

getLifeTime.

Returns:
a long.

getRenewTime

public long getRenewTime()

getRenewTime.

Returns:
a long.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2018. All rights reserved.