com.sun.xml.wss.impl.misc
Class SecurityUtil

java.lang.Object
  extended by com.sun.xml.wss.impl.misc.SecurityUtil

public class SecurityUtil
extends java.lang.Object

Utility class for the Encryption and Signature related methods

Author:
Ashutosh Shahi

Field Summary
protected static java.util.logging.Logger log
           
 
Constructor Summary
SecurityUtil()
          Creates a new instance of SecurityUtil
 
Method Summary
static void checkIncludeTokenPolicy(FilterProcessingContext context, AuthenticationTokenPolicy.X509CertificateBinding certInfo, java.lang.String x509id)
           
static void checkIncludeTokenPolicyOpt(JAXBFilterProcessingContext context, AuthenticationTokenPolicy.UsernameTokenBinding untBinding, java.lang.String unTokenid)
           
static void checkIncludeTokenPolicyOpt(JAXBFilterProcessingContext context, AuthenticationTokenPolicy.X509CertificateBinding certInfo, java.lang.String x509id)
           
static org.w3c.dom.Element convertSTRToElement(java.lang.Object strElem, org.w3c.dom.Document doc)
           
static void copy(java.util.Map p1, java.util.Map p2)
           
static void copySubject(javax.security.auth.Subject to, javax.security.auth.Subject from)
           
static javax.crypto.SecretKey generateSymmetricKey(java.lang.String algorithm)
           
static java.lang.String generateUUID()
           
static java.lang.String getDataEncryptionAlgo(JAXBFilterProcessingContext context)
           
static java.lang.String getKeyAlgo(java.lang.String algo)
           
static int getLengthFromAlgorithm(java.lang.String algorithm)
          Lookup method to get the Key Length based on algorithm TODO: Not complete yet, need to add more algorithms NOTE: This method should only be used for DerivedKeyTokenLengths
static SecurityContextToken getSCT(SecurityContextToken sct, com.sun.xml.ws.api.SOAPVersion version)
           
static java.lang.String getSecretKeyAlgorithm(java.lang.String encryptionAlgo)
           
static javax.security.auth.Subject getSubject(java.util.Map context)
           
static java.lang.String getWsuIdOrId(org.w3c.dom.Element elem)
           
static void initInferredIssuedTokenContext(FilterProcessingContext wssContext, Token str, java.security.Key returnKey)
           
static void insertCertificate(FilterProcessingContext context, AuthenticationTokenPolicy.X509CertificateBinding certInfo, java.lang.String x509id)
           
static boolean isBinarySecret(SOAPElement elem)
           
static boolean isEncryptedKey(SOAPElement elem)
           
static java.net.URL loadFromClasspath(java.lang.String configFileName)
          Returns a URL pointing to the given config file.
static java.net.URL loadFromContext(java.lang.String configFileName, java.lang.Object context)
          Returns a URL pointing to the given config file.
static java.lang.Object loadSPIClass(java.net.URL url, java.lang.String spiName)
           
static SecurityContextTokenImpl locateBySCTId(FilterProcessingContext context, java.lang.String sctId)
           
static java.lang.Object newInstance(java.lang.String className, java.lang.ClassLoader classLoader, java.lang.String spiName)
           
static byte[] P_SHA1(byte[] secret, byte[] seed)
           
static byte[] P_SHA1(byte[] secret, byte[] seed, int requiredSize)
           
static void resolveIssuedToken(FilterProcessingContext context, IssuedTokenKeyBinding itkb)
           
static void resolveSCT(FilterProcessingContext context, SecureConversationTokenKeyBinding sctBinding)
           
static long toLong(java.lang.String lng)
           
static void updateSamlVsKeyCache(SecurityTokenReference str, FilterProcessingContext ctx, java.security.Key symKey)
           
