org.apache.rahas
Class TrustUtil

java.lang.Object
  extended by org.apache.rahas.TrustUtil

public class TrustUtil
extends java.lang.Object


Constructor Summary
TrustUtil()
           
 
Method Summary
static org.apache.axiom.om.OMElement createAppliesToElement(org.apache.axiom.om.OMElement parent, java.lang.String address, java.lang.String addressingNs)
           
static org.apache.axiom.om.OMElement createBinarySecretElement(int version, org.apache.axiom.om.OMElement parent, java.lang.String type)
           
static org.apache.axiom.om.OMElement createCancelRequest(java.lang.String tokenId, int version)
           
static org.apache.axiom.om.OMElement createCancelTargetElement(int version, org.apache.axiom.om.OMElement parent)
           
static org.apache.axiom.om.OMElement createClaims(int version, org.apache.axiom.om.OMElement parent, java.lang.String dialect)
           
static org.apache.axiom.om.OMElement createComputedKeyAlgorithm(int version, org.apache.axiom.om.OMElement parent, java.lang.String algoId)
           
static org.apache.axiom.om.OMElement createComputedKeyElement(int version, org.apache.axiom.om.OMElement parent)
           
static org.apache.axiom.om.OMElement createEntropyElement(int version, org.apache.axiom.om.OMElement parent)
           
static org.apache.axiom.om.OMElement createKeySizeElement(int version, org.apache.axiom.om.OMElement parent, int size)
           
static org.apache.axiom.om.OMElement createKeyTypeElement(int version, org.apache.axiom.om.OMElement parent, java.lang.String type)
           
static org.apache.axiom.om.OMElement createLifetimeElement(int version, org.apache.axiom.om.OMElement parent, long ttl)
           
static org.apache.axiom.om.OMElement createLifetimeElement(int version, org.apache.axiom.om.OMElement parent, java.lang.String created, java.lang.String expires)
           
static org.apache.axiom.om.OMElement createRenewTargetElement(int version, org.apache.axiom.om.OMElement parent, org.apache.axiom.om.OMElement str)
           
static org.apache.axiom.om.OMElement createRequestedAttachedRef(int version, org.apache.axiom.om.OMElement parent, java.lang.String refUri, java.lang.String refValueType)
           
static org.apache.axiom.om.OMElement createRequestedProofTokenElement(int version, org.apache.axiom.om.OMElement parent)
           
static org.apache.axiom.om.OMElement createRequestedSecurityTokenElement(int version, org.apache.axiom.om.OMElement parent)
           
static org.apache.axiom.om.OMElement createRequestedTokenCanceledElement(int version, org.apache.axiom.om.OMElement parent)
           
static org.apache.axiom.om.OMElement createRequestedUnattachedRef(int version, org.apache.axiom.om.OMElement parent, java.lang.String refUri, java.lang.String refValueType)
           
static org.apache.axiom.om.OMElement createRequestSecurityTokenElement(int version)
           
static org.apache.axiom.om.OMElement createRequestSecurityTokenResponseCollectionElement(int version, org.apache.axiom.om.OMElement parent)
           
static org.apache.axiom.om.OMElement createRequestSecurityTokenResponseElement(int version, org.apache.axiom.om.OMElement parent)
           
static org.apache.axiom.om.OMElement createRequestTypeElement(int version, org.apache.axiom.om.OMElement parent, java.lang.String value)
           
static org.w3c.dom.Element createSecurityTokenReference(org.w3c.dom.Document doc, java.lang.String refUri, java.lang.String refValueType)
          Create a wsse:Reference element with the given URI and the value type
static org.apache.axiom.soap.SOAPEnvelope createSOAPEnvelope(java.lang.String nsUri)
          Create a new SOAPEnvelope of the same version as the SOAPEnvelope in the given MessageContext
static org.apache.axiom.om.OMElement createTokenTypeElement(int version, org.apache.axiom.om.OMElement parent)
           
static org.apache.axiom.om.OMElement createValidateTargetElement(int version, org.apache.axiom.om.OMElement parent, org.apache.axiom.om.OMElement str)
           
protected  byte[] generateEphemeralKey(byte[] reqEnt, byte[] respEnt, java.lang.String algo, int keySize)
          Create an ephemeral key
protected  byte[] generateEphemeralKey(int keySize)
          Create an ephemeral key
