Package com.sun.xml.wss.impl.misc
Class SecurityUtil
- java.lang.Object
-
- com.sun.xml.wss.impl.misc.SecurityUtil
-
public class SecurityUtil extends Object
Utility class for the Encryption and Signature related methods- Author:
- Ashutosh Shahi
-
-
Constructor Summary
Constructors Constructor Description SecurityUtil()
Creates a new instance of SecurityUtil
-
Method Summary
-
-
-
Field Detail
-
log
protected static final Logger log
-
-
Method Detail
-
generateSymmetricKey
public static SecretKey generateSymmetricKey(String algorithm) throws XWSSecurityException
- Throws:
XWSSecurityException
-
getLengthFromAlgorithm
public static int getLengthFromAlgorithm(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 String generateUUID()
-
P_SHA1
public static byte[] P_SHA1(byte[] secret, byte[] seed, int requiredSize) throws NoSuchAlgorithmException, InvalidKeyException
-
checkIncludeTokenPolicyOpt
public static void checkIncludeTokenPolicyOpt(JAXBFilterProcessingContext context, AuthenticationTokenPolicy.UsernameTokenBinding untBinding, String unTokenid) throws XWSSecurityException
- Throws:
XWSSecurityException
-
checkIncludeTokenPolicy
public static void checkIncludeTokenPolicy(FilterProcessingContext context, AuthenticationTokenPolicy.X509CertificateBinding certInfo, String x509id) throws XWSSecurityException
- Throws:
XWSSecurityException
-
checkIncludeTokenPolicyOpt
public static void checkIncludeTokenPolicyOpt(JAXBFilterProcessingContext context, AuthenticationTokenPolicy.X509CertificateBinding certInfo, String x509id) throws XWSSecurityException
- Throws:
XWSSecurityException
-
getWsuIdOrId
public static String getWsuIdOrId(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, Key returnKey) throws XWSSecurityException
- Throws:
XWSSecurityException
-
isEncryptedKey
public static boolean isEncryptedKey(jakarta.xml.soap.SOAPElement elem)
-
isBinarySecret
public static boolean isBinarySecret(jakarta.xml.soap.SOAPElement elem)
-
locateBySCTId
public static SecurityContextTokenImpl locateBySCTId(FilterProcessingContext context, String sctId) throws XWSSecurityException
- Throws:
XWSSecurityException
-
updateSamlVsKeyCache
public static void updateSamlVsKeyCache(SecurityTokenReference str, FilterProcessingContext ctx, Key symKey)
-
updateSamlVsKeyCache
public static void updateSamlVsKeyCache(SecurityTokenReferenceType str, FilterProcessingContext ctx, Key symKey)
-
insertCertificate
public static void insertCertificate(FilterProcessingContext context, AuthenticationTokenPolicy.X509CertificateBinding certInfo, String x509id) throws XWSSecurityException
- Throws:
XWSSecurityException
-
getDataEncryptionAlgo
public static String getDataEncryptionAlgo(JAXBFilterProcessingContext context)
-
loadFromContext
public static URL loadFromContext(String configFileName, 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 resourcecontext
- A ServletContext object. May not be null.
-
loadFromClasspath
public static URL loadFromClasspath(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 benull
.
-
convertSTRToElement
public static Element convertSTRToElement(Object strElem, Document doc) throws XWSSecurityException
- Throws:
XWSSecurityException
-
getSCT
public static SecurityContextToken getSCT(SecurityContextToken sct, SOAPVersion version)
-
newInstance
public static Object newInstance(String className, ClassLoader classLoader, String spiName)
-
toLong
public static long toLong(String lng) throws XWSSecurityException
- Throws:
XWSSecurityException
-
-