static void updateSamlVsKeyCache(SecurityTokenReferenceType str, FilterProcessingContext ctx, java.security.Key symKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final java.util.logging.Logger log
Constructor Detail

SecurityUtil

public SecurityUtil()
Creates a new instance of SecurityUtil

Method Detail

generateSymmetricKey

public static javax.crypto.SecretKey generateSymmetricKey(java.lang.String algorithm)
                                                   throws XWSSecurityException
Throws:
XWSSecurityException

getLengthFromAlgorithm

public static int getLengthFromAlgorithm(java.lang.String algorithm)
                                  throws XWSSecurityException
Lookup method to get the Key Length based on algorithm TODO: Not complete yet, need to add more algorithms NOTE: This method should only be used for DerivedKeyTokenLengths

Throws:
XWSSecurityException

generateUUID

public static java.lang.String generateUUID()

P_SHA1

public static byte[] P_SHA1(byte[] secret,
                            byte[] seed)
                     throws java.lang.Exception
Throws:
java.lang.Exception

P_SHA1

public static byte[] P_SHA1(byte[] secret,
                            byte[] seed,
                            int requiredSize)
                     throws java.security.NoSuchAlgorithmException,
                            java.security.InvalidKeyException
Throws:
java.security.NoSuchAlgorithmException
java.security.InvalidKeyException

getSecretKeyAlgorithm

public static java.lang.String getSecretKeyAlgorithm(java.lang.String encryptionAlgo)

checkIncludeTokenPolicyOpt

public static void checkIncludeTokenPolicyOpt(JAXBFilterProcessingContext context,
                                              AuthenticationTokenPolicy.UsernameTokenBinding untBinding,
                                              java.lang.String unTokenid)
                                       throws XWSSecurityException
Throws:
XWSSecurityException

checkIncludeTokenPolicy

public static void checkIncludeTokenPolicy(FilterProcessingContext context,
                                           AuthenticationTokenPolicy.X509CertificateBinding certInfo,
                                           java.lang.String x509id)
                                    throws XWSSecurityException
Throws:
XWSSecurityException

checkIncludeTokenPolicyOpt

public static void checkIncludeTokenPolicyOpt(JAXBFilterProcessingContext context,
                                              AuthenticationTokenPolicy.X509CertificateBinding certInfo,
                                              java.lang.String x509id)
                                       throws XWSSecurityException
Throws:
XWSSecurityException

getWsuIdOrId

public static java.lang.String getWsuIdOrId(org.w3c.dom.Element elem)
                                     throws XWSSecurityException
Throws:
XWSSecurityException

resolveSCT

public static void resolveSCT(FilterProcessingContext context,
                              SecureConversationTokenKeyBinding sctBinding)
                       throws XWSSecurityException
Throws:
XWSSecurityException

resolveIssuedToken

public static void resolveIssuedToken(FilterProcessingContext context,
                                      IssuedTokenKeyBinding itkb)
                               throws XWSSecurityException
Throws:
XWSSecurityException

initInferredIssuedTokenContext

public static void initInferredIssuedTokenContext(FilterProcessingContext wssContext,
                                                  Token str,
                                                  java.security.Key returnKey)
                                           throws XWSSecurityException
Throws:
XWSSecurityException

isEncryptedKey

public static boolean isEncryptedKey(SOAPElement elem)

isBinarySecret

public static boolean isBinarySecret(SOAPElement elem)

locateBySCTId

public static SecurityContextTokenImpl locateBySCTId(FilterProcessingContext context,
                                                     java.lang.String sctId)
                                              throws XWSSecurityException
Throws:
XWSSecurityException

updateSamlVsKeyCache

public static void updateSamlVsKeyCache(SecurityTokenReference str,
                                        FilterProcessingContext ctx,
                                        java.security.Key symKey)

updateSamlVsKeyCache

public static void updateSamlVsKeyCache(SecurityTokenReferenceType str,
                                        FilterProcessingContext ctx,
                                        java.security.Key symKey)

insertCertificate

public static void insertCertificate(FilterProcessingContext context,
                                     AuthenticationTokenPolicy.X509CertificateBinding certInfo,
                                     java.lang.String x509id)
                              throws XWSSecurityException
Throws:
XWSSecurityException

getDataEncryptionAlgo

public static java.lang.String getDataEncryptionAlgo(JAXBFilterProcessingContext context)

loadFromContext

public static java.net.URL loadFromContext(java.lang.String configFileName,
                                           java.lang.Object context)
Returns a URL pointing to the given config file. The file name is looked up as a resource from a ServletContext. May return null if the file can not be found.

Parameters:
configFileName - The name of the file resource
context - A ServletContext object. May not be null.

loadFromClasspath

public static java.net.URL loadFromClasspath(java.lang.String configFileName)
Returns a URL pointing to the given config file. The file is looked up as a resource on the classpath. May return null if the file can not be found.

Parameters:
configFileName - the name of the file resource. May not be null.

convertSTRToElement

public static org.w3c.dom.Element convertSTRToElement(java.lang.Object strElem,
                                                      org.w3c.dom.Document doc)
                                               throws XWSSecurityException
Throws:
XWSSecurityException

copySubject

public static void copySubject(javax.security.auth.Subject to,
                               javax.security.auth.Subject from)

getSubject

public static javax.security.auth.Subject getSubject(java.util.Map context)

getSCT

public static SecurityContextToken getSCT(SecurityContextToken sct,
                                          com.sun.xml.ws.api.SOAPVersion version)

copy

public static void copy(java.util.Map p1,
                        java.util.Map p2)

newInstance

public static java.lang.Object newInstance(java.lang.String className,
                                           java.lang.ClassLoader classLoader,
                                           java.lang.String spiName)

loadSPIClass

public static java.lang.Object loadSPIClass(java.net.URL url,
                                            java.lang.String spiName)

toLong

public static long toLong(java.lang.String lng)
                   throws XWSSecurityException
Throws:
XWSSecurityException

getKeyAlgo

public static java.lang.String getKeyAlgo(java.lang.String algo)


Copyright © 2005-2013 Oracle Corporation. All Rights Reserved.