static java.lang.String getActionValue(int version, java.lang.String action)
           
static TokenStorage getTokenStore(org.apache.axis2.context.ConfigurationContext ctx)
          Fetches the token storage from the configuration context.
static TokenStorage getTokenStore(org.apache.axis2.context.MessageContext msgCtx)
          Returns the token store.
static java.lang.String getWSTNamespace(int version)
           
static int getWSTVersion(java.lang.String ns)
           
static java.util.Properties toProperties(org.apache.axiom.om.OMElement cryptoElem)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrustUtil

public TrustUtil()
Method Detail

createSecurityTokenReference

public static org.w3c.dom.Element createSecurityTokenReference(org.w3c.dom.Document doc,
                                                               java.lang.String refUri,
                                                               java.lang.String refValueType)
Create a wsse:Reference element with the given URI and the value type

Parameters:
doc -
refUri -
refValueType -
Returns:
Element

createRequestSecurityTokenResponseElement

public static org.apache.axiom.om.OMElement createRequestSecurityTokenResponseElement(int version,
                                                                                      org.apache.axiom.om.OMElement parent)
                                                                               throws TrustException
Throws:
TrustException

createRequestSecurityTokenResponseCollectionElement

public static org.apache.axiom.om.OMElement createRequestSecurityTokenResponseCollectionElement(int version,
                                                                                                org.apache.axiom.om.OMElement parent)
                                                                                         throws TrustException
Throws:
TrustException

createRequestedSecurityTokenElement

public static org.apache.axiom.om.OMElement createRequestedSecurityTokenElement(int version,
                                                                                org.apache.axiom.om.OMElement parent)
                                                                         throws TrustException
Throws:
TrustException

createRequestSecurityTokenElement

public static org.apache.axiom.om.OMElement createRequestSecurityTokenElement(int version)
                                                                       throws TrustException
Throws:
TrustException

createRequestedProofTokenElement

public static org.apache.axiom.om.OMElement createRequestedProofTokenElement(int version,
                                                                             org.apache.axiom.om.OMElement parent)
                                                                      throws TrustException
Throws:
TrustException

createEntropyElement

public static org.apache.axiom.om.OMElement createEntropyElement(int version,
                                                                 org.apache.axiom.om.OMElement parent)
                                                          throws TrustException
Throws:
TrustException

createComputedKeyElement

public static org.apache.axiom.om.OMElement createComputedKeyElement(int version,
                                                                     org.apache.axiom.om.OMElement parent)
                                                              throws TrustException
Throws:
TrustException

createRequestTypeElement

public static org.apache.axiom.om.OMElement createRequestTypeElement(int version,
                                                                     org.apache.axiom.om.OMElement parent,
                                                                     java.lang.String value)
                                                              throws TrustException
Throws:
TrustException

createTokenTypeElement

public static org.apache.axiom.om.OMElement createTokenTypeElement(int version,
                                                                   org.apache.axiom.om.OMElement parent)
                                                            throws TrustException
Throws:
TrustException

createValidateTargetElement

public static org.apache.axiom.om.OMElement createValidateTargetElement(int version,
                                                                        org.apache.axiom.om.OMElement parent,
                                                                        org.apache.axiom.om.OMElement str)
                                                                 throws TrustException
Throws:
TrustException

createRenewTargetElement

public static org.apache.axiom.om.OMElement createRenewTargetElement(int version,
                                                                     org.apache.axiom.om.OMElement parent,
                                                                     org.apache.axiom.om.OMElement str)
                                                              throws TrustException
Throws:
TrustException

createBinarySecretElement

public static org.apache.axiom.om.OMElement createBinarySecretElement(int version,
                                                                      org.apache.axiom.om.OMElement parent,
                                                                      java.lang.String type)
                                                               throws TrustException
Throws:
TrustException

createComputedKeyAlgorithm

public static org.apache.axiom.om.OMElement createComputedKeyAlgorithm(int version,
                                                                       org.apache.axiom.om.OMElement parent,
                                                                       java.lang.String algoId)
                                                                throws TrustException
Throws:
TrustException

createRequestedUnattachedRef

public static org.apache.axiom.om.OMElement createRequestedUnattachedRef(int version,
                                                                         org.apache.axiom.om.OMElement parent,
                                                                         java.lang.String refUri,
                                                                         java.lang.String refValueType)
                                                                  throws TrustException
