Package org.apache.xml.security.stax.ext
Class XMLSecurityUtils
- java.lang.Object
-
- org.apache.xml.security.stax.ext.XMLSecurityUtils
-
public class XMLSecurityUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static int
MAX_SYMMETRIC_KEY_SIZE
-
Constructor Summary
Constructors Modifier Constructor Description protected
XMLSecurityUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
copy(java.io.InputStream inputStream, java.io.OutputStream outputStream)
static void
createKeyNameTokenStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.lang.String keyName)
static void
createKeyValueTokenStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates)
static void
createKeyValueTokenStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.PublicKey publicKey)
static TokenSecurityEvent<? extends InboundSecurityToken>
createTokenSecurityEvent(InboundSecurityToken inboundSecurityToken, java.lang.String correlationID)
static void
createX509CertificateStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates)
static void
createX509CertificateStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates, boolean outputX509Data)
static void
createX509IssuerSerialStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates)
static void
createX509IssuerSerialStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates, boolean outputX509Data)
static void
createX509SubjectKeyIdentifierStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates)
static void
createX509SubjectKeyIdentifierStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates, boolean outputX509Data)
static void
createX509SubjectNameStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates)
static void
createX509SubjectNameStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates, boolean outputX509Data)
static java.lang.String
dropReferenceMarker(java.lang.String reference)
Returns the Id reference without the leading #static java.util.Set<java.lang.String>
getExcC14NInclusiveNamespacePrefixes(XMLSecStartElement xmlSecStartElement, boolean excludeVisible)
static java.lang.String
getQNameAttribute(java.util.Map<javax.xml.namespace.QName,java.lang.String> attributes, javax.xml.namespace.QName qName)
static <T> T
getQNameType(java.util.List<java.lang.Object> objects, javax.xml.namespace.QName qName)
static Transformer
getTransformer(Transformer transformer, java.io.OutputStream outputStream, java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.String algorithm, XMLSecurityConstants.DIRECTION direction)
static <T> T
getType(java.util.List<java.lang.Object> objects, java.lang.Class<T> clazz)
static java.lang.String
getXMLEventAsString(XMLSecEvent xmlSecEvent)
Returns the XMLEvent type in String formstatic javax.xml.validation.Schema
loadXMLSecuritySchemas()
static javax.crypto.SecretKey
prepareSecretKey(java.lang.String symEncAlgo, byte[] rawKey)
Convert the raw key bytes into a SecretKey object of type symEncAlgo.
-
-
-
Field Detail
-
MAX_SYMMETRIC_KEY_SIZE
private static final int MAX_SYMMETRIC_KEY_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
dropReferenceMarker
public static java.lang.String dropReferenceMarker(java.lang.String reference)
Returns the Id reference without the leading #- Parameters:
reference
- The reference on which to drop the #- Returns:
- The reference without a leading #
-
getXMLEventAsString
public static java.lang.String getXMLEventAsString(XMLSecEvent xmlSecEvent)
Returns the XMLEvent type in String form- Parameters:
xmlSecEvent
-- Returns:
- The XMLEvent type as string representation
-
getTransformer
public static Transformer getTransformer(Transformer transformer, java.io.OutputStream outputStream, java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.String algorithm, XMLSecurityConstants.DIRECTION direction) throws XMLSecurityException
- Throws:
XMLSecurityException
-
getType
public static <T> T getType(java.util.List<java.lang.Object> objects, java.lang.Class<T> clazz)
-
getQNameType
public static <T> T getQNameType(java.util.List<java.lang.Object> objects, javax.xml.namespace.QName qName)
-
getQNameAttribute
public static java.lang.String getQNameAttribute(java.util.Map<javax.xml.namespace.QName,java.lang.String> attributes, javax.xml.namespace.QName qName)
-
createKeyValueTokenStructure
public static void createKeyValueTokenStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates) throws javax.xml.stream.XMLStreamException, XMLSecurityException
- Throws:
javax.xml.stream.XMLStreamException
XMLSecurityException
-
createKeyValueTokenStructure
public static void createKeyValueTokenStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.PublicKey publicKey) throws javax.xml.stream.XMLStreamException, XMLSecurityException
- Throws:
javax.xml.stream.XMLStreamException
XMLSecurityException
-
createX509SubjectKeyIdentifierStructure
public static void createX509SubjectKeyIdentifierStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates) throws XMLSecurityException, javax.xml.stream.XMLStreamException
- Throws:
XMLSecurityException
javax.xml.stream.XMLStreamException
-
createX509SubjectKeyIdentifierStructure
public static void createX509SubjectKeyIdentifierStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates, boolean outputX509Data) throws XMLSecurityException, javax.xml.stream.XMLStreamException
- Throws:
XMLSecurityException
javax.xml.stream.XMLStreamException
-
createX509CertificateStructure
public static void createX509CertificateStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates) throws XMLSecurityException, javax.xml.stream.XMLStreamException
- Throws:
XMLSecurityException
javax.xml.stream.XMLStreamException
-
createX509CertificateStructure
public static void createX509CertificateStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates, boolean outputX509Data) throws XMLSecurityException, javax.xml.stream.XMLStreamException
- Throws:
XMLSecurityException
javax.xml.stream.XMLStreamException
-
createX509SubjectNameStructure
public static void createX509SubjectNameStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates) throws XMLSecurityException, javax.xml.stream.XMLStreamException
- Throws:
XMLSecurityException
javax.xml.stream.XMLStreamException
-
createX509SubjectNameStructure
public static void createX509SubjectNameStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates, boolean outputX509Data) throws XMLSecurityException, javax.xml.stream.XMLStreamException
- Throws:
XMLSecurityException
javax.xml.stream.XMLStreamException
-
createX509IssuerSerialStructure
public static void createX509IssuerSerialStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates) throws javax.xml.stream.XMLStreamException, XMLSecurityException
- Throws:
javax.xml.stream.XMLStreamException
XMLSecurityException
-
createX509IssuerSerialStructure
public static void createX509IssuerSerialStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.security.cert.X509Certificate[] x509Certificates, boolean outputX509Data) throws javax.xml.stream.XMLStreamException, XMLSecurityException
- Throws:
javax.xml.stream.XMLStreamException
XMLSecurityException
-
createTokenSecurityEvent
public static TokenSecurityEvent<? extends InboundSecurityToken> createTokenSecurityEvent(InboundSecurityToken inboundSecurityToken, java.lang.String correlationID) throws XMLSecurityException
- Throws:
XMLSecurityException
-
getExcC14NInclusiveNamespacePrefixes
public static java.util.Set<java.lang.String> getExcC14NInclusiveNamespacePrefixes(XMLSecStartElement xmlSecStartElement, boolean excludeVisible)
-
copy
public static void copy(java.io.InputStream inputStream, java.io.OutputStream outputStream) throws java.io.IOException
- Throws:
java.io.IOException
-
prepareSecretKey
public static javax.crypto.SecretKey prepareSecretKey(java.lang.String symEncAlgo, byte[] rawKey)
Convert the raw key bytes into a SecretKey object of type symEncAlgo.
-
loadXMLSecuritySchemas
public static javax.xml.validation.Schema loadXMLSecuritySchemas() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
createKeyNameTokenStructure
public static void createKeyNameTokenStructure(AbstractOutputProcessor abstractOutputProcessor, OutputProcessorChain outputProcessorChain, java.lang.String keyName) throws javax.xml.stream.XMLStreamException, XMLSecurityException
- Throws:
javax.xml.stream.XMLStreamException
XMLSecurityException
-
-