Package com.sun.xml.wss.core
Class KeyInfoHeaderBlock
java.lang.Object
com.sun.xml.wss.impl.misc.SOAPElementExtension
com.sun.xml.wss.impl.misc.SecurityHeaderBlockImpl
com.sun.xml.wss.core.KeyInfoHeaderBlock
- All Implemented Interfaces:
SecurityHeaderBlock,javax.xml.soap.Node,javax.xml.soap.SOAPElement,Element,Node
Corresponds to the schema representation for a KeyInfo.
<element name="KeyInfo" type="ds:KeyInfoType"/>
<complexType name="KeyInfoType" mixed="true">
<choice maxOccurs="unbounded">
<element ref="ds:KeyName"/>
<element ref="ds:KeyValue"/>
<element ref="ds:RetrievalMethod"/>
<element ref="ds:X509Data"/>
<element ref="ds:PGPData"/>
<element ref="ds:SPKIData"/>
<element ref="ds:MgmtData"/>
<element ref="wsse:SecurityTokenReference"/>
<any processContents="lax" namespace="##other"/>
<!-- (1,1) elements from (0,unbounded) namespaces -->
</choice>
<attribute name="Id" type="ID" use="optional"/>
</complexType>
-
Field Summary
FieldsFields inherited from class com.sun.xml.wss.impl.misc.SecurityHeaderBlockImpl
delegateElementFields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE -
Constructor Summary
ConstructorsConstructorDescriptionKeyInfoHeaderBlock(javax.xml.soap.SOAPElement element) parse and create the KeyInfo elementKeyInfoHeaderBlock(org.apache.xml.security.keys.KeyInfo keyinfo) constructor that takes Apache KeyInfoKeyInfoHeaderBlock(Document ownerDoc) constructor that creates an empty KeyInfo -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBinarySecret(javax.xml.soap.SOAPElement binarySecret) Method addBinarySecretvoidaddDSAKeyValue(javax.xml.soap.SOAPElement dsakeyvalue) Method addvoidaddEncryptedKey(EncryptedKeyToken reference) Method addEncryptedKeyvoidaddKeyName(String keynameString) Method addKeyName.voidaddKeyName(javax.xml.soap.SOAPElement keyname) Method add.voidaddKeyValue(PublicKey pk) Method addKeyValuevoidaddKeyValue(javax.xml.soap.SOAPElement keyvalue) Method addKeyValuevoidaddMgmtData(String mgmtdata) Method addMgmtDatavoidaddMgmtData(javax.xml.soap.SOAPElement mgmtdata) Method addvoidaddPGPData(javax.xml.soap.SOAPElement pgpdata) Method addPGPDatavoidaddRetrievalMethod(String URI, org.apache.xml.security.transforms.Transforms transforms, String type) Method addRetrievalMethodvoidaddRetrievalMethod(javax.xml.soap.SOAPElement retrievalmethod) Method addRetrievalMethodvoidaddRSAKeyValue(javax.xml.soap.SOAPElement rsakeyvalue) Method addvoidaddSecurityTokenReference(SecurityTokenReference reference) Method addSecurityTokenReferencevoidaddSPKIData(javax.xml.soap.SOAPElement spkidata) Method addvoidaddUnknownElement(javax.xml.soap.SOAPElement element) Method addUnknownElementvoidaddUnknownKeyValue(javax.xml.soap.SOAPElement unknownKeyValueElement) Method addKeyValuevoidaddX509Data(javax.xml.soap.SOAPElement x509data) Method addX509DatavoidaddX509Data(org.apache.xml.security.keys.content.X509Data x509Data) intMethod binarySecretCountbooleanMethod containsBinarySecretbooleanMethod containsEncryptedKeyTokenbooleanMethod containsKeyNamebooleanMethod containsKeyValuebooleanMethod containsMgmtDatabooleanMethod containsPGPDatabooleanMethod containsRetrievalMethodbooleanMethod containsSecurityTokenReferencebooleanMethod containsSPKIDatabooleanMethod containsUnknownElementbooleanMethod containsX509DataintMethod encryptedKeyTokenCountstatic SecurityHeaderBlockfromSoapElement(javax.xml.soap.SOAPElement element) javax.xml.soap.SOAPElementMethod to return the KeyInfo as a SOAPElement.com.sun.xml.ws.security.trust.elements.BinarySecretgetBinarySecret(int index) getEncryptedKey(int index) Method getEncryptedKeygetId()Method getIdfinal org.apache.xml.security.keys.KeyInfoMethod getKeyInfojavax.xml.soap.SOAPElementgetKeyName(int index) Method getKeyNamegetKeyNameString(int index) Method getKeyNameStringorg.apache.xml.security.keys.content.KeyValuegetKeyValue(int index) Method getKeyValuejavax.xml.soap.SOAPElementgetKeyValueElement(int index) Method getKeyValueElementjavax.xml.soap.SOAPElementgetMgmtData(int index) Method getMgmtDatajavax.xml.soap.SOAPElementgetPGPData(int index) Method getPGPDatajavax.xml.soap.SOAPElementgetRetrievalMethod(int index) Method getRetrievalMethodgetSecurityTokenReference(int index) Method getSecurityTokenReferencejavax.xml.soap.SOAPElementgetSPKIData(int index) Method getSPKIDatajavax.xml.soap.SOAPElementgetUnknownElement(int index) Method getUnknownElementorg.apache.xml.security.keys.content.X509DatagetX509Data(int index) Method getX509Datajavax.xml.soap.SOAPElementgetX509DataElement(int index) Method getX509DataElementintMethod keyNameCountintMethod keyValueCountintMethod mgmtDataCountintMethod pgpDataCountintMethod retrievalMethodCountvoidThis method should be called when changes are made inside an object through its reference obtained from any of the get methods of this class.intMethod securityTokenReferenceCountvoidsetBaseURI(String uri) Method setBaseURI : BaseURI accepted by Apache KeyInfo CtorvoidsetDocument(Document doc) setDocumentvoidMethod setIdintMethod spkiDataCountintMethod unknownElementCountintMethod x509DataCountMethods inherited from class com.sun.xml.wss.impl.misc.SecurityHeaderBlockImpl
addAttribute, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addNamespaceDeclaration, addTextNode, appendChild, cloneNode, compareDocumentPosition, detachNode, equals, fromSoapElement, getAllAttributes, getAllAttributesAsQNames, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getAttributeValue, getBaseURI, getChildElements, getChildElements, getChildNodes, getElementName, getElementsByTagName, getElementsByTagNameNS, getEncodingStyle, getFeature, getFirstChild, getLastChild, getLocalName, getNamespacePrefixes, getNamespaceURI, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPrefix, getPreviousSibling, getSchemaTypeInfo, getSoapFactory, getTagName, getTextContent, getUserData, getValue, getVisibleNamespacePrefixes, hasAttribute, hasAttributeNS, hasAttributes, hasChildNodes, insertBefore, isBSP, isBSP, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, recycleNode, removeAttribute, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, removeContents, removeNamespaceDeclaration, replaceChild, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setEncodingStyle, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setNodeValue, setParentElement, setPrefix, setSOAPElement, setTextContent, setUserData, setValue, setWsuIdAttrMethods inherited from class com.sun.xml.wss.impl.misc.SOAPElementExtension
addAttribute, addChildElement, createQName, getAttributeValue, getChildElements, getElementQName, removeAttribute, setElementQNameMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.xml.soap.SOAPElement
addAttribute, addChildElement, createQName, getAttributeValue, getChildElements, getElementQName, removeAttribute, setElementQName
-
Field Details
-
SignatureSpecNS
- See Also:
-
SignatureSpecNSprefix
- See Also:
-
TAG_KEYINFO
- See Also:
-
-
Constructor Details
-
KeyInfoHeaderBlock
constructor that creates an empty KeyInfo- Parameters:
ownerDoc- the OwnerDocument of the KeyInfo- Throws:
com.sun.xml.wss.XWSSecurityException
-
KeyInfoHeaderBlock
public KeyInfoHeaderBlock(org.apache.xml.security.keys.KeyInfo keyinfo) throws com.sun.xml.wss.XWSSecurityException constructor that takes Apache KeyInfo- Parameters:
keyinfo- the KeyInfo from XML DSIG- Throws:
com.sun.xml.wss.XWSSecurityException
-
KeyInfoHeaderBlock
public KeyInfoHeaderBlock(javax.xml.soap.SOAPElement element) throws com.sun.xml.wss.XWSSecurityException parse and create the KeyInfo element- Parameters:
element- the KeyInfo element NOTE : this constructor assumes a fully initialized XML KeyInfo No additions are allowed on the keyinfo, only we can get existing values. For example addkeyName() will have no impact on the KeyInfo will not append a KeyName child to the KeyInfo.- Throws:
com.sun.xml.wss.XWSSecurityException
-
-
Method Details
-
addKeyName
Method addKeyName.- Parameters:
keynameString-
-
addBinarySecret
public void addBinarySecret(javax.xml.soap.SOAPElement binarySecret) Method addBinarySecret- Parameters:
binarySecret-
-
addKeyName
public void addKeyName(javax.xml.soap.SOAPElement keyname) throws com.sun.xml.wss.XWSSecurityException Method add.- Parameters:
keyname-- Throws:
com.sun.xml.wss.XWSSecurityException
-
addKeyValue
Method addKeyValue- Parameters:
pk-
-
addUnknownKeyValue
public void addUnknownKeyValue(javax.xml.soap.SOAPElement unknownKeyValueElement) Method addKeyValue- Parameters:
unknownKeyValueElement-
-
addDSAKeyValue
public void addDSAKeyValue(javax.xml.soap.SOAPElement dsakeyvalue) throws com.sun.xml.wss.XWSSecurityException Method add- Parameters:
dsakeyvalue-- Throws:
com.sun.xml.wss.XWSSecurityException
-
addRSAKeyValue
public void addRSAKeyValue(javax.xml.soap.SOAPElement rsakeyvalue) throws com.sun.xml.wss.XWSSecurityException Method add- Parameters:
rsakeyvalue-- Throws:
com.sun.xml.wss.XWSSecurityException
-
addKeyValue
public void addKeyValue(javax.xml.soap.SOAPElement keyvalue) throws com.sun.xml.wss.XWSSecurityException Method addKeyValue- Parameters:
keyvalue-- Throws:
com.sun.xml.wss.XWSSecurityException
-
addMgmtData
Method addMgmtData- Parameters:
mgmtdata-
-
addMgmtData
public void addMgmtData(javax.xml.soap.SOAPElement mgmtdata) throws com.sun.xml.wss.XWSSecurityException Method add- Parameters:
mgmtdata-- Throws:
com.sun.xml.wss.XWSSecurityException
-
addPGPData
public void addPGPData(javax.xml.soap.SOAPElement pgpdata) throws com.sun.xml.wss.XWSSecurityException Method addPGPData- Parameters:
pgpdata-- Throws:
com.sun.xml.wss.XWSSecurityException
-
addRetrievalMethod
public void addRetrievalMethod(String URI, org.apache.xml.security.transforms.Transforms transforms, String type) Method addRetrievalMethod- Parameters:
URI-transforms-type-
-
addRetrievalMethod
public void addRetrievalMethod(javax.xml.soap.SOAPElement retrievalmethod) throws com.sun.xml.wss.XWSSecurityException Method addRetrievalMethod- Parameters:
retrievalmethod-- Throws:
com.sun.xml.wss.XWSSecurityException
-
addSPKIData
public void addSPKIData(javax.xml.soap.SOAPElement spkidata) throws com.sun.xml.wss.XWSSecurityException Method add- Parameters:
spkidata-- Throws:
com.sun.xml.wss.XWSSecurityException
-
addX509Data
public void addX509Data(javax.xml.soap.SOAPElement x509data) throws com.sun.xml.wss.XWSSecurityException Method addX509Data- Parameters:
x509data-- Throws:
com.sun.xml.wss.XWSSecurityException
-
addUnknownElement
public void addUnknownElement(javax.xml.soap.SOAPElement element) Method addUnknownElement- Parameters:
element-
-
keyNameCount
public int keyNameCount()Method keyNameCount -
keyValueCount
public int keyValueCount()Method keyValueCount -
mgmtDataCount
public int mgmtDataCount()Method mgmtDataCount -
pgpDataCount
public int pgpDataCount()Method pgpDataCount -
retrievalMethodCount
public int retrievalMethodCount()Method retrievalMethodCount -
spkiDataCount
public int spkiDataCount()Method spkiDataCount -
x509DataCount
public int x509DataCount()Method x509DataCount -
unknownElementCount
public int unknownElementCount()Method unknownElementCount -
getKeyName
public javax.xml.soap.SOAPElement getKeyName(int index) throws com.sun.xml.wss.XWSSecurityException Method getKeyName- Parameters:
index- 0 is the lowest index- Throws:
com.sun.xml.wss.XWSSecurityException
-
getKeyNameString
Method getKeyNameString- Parameters:
index- 0 is the lowest index- Throws:
com.sun.xml.wss.XWSSecurityException
-
getKeyValueElement
public javax.xml.soap.SOAPElement getKeyValueElement(int index) throws com.sun.xml.wss.XWSSecurityException Method getKeyValueElement- Parameters:
index- 0 is the lowest index- Throws:
com.sun.xml.wss.XWSSecurityException
-
getKeyValue
public org.apache.xml.security.keys.content.KeyValue getKeyValue(int index) throws com.sun.xml.wss.XWSSecurityException Method getKeyValue- Parameters:
index- 0 is the lowest index- Throws:
com.sun.xml.wss.XWSSecurityException
-
getMgmtData
public javax.xml.soap.SOAPElement getMgmtData(int index) throws com.sun.xml.wss.XWSSecurityException Method getMgmtData- Parameters:
index- 0 is the lowest index- Throws:
com.sun.xml.wss.XWSSecurityException
-
getPGPData
public javax.xml.soap.SOAPElement getPGPData(int index) throws com.sun.xml.wss.XWSSecurityException Method getPGPData- Parameters:
index- 0 is the lowest index- Throws:
com.sun.xml.wss.XWSSecurityException
-
getRetrievalMethod
public javax.xml.soap.SOAPElement getRetrievalMethod(int index) throws com.sun.xml.wss.XWSSecurityException Method getRetrievalMethod- Parameters:
index- 0 is the lowest index- Throws:
com.sun.xml.wss.XWSSecurityException
-
getSPKIData
public javax.xml.soap.SOAPElement getSPKIData(int index) throws com.sun.xml.wss.XWSSecurityException Method getSPKIData- Parameters:
index- 0 is the lowest index- Throws:
com.sun.xml.wss.XWSSecurityException
-
getX509DataElement
public javax.xml.soap.SOAPElement getX509DataElement(int index) throws com.sun.xml.wss.XWSSecurityException Method getX509DataElement- Parameters:
index- 0 is the lowest index- Throws:
com.sun.xml.wss.XWSSecurityException
-
getX509Data
public org.apache.xml.security.keys.content.X509Data getX509Data(int index) throws com.sun.xml.wss.XWSSecurityException Method getX509Data- Parameters:
index- 0 is the lowest index- Throws:
com.sun.xml.wss.XWSSecurityException
-
getUnknownElement
public javax.xml.soap.SOAPElement getUnknownElement(int index) throws com.sun.xml.wss.XWSSecurityException Method getUnknownElement- Parameters:
index- 0 is the lowest index- Throws:
com.sun.xml.wss.XWSSecurityException
-
containsKeyName
public boolean containsKeyName()Method containsKeyName -
containsKeyValue
public boolean containsKeyValue()Method containsKeyValue -
containsMgmtData
public boolean containsMgmtData()Method containsMgmtData -
containsPGPData
public boolean containsPGPData()Method containsPGPData -
containsRetrievalMethod
public boolean containsRetrievalMethod()Method containsRetrievalMethod -
containsSPKIData
public boolean containsSPKIData()Method containsSPKIData -
containsUnknownElement
public boolean containsUnknownElement()Method containsUnknownElement -
containsX509Data
public boolean containsX509Data()Method containsX509Data -
addSecurityTokenReference
public void addSecurityTokenReference(SecurityTokenReference reference) throws com.sun.xml.wss.XWSSecurityException Method addSecurityTokenReference- Parameters:
reference-- Throws:
com.sun.xml.wss.XWSSecurityException
-
getSecurityTokenReference
public SecurityTokenReference getSecurityTokenReference(int index) throws com.sun.xml.wss.XWSSecurityException Method getSecurityTokenReference- Parameters:
index-- Returns:
- the index^th token reference element from the KeyInfo 0 is the lowest index.
- Throws:
com.sun.xml.wss.XWSSecurityException
-
securityTokenReferenceCount
public int securityTokenReferenceCount()Method securityTokenReferenceCount- Returns:
- the count of security token references
-
containsSecurityTokenReference
public boolean containsSecurityTokenReference()Method containsSecurityTokenReference- Returns:
- true if this KeyInfo contains wsse:SecurityTokenReference's
-
addEncryptedKey
public void addEncryptedKey(EncryptedKeyToken reference) throws com.sun.xml.wss.XWSSecurityException Method addEncryptedKey- Parameters:
reference-- Throws:
com.sun.xml.wss.XWSSecurityException
-
getEncryptedKey
Method getEncryptedKey- Parameters:
index-- Returns:
- the index^th token reference element from the KeyInfo 0 is the lowest index.
- Throws:
com.sun.xml.wss.XWSSecurityException
-
encryptedKeyTokenCount
public int encryptedKeyTokenCount()Method encryptedKeyTokenCount- Returns:
- the count of encrypted key token references
-
containsEncryptedKeyToken
public boolean containsEncryptedKeyToken()Method containsEncryptedKeyToken- Returns:
- true if this KeyInfo contains wsse:SecurityTokenReference's
-
getBinarySecret
public com.sun.xml.ws.security.trust.elements.BinarySecret getBinarySecret(int index) throws com.sun.xml.wss.XWSSecurityException - Throws:
com.sun.xml.wss.XWSSecurityException
-
binarySecretCount
public int binarySecretCount()Method binarySecretCount- Returns:
- the count of binarySecret tokens
-
containsBinarySecret
public boolean containsBinarySecret()Method containsBinarySecret- Returns:
- true if this KeyInfo contains BinarySecret
-
setId
Method setId -
getId
Method getId- Specified by:
getIdin interfaceSecurityHeaderBlock- Overrides:
getIdin classSecurityHeaderBlockImpl- Returns:
- the id
-
getKeyInfo
public final org.apache.xml.security.keys.KeyInfo getKeyInfo()Method getKeyInfo- Returns:
- the XML DSIG KeyInfo which is wrapped by this class
-
setBaseURI
Method setBaseURI : BaseURI accepted by Apache KeyInfo Ctor- Parameters:
uri- Base URI to be used as context for all relative URIs.
-
getAsSoapElement
public javax.xml.soap.SOAPElement getAsSoapElement() throws com.sun.xml.wss.XWSSecurityExceptionMethod to return the KeyInfo as a SOAPElement.- Specified by:
getAsSoapElementin interfaceSecurityHeaderBlock- Overrides:
getAsSoapElementin classSecurityHeaderBlockImpl- Returns:
- SOAPElement
- Throws:
com.sun.xml.wss.XWSSecurityException- If owner soap document is not set.- See Also:
-
setDocument
setDocument- Parameters:
doc- The owner Document of this KeyInfo
-
saveChanges
public void saveChanges()This method should be called when changes are made inside an object through its reference obtained from any of the get methods of this class. As an example, if getKeyInfo() call is made and then changes are made inside the keyInfo, this method should be called to reflect changes when getAsSoapElement() is called finally. -
fromSoapElement
public static SecurityHeaderBlock fromSoapElement(javax.xml.soap.SOAPElement element) throws com.sun.xml.wss.XWSSecurityException - Throws:
com.sun.xml.wss.XWSSecurityException
-
addX509Data
public void addX509Data(org.apache.xml.security.keys.content.X509Data x509Data) throws com.sun.xml.wss.XWSSecurityException - Throws:
com.sun.xml.wss.XWSSecurityException
-