org.ws4d.java.security
Interface SecurityManager


public interface SecurityManager

The SecurityManager manages many aspects of the security implementation.


Field Summary
static java.lang.String bodyPartID
           
 
Method Summary
 byte[] decode(java.lang.String base64enc)
          decodes a base64 encoded String
 java.lang.String encode(byte[] raw)
          encodes a byteArray
 java.lang.String getAliasFromBinding(CommunicationBinding binding)
          This method will return the alias that belongs to the binding, if the the HTTPBinding is a HTTPSBinding
 java.lang.String getBodySignature(XmlSerializer serial, Message msg)
          getBodySignature generates the signature for the xml data supplied WARNING: Do not call this method before completion of the body part
 java.lang.Object getCertificate(java.lang.String certAlias)
          getCertificate
 java.lang.Object[] getKeyManagers()
           
 long getMD5Hash(java.lang.String str)
          getMD5Hash returns the MD5 hash of the given string
 XmlSerializer getNewCanonicalSerializer(java.lang.String id)
          getNewCanonicalSerializer
 java.lang.Object getPrivateKey(java.lang.String privKey, java.lang.String pswd)
          getPrivateKey
 java.lang.Object[] getTrustManagers()
           
 boolean isHTTPS(URI uri)
           
 boolean validateMessage(byte[] signature, ProtocolData pd, EndpointReference epr, java.lang.String[] aliasCandidates)
          validateMessage
 java.io.InputStream wrapInputStream(java.io.InputStream in, ProtocolData pd)
          wraps the supplied InputStream with an instance of IDawareInputStream
 

Field Detail

bodyPartID

static final java.lang.String bodyPartID
See Also:
Constant Field Values
Method Detail

getBodySignature

java.lang.String getBodySignature(XmlSerializer serial,
                                  Message msg)
getBodySignature generates the signature for the xml data supplied WARNING: Do not call this method before completion of the body part

Parameters:
serial - the (canonical) serializer that works with the messages to be signed.
msg - the message to sign
Returns:
the calculated signature

getPrivateKey

java.lang.Object getPrivateKey(java.lang.String privKey,
                               java.lang.String pswd)
getPrivateKey

Parameters:
privKey - the alias of the private key in the java keystore.
pswd - the password to access the private key
Returns:
a PrivateKey object

validateMessage

boolean validateMessage(byte[] signature,
                        ProtocolData pd,
                        EndpointReference epr,
                        java.lang.String[] aliasCandidates)
validateMessage

Parameters:
signature - the signature delivered with the message
pd - the protocol data instance belonging to the message to be validated
uuid - the EndpointReference of the source device/service
xaddresses - of the source device/Service
Returns:
True if validation was successful. False otherwise.

getCertificate

java.lang.Object getCertificate(java.lang.String certAlias)
getCertificate

Parameters:
certAlias - the alias of the certificate in the java keystore.
Returns:
a Certificate object

wrapInputStream

java.io.InputStream wrapInputStream(java.io.InputStream in,
                                    ProtocolData pd)
wraps the supplied InputStream with an instance of IDawareInputStream

Parameters:
in -
Returns:
a BodyBufferInputStream object wrapping the Input Stream

getNewCanonicalSerializer

XmlSerializer getNewCanonicalSerializer(java.lang.String id)
getNewCanonicalSerializer

Parameters:
id - the id of the part that will be signed/canonicalized
Returns:
a new CanonicalSerializer instance.

getMD5Hash

long getMD5Hash(java.lang.String str)
getMD5Hash returns the MD5 hash of the given string


decode

byte[] decode(java.lang.String base64enc)
decodes a base64 encoded String

Parameters:
base64enc -
Returns:
the decoded string as byte array

encode

java.lang.String encode(byte[] raw)
encodes a byteArray

Parameters:
the - raw byte array
Returns:
the encoded String

getTrustManagers

java.lang.Object[] getTrustManagers()
                                    throws java.io.IOException,
                                           java.lang.Exception
Returns:
the TrustManagers from the TrustStore specified in the properties file.
Throws:
java.io.IOException
java.lang.Exception

getKeyManagers

java.lang.Object[] getKeyManagers()
                                  throws java.io.IOException,
                                         java.lang.Exception
Returns:
the KeyManagers from the KeyStore specified in the properties file.
Throws:
java.io.IOException
java.lang.Exception

getAliasFromBinding

java.lang.String getAliasFromBinding(CommunicationBinding binding)
This method will return the alias that belongs to the binding, if the the HTTPBinding is a HTTPSBinding

Parameters:
binding -
Returns:
the alias that belongs to the binding

isHTTPS

boolean isHTTPS(URI uri)
Parameters:
uri -
Returns:
true if the URI starts with "https"