Throws:
TrustException

createRequestedAttachedRef

public static org.apache.axiom.om.OMElement createRequestedAttachedRef(int version,
                                                                       org.apache.axiom.om.OMElement parent,
                                                                       java.lang.String refUri,
                                                                       java.lang.String refValueType)
                                                                throws TrustException
Throws:
TrustException

createKeySizeElement

public static org.apache.axiom.om.OMElement createKeySizeElement(int version,
                                                                 org.apache.axiom.om.OMElement parent,
                                                                 int size)
                                                          throws TrustException
Throws:
TrustException

createKeyTypeElement

public static org.apache.axiom.om.OMElement createKeyTypeElement(int version,
                                                                 org.apache.axiom.om.OMElement parent,
                                                                 java.lang.String type)
                                                          throws TrustException
Throws:
TrustException

createRequestedTokenCanceledElement

public static org.apache.axiom.om.OMElement createRequestedTokenCanceledElement(int version,
                                                                                org.apache.axiom.om.OMElement parent)
                                                                         throws TrustException
Throws:
TrustException

createLifetimeElement

public static org.apache.axiom.om.OMElement createLifetimeElement(int version,
                                                                  org.apache.axiom.om.OMElement parent,
                                                                  java.lang.String created,
                                                                  java.lang.String expires)
                                                           throws TrustException
Throws:
TrustException

createLifetimeElement

public static org.apache.axiom.om.OMElement createLifetimeElement(int version,
                                                                  org.apache.axiom.om.OMElement parent,
                                                                  long ttl)
                                                           throws TrustException
Throws:
TrustException

createAppliesToElement

public static org.apache.axiom.om.OMElement createAppliesToElement(org.apache.axiom.om.OMElement parent,
                                                                   java.lang.String address,
                                                                   java.lang.String addressingNs)

getActionValue

public static java.lang.String getActionValue(int version,
                                              java.lang.String action)
                                       throws TrustException
Throws:
TrustException

createSOAPEnvelope

public static org.apache.axiom.soap.SOAPEnvelope createSOAPEnvelope(java.lang.String nsUri)
Create a new SOAPEnvelope of the same version as the SOAPEnvelope in the given MessageContext

Parameters:
nsUri -
Returns:
SOAPEnvelope

getWSTNamespace

public static java.lang.String getWSTNamespace(int version)
                                        throws TrustException
Throws:
TrustException

getWSTVersion

public static int getWSTVersion(java.lang.String ns)
                         throws TrustException
Throws:
TrustException

getTokenStore

public static TokenStorage getTokenStore(org.apache.axis2.context.MessageContext msgCtx)
Returns the token store. If the token store is already available in the configuration context then fetch it and return it. If not create a new one, hook it up in the configuration context and return it

Parameters:
msgCtx -
Returns:
the token store

getTokenStore

public static TokenStorage getTokenStore(org.apache.axis2.context.ConfigurationContext ctx)
Fetches the token storage from the configuration context. If the token store is already available in the configuration context then fetch it and return it. If not create a new one, hook it up in the configuration context and return it

Parameters:
ctx -
Returns:

generateEphemeralKey

protected byte[] generateEphemeralKey(int keySize)
                               throws TrustException
Create an ephemeral key

Returns:
The generated ephemeral key
Throws:
TrustException

generateEphemeralKey

protected byte[] generateEphemeralKey(byte[] reqEnt,
                                      byte[] respEnt,
                                      java.lang.String algo,
                                      int keySize)
                               throws TrustException
Create an ephemeral key

Returns:
The generated ephemeral key
Throws:
TrustException

createCancelTargetElement

public static org.apache.axiom.om.OMElement createCancelTargetElement(int version,
                                                                      org.apache.axiom.om.OMElement parent)
                                                               throws TrustException
Throws:
TrustException

createClaims

public static org.apache.axiom.om.OMElement createClaims(int version,
                                                         org.apache.axiom.om.OMElement parent,
                                                         java.lang.String dialect)
                                                  throws TrustException
Throws:
TrustException

createCancelRequest

public static org.apache.axiom.om.OMElement createCancelRequest(java.lang.String tokenId,
                                                                int version)
                                                         throws TrustException
Throws:
TrustException

toProperties

public static java.util.Properties toProperties(org.apache.axiom.om.OMElement cryptoElem)