java.lang.Object
com.sun.xml.wss.impl.misc.SecurityUtil
Utility class for the Encryption and Signature related methods
- Author:
- Ashutosh Shahi
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckIncludeTokenPolicy(FilterProcessingContext context, AuthenticationTokenPolicy.X509CertificateBinding certInfo, String x509id) static voidcheckIncludeTokenPolicyOpt(JAXBFilterProcessingContext context, AuthenticationTokenPolicy.UsernameTokenBinding untBinding, String unTokenid) static voidcheckIncludeTokenPolicyOpt(JAXBFilterProcessingContext context, AuthenticationTokenPolicy.X509CertificateBinding certInfo, String x509id) static ElementconvertSTRToElement(Object strElem, Document doc) static voidstatic voidcopySubject(Subject to, Subject from) static SecretKeygenerateSymmetricKey(String algorithm) static Stringstatic Stringstatic StringgetKeyAlgo(String algo) static intgetLengthFromAlgorithm(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 DerivedKeyTokenLengthsstatic SecurityContextTokengetSCT(SecurityContextToken sct, com.sun.xml.ws.api.SOAPVersion version) static StringgetSecretKeyAlgorithm(String encryptionAlgo) static SubjectgetSubject(Map context) static StringgetWsuIdOrId(Element elem) static voidinitInferredIssuedTokenContext(FilterProcessingContext wssContext, Token str, Key returnKey) static voidinsertCertificate(FilterProcessingContext context, AuthenticationTokenPolicy.X509CertificateBinding certInfo, String x509id) static booleanisBinarySecret(jakarta.xml.soap.SOAPElement elem) static booleanisEncryptedKey(jakarta.xml.soap.SOAPElement elem) static URLloadFromClasspath(String configFileName) Returns a URL pointing to the given config file.static ObjectloadSPIClass(URL url, String spiName) static SecurityContextTokenImpllocateBySCTId(FilterProcessingContext context, String sctId) static ObjectnewInstance(String className, ClassLoader classLoader, String spiName) static byte[]P_SHA1(byte[] secret, byte[] seed) static byte[]P_SHA1(byte[] secret, byte[] seed, int requiredSize) static voidresolveIssuedToken(FilterProcessingContext context, IssuedTokenKeyBinding itkb) static voidresolveSCT(FilterProcessingContext context, SecureConversationTokenKeyBinding sctBinding) static longstatic voidupdateSamlVsKeyCache(SecurityTokenReferenceType str, FilterProcessingContext ctx, Key symKey) static voidupdateSamlVsKeyCache(SecurityTokenReference str, FilterProcessingContext ctx, Key symKey)
-
Field Details
-
log
-
-
Constructor Details
-
SecurityUtil
public SecurityUtil()Creates a new instance of SecurityUtil
-
-
Method Details
-
generateSymmetricKey
- Throws:
XWSSecurityException
-
getLengthFromAlgorithm
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 -
generateUUID
-
P_SHA1
- Throws:
Exception
-
P_SHA1
public static byte[] P_SHA1(byte[] secret, byte[] seed, int requiredSize) throws NoSuchAlgorithmException, InvalidKeyException -
getSecretKeyAlgorithm
-
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
- 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) -
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
-
loadFromClasspath
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
- Throws:
XWSSecurityException
-
copySubject
-
getSubject
-
getSCT
public static SecurityContextToken getSCT(SecurityContextToken sct, com.sun.xml.ws.api.SOAPVersion version) -
copy
-
newInstance
-
loadSPIClass
-
toLong
- Throws:
XWSSecurityException
-
getKeyAlgo
-