- 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,jakarta.xml.soap.Node,jakarta.xml.soap.SOAPElement,Element,Node
public class KeyInfoHeaderBlock extends SecurityHeaderBlockImpl
Corresponds to the schema representation for a KeyInfo.
-
-
Field Summary
Fields Modifier and Type Field Description static StringSignatureSpecNSstatic StringSignatureSpecNSprefixstatic StringTAG_KEYINFO-
Fields inherited from class com.sun.xml.wss.impl.misc.SecurityHeaderBlockImpl
delegateElement
-
Fields 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
Constructors Constructor Description KeyInfoHeaderBlock(jakarta.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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBinarySecret(jakarta.xml.soap.SOAPElement binarySecret)Method addBinarySecretvoidaddDSAKeyValue(jakarta.xml.soap.SOAPElement dsakeyvalue)Method addvoidaddEncryptedKey(EncryptedKeyToken reference)Method addEncryptedKeyvoidaddKeyName(jakarta.xml.soap.SOAPElement keyname)Method add.voidaddKeyName(String keynameString)Method addKeyName.voidaddKeyValue(jakarta.xml.soap.SOAPElement keyvalue)Method addKeyValuevoidaddKeyValue(PublicKey pk)Method addKeyValuevoidaddMgmtData(jakarta.xml.soap.SOAPElement mgmtdata)Method addvoidaddMgmtData(String mgmtdata)Method addMgmtDatavoidaddPGPData(jakarta.xml.soap.SOAPElement pgpdata)Method addPGPDatavoidaddRetrievalMethod(jakarta.xml.soap.SOAPElement retrievalmethod)Method addRetrievalMethodvoidaddRetrievalMethod(String URI, org.apache.xml.security.transforms.Transforms transforms, String type)Method addRetrievalMethodvoidaddRSAKeyValue(jakarta.xml.soap.SOAPElement rsakeyvalue)Method addvoidaddSecurityTokenReference(SecurityTokenReference reference)Method addSecurityTokenReferencevoidaddSPKIData(jakarta.xml.soap.SOAPElement spkidata)Method addvoidaddUnknownElement(jakarta.xml.soap.SOAPElement element)Method addUnknownElementvoidaddUnknownKeyValue(jakarta.xml.soap.SOAPElement unknownKeyValueElement)Method addKeyValuevoidaddX509Data(jakarta.xml.soap.SOAPElement x509data)Method addX509DatavoidaddX509Data(org.apache.xml.security.keys.content.X509Data x509Data)intbinarySecretCount()Method binarySecretCountbooleancontainsBinarySecret()Method containsBinarySecretbooleancontainsEncryptedKeyToken()Method containsEncryptedKeyTokenbooleancontainsKeyName()Method containsKeyNamebooleancontainsKeyValue()Method containsKeyValuebooleancontainsMgmtData()Method containsMgmtDatabooleancontainsPGPData()Method containsPGPDatabooleancontainsRetrievalMethod()Method containsRetrievalMethodbooleancontainsSecurityTokenReference()Method containsSecurityTokenReferencebooleancontainsSPKIData()Method containsSPKIDatabooleancontainsUnknownElement()Method containsUnknownElementbooleancontainsX509Data()Method containsX509DataintencryptedKeyTokenCount()Method encryptedKeyTokenCountstatic SecurityHeaderBlockfromSoapElement(jakarta.xml.soap.SOAPElement element)jakarta.xml.soap.SOAPElementgetAsSoapElement()Method to return the KeyInfo as a SOAPElement.BinarySecretgetBinarySecret(int index)EncryptedKeyTokengetEncryptedKey(int index)Method getEncryptedKeyStringgetId()Method getIdorg.apache.xml.security.keys.KeyInfogetKeyInfo()Method getKeyInfojakarta.xml.soap.SOAPElementgetKeyName(int index)Method getKeyNameStringgetKeyNameString(int index)Method getKeyNameStringorg.apache.xml.security.keys.content.KeyValuegetKeyValue(int index)Method getKeyValuejakarta.xml.soap.SOAPElementgetKeyValueElement(int index)Method getKeyValueElementjakarta.xml.soap.SOAPElementgetMgmtData(int index)Method getMgmtDatajakarta.xml.soap.SOAPElementgetPGPData(int index)Method getPGPDatajakarta.xml.soap.SOAPElementgetRetrievalMethod(int index)Method getRetrievalMethodSecurityTokenReferencegetSecurityTokenReference(int index)Method getSecurityTokenReferencejakarta.xml.soap.SOAPElementgetSPKIData(int index)Method getSPKIDatajakarta.xml.soap.SOAPElementgetUnknownElement(int index)Method getUnknownElementorg.apache.xml.security.keys.content.X509DatagetX509Data(int index)Method getX509Datajakarta.xml.soap.SOAPElementgetX509DataElement(int index)Method getX509DataElementintkeyNameCount()Method keyNameCountintkeyValueCount()Method keyValueCountintmgmtDataCount()Method mgmtDataCountintpgpDataCount()Method pgpDataCountintretrievalMethodCount()Method retrievalMethodCountvoidsaveChanges()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.intsecurityTokenReferenceCount()Method securityTokenReferenceCountvoidsetBaseURI(String uri)Method setBaseURI : BaseURI accepted by Apache KeyInfo CtorvoidsetDocument(Document doc)setDocumentvoidsetId(String id)Method setIdintspkiDataCount()Method spkiDataCountintunknownElementCount()Method unknownElementCountintx509DataCount()Method x509DataCount-
Methods 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, setWsuIdAttr
-
Methods inherited from class com.sun.xml.wss.impl.misc.SOAPElementExtension
addAttribute, addChildElement, createQName, getAttributeValue, getChildElements, getElementQName, removeAttribute, setElementQName
-
-
-
-
Field Detail
-
SignatureSpecNS
public static final String SignatureSpecNS
- See Also:
- Constant Field Values
-
SignatureSpecNSprefix
public static final String SignatureSpecNSprefix
- See Also:
- Constant Field Values
-
TAG_KEYINFO
public static final String TAG_KEYINFO
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
KeyInfoHeaderBlock
public KeyInfoHeaderBlock(Document ownerDoc) throws XWSSecurityException
constructor that creates an empty KeyInfo- Parameters:
ownerDoc- the OwnerDocument of the KeyInfo- Throws:
XWSSecurityException
-
KeyInfoHeaderBlock
public KeyInfoHeaderBlock(org.apache.xml.security.keys.KeyInfo keyinfo) throws XWSSecurityExceptionconstructor that takes Apache KeyInfo- Parameters:
keyinfo- the KeyInfo from XML DSIG- Throws:
XWSSecurityException
-
KeyInfoHeaderBlock
public KeyInfoHeaderBlock(jakarta.xml.soap.SOAPElement element) throws XWSSecurityExceptionparse 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:
XWSSecurityException
-
-
Method Detail
-
addKeyName
public void addKeyName(String keynameString)
Method addKeyName.- Parameters:
keynameString-
-
addBinarySecret
public void addBinarySecret(jakarta.xml.soap.SOAPElement binarySecret)
Method addBinarySecret- Parameters:
binarySecret-
-
addKeyName
public void addKeyName(jakarta.xml.soap.SOAPElement keyname) throws XWSSecurityExceptionMethod add.- Parameters:
keyname-- Throws:
XWSSecurityException
-
addKeyValue
public void addKeyValue(PublicKey pk)
Method addKeyValue- Parameters:
pk-
-
addUnknownKeyValue
public void addUnknownKeyValue(jakarta.xml.soap.SOAPElement unknownKeyValueElement)
Method addKeyValue- Parameters:
unknownKeyValueElement-
-
addDSAKeyValue
public void addDSAKeyValue(jakarta.xml.soap.SOAPElement dsakeyvalue) throws XWSSecurityExceptionMethod add- Parameters:
dsakeyvalue-- Throws:
XWSSecurityException
-
addRSAKeyValue
public void addRSAKeyValue(jakarta.xml.soap.SOAPElement rsakeyvalue) throws XWSSecurityExceptionMethod add- Parameters:
rsakeyvalue-- Throws:
XWSSecurityException
-
addKeyValue
public void addKeyValue(jakarta.xml.soap.SOAPElement keyvalue) throws XWSSecurityExceptionMethod addKeyValue- Parameters:
keyvalue-- Throws:
XWSSecurityException
-
addMgmtData
public void addMgmtData(String mgmtdata)
Method addMgmtData- Parameters:
mgmtdata-
-
addMgmtData
public void addMgmtData(jakarta.xml.soap.SOAPElement mgmtdata) throws XWSSecurityExceptionMethod add- Parameters:
mgmtdata-- Throws:
XWSSecurityException
-
addPGPData
public void addPGPData(jakarta.xml.soap.SOAPElement pgpdata) throws XWSSecurityExceptionMethod addPGPData- Parameters:
pgpdata-- Throws:
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(jakarta.xml.soap.SOAPElement retrievalmethod) throws XWSSecurityExceptionMethod addRetrievalMethod- Parameters:
retrievalmethod-- Throws:
XWSSecurityException
-
addSPKIData
public void addSPKIData(jakarta.xml.soap.SOAPElement spkidata) throws XWSSecurityExceptionMethod add- Parameters:
spkidata-- Throws:
XWSSecurityException
-
addX509Data
public void addX509Data(jakarta.xml.soap.SOAPElement x509data) throws XWSSecurityExceptionMethod addX509Data- Parameters:
x509data-- Throws:
XWSSecurityException
-
addUnknownElement
public void addUnknownElement(jakarta.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 jakarta.xml.soap.SOAPElement getKeyName(int index) throws XWSSecurityExceptionMethod getKeyName- Parameters:
index- 0 is the lowest index- Throws:
XWSSecurityException
-
getKeyNameString
public String getKeyNameString(int index) throws XWSSecurityException
Method getKeyNameString- Parameters:
index- 0 is the lowest index- Throws:
XWSSecurityException
-
getKeyValueElement
public jakarta.xml.soap.SOAPElement getKeyValueElement(int index) throws XWSSecurityExceptionMethod getKeyValueElement- Parameters:
index- 0 is the lowest index- Throws:
XWSSecurityException
-
getKeyValue
public org.apache.xml.security.keys.content.KeyValue getKeyValue(int index) throws XWSSecurityExceptionMethod getKeyValue- Parameters:
index- 0 is the lowest index- Throws:
XWSSecurityException
-
getMgmtData
public jakarta.xml.soap.SOAPElement getMgmtData(int index) throws XWSSecurityExceptionMethod getMgmtData- Parameters:
index- 0 is the lowest index- Throws:
XWSSecurityException
-
getPGPData
public jakarta.xml.soap.SOAPElement getPGPData(int index) throws XWSSecurityExceptionMethod getPGPData- Parameters:
index- 0 is the lowest index- Throws:
XWSSecurityException
-
getRetrievalMethod
public jakarta.xml.soap.SOAPElement getRetrievalMethod(int index) throws XWSSecurityExceptionMethod getRetrievalMethod- Parameters:
index- 0 is the lowest index- Throws:
XWSSecurityException
-
getSPKIData
public jakarta.xml.soap.SOAPElement getSPKIData(int index) throws XWSSecurityExceptionMethod getSPKIData- Parameters:
index- 0 is the lowest index- Throws:
XWSSecurityException
-
getX509DataElement
public jakarta.xml.soap.SOAPElement getX509DataElement(int index) throws XWSSecurityExceptionMethod getX509DataElement- Parameters:
index- 0 is the lowest index- Throws:
XWSSecurityException
-
getX509Data
public org.apache.xml.security.keys.content.X509Data getX509Data(int index) throws XWSSecurityExceptionMethod getX509Data- Parameters:
index- 0 is the lowest index- Throws:
XWSSecurityException
-
getUnknownElement
public jakarta.xml.soap.SOAPElement getUnknownElement(int index) throws XWSSecurityExceptionMethod getUnknownElement- Parameters:
index- 0 is the lowest index- Throws:
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 XWSSecurityException
Method addSecurityTokenReference- Parameters:
reference-- Throws:
XWSSecurityException
-
getSecurityTokenReference
public SecurityTokenReference getSecurityTokenReference(int index) throws XWSSecurityException
Method getSecurityTokenReference- Parameters:
index-- Returns:
- the index^th token reference element from the KeyInfo 0 is the lowest index.
- Throws:
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 XWSSecurityException
Method addEncryptedKey- Parameters:
reference-- Throws:
XWSSecurityException
-
getEncryptedKey
public EncryptedKeyToken getEncryptedKey(int index) throws XWSSecurityException
Method getEncryptedKey- Parameters:
index-- Returns:
- the index^th token reference element from the KeyInfo 0 is the lowest index.
- Throws:
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 BinarySecret getBinarySecret(int index) throws XWSSecurityException
- Throws:
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
public void setId(String id)
Method setId
-
getId
public String 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
public void setBaseURI(String uri)
Method setBaseURI : BaseURI accepted by Apache KeyInfo Ctor- Parameters:
uri- Base URI to be used as context for all relative URIs.
-
getAsSoapElement
public jakarta.xml.soap.SOAPElement getAsSoapElement() throws XWSSecurityExceptionMethod to return the KeyInfo as a SOAPElement.- Specified by:
getAsSoapElementin interfaceSecurityHeaderBlock- Overrides:
getAsSoapElementin classSecurityHeaderBlockImpl- Returns:
- SOAPElement
- Throws:
XWSSecurityException- If owner soap document is not set.- See Also:
setDocument(Document)
-
setDocument
public void setDocument(Document doc)
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(jakarta.xml.soap.SOAPElement element) throws XWSSecurityException
- Throws:
XWSSecurityException
-
addX509Data
public void addX509Data(org.apache.xml.security.keys.content.X509Data x509Data) throws XWSSecurityException- Throws:
XWSSecurityException
-
-