Package org.apache.xml.security.keys
Class KeyInfo
java.lang.Object
org.apache.xml.security.utils.ElementProxy
org.apache.xml.security.utils.SignatureElementProxy
org.apache.xml.security.keys.KeyInfo
This class stand for KeyInfo Element that may contain keys, names,
certificates and other public key management information,
such as in-band key distribution or key agreement data.
KeyInfo Element has two basic functions: One is KeyResolve for getting the public key in signature validation processing. the other one is toElement for getting the element in signature generation processing.
The
The
The
The
KeyInfo Element has two basic functions: One is KeyResolve for getting the public key in signature validation processing. the other one is toElement for getting the element in signature generation processing.
The
lengthXXX()
methods provide access to the internal Key
objects:
- If the
KeyInfo
was constructed from an Element (Signature verification), thelengthXXX()
methods searches for child elements ofds:KeyInfo
for known types. - If the
KeyInfo
was constructed from scratch (during Signature generation), thelengthXXX()
methods return the number ofXXXs
objects already passed to the KeyInfo
The
addXXX()
methods are used for adding Objects of the
appropriate type to the KeyInfo
. This is used during signature
generation.
The
itemXXX(int i)
methods return the i'th object of the
corresponding type.
The
containsXXX()
methods return whether the KeyInfo
contains the corresponding type.- Author:
- $Author$
-
Field Summary
Fields inherited from class org.apache.xml.security.utils.ElementProxy
_baseURI, _constructionElement, _doc, _state, MODE_CREATE, MODE_DECRYPT, MODE_ENCRYPT, MODE_PROCESS, MODE_SIGN, MODE_UNKNOWN, MODE_VERIFY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Method addvoid
add
(EncryptedKey encryptedKey) Method addEncryptedKeyvoid
Method addvoid
Method addvoid
add
(DSAKeyValue dsakeyvalue) Method addvoid
add
(RSAKeyValue rsakeyvalue) Method addvoid
Method addvoid
Method addPGPDatavoid
add
(RetrievalMethod retrievalmethod) Method addvoid
Method addvoid
Method addX509Datavoid
addKeyName
(String keynameString) Method addKeyNamevoid
addKeyValue
(PublicKey pk) Method addKeyValuevoid
addKeyValue
(Element unknownKeyValueElement) Method addKeyValuevoid
addMgmtData
(String mgmtdata) Method addMgmtDatavoid
addRetrievalMethod
(String URI, Transforms transforms, String Type) Method addRetrievalMethodvoid
addStorageResolver
(StorageResolver storageResolver) Method addStorageResolvervoid
addUnknownElement
(Element element) Method addUnknownElementboolean
Method containsKeyNameboolean
Method containsKeyValueboolean
Method containsMgmtDataboolean
Method containsPGPDataboolean
Method containsRetrievalMethodboolean
Method containsSPKIDataboolean
Method containsUnknownElementboolean
Method containsX509DataReturns the localname of the Elements of the sub-class.getId()
Returns theId
attributeThis method returns the public key.This method returns a secret (symmetric) key.Method getX509Certificatestatic void
init()
init the keyinfo (Still needed?)boolean
isEmpty()
Method isEmptyitemEncryptedKey
(int i) Method itemEncryptedKeyitemKeyName
(int i) Method itemKeyNameitemKeyValue
(int i) Method itemKeyValueitemMgmtData
(int i) Method itemMgmtDataitemPGPData
(int i) Method itemPGPDataitemRetrievalMethod
(int i) Method itemRetrievalMethoditemSPKIData
(int i) Method itemSPKIDataitemUnknownElement
(int i) Method itemUnknownElementitemX509Data
(int i) Method itemX509Dataint
Method lengthKeyNameint
Method lengthKeyValueint
Method lengthMgmtDataint
Method lengthPGPDataint
Method lengthRetrievalMethodint
Method lengthSPKIDataint
Method lengthUnknownElement NOTE posibly buggy.int
Method lengthX509Datavoid
registerInternalKeyResolver
(KeyResolverSpi realKeyResolver) This method is used to add a customKeyResolverSpi
to a KeyInfo object.void
Sets theId
attributeMethods inherited from class org.apache.xml.security.utils.SignatureElementProxy
getBaseNamespace
Methods inherited from class org.apache.xml.security.utils.ElementProxy
addBase64Element, addBase64Text, addBigIntegerElement, addText, addTextElement, createElementForFamily, getBaseURI, getBigIntegerFromChildElement, getBytesFromChildElement, getBytesFromTextChild, getDefaultPrefix, getDocument, getElement, getElementPlusReturns, getTextFromChildElement, getTextFromTextChild, guaranteeThatElementInCorrectSpace, length, setDefaultPrefix, setElement, setXPathNamespaceContext
-
Constructor Details
-
KeyInfo
Constructor KeyInfo- Parameters:
doc
-
-
KeyInfo
Constructor KeyInfo- Parameters:
element
-BaseURI
-- Throws:
XMLSecurityException
-
-
Method Details
-
setId
Sets theId
attribute- Parameters:
Id
- ID
-
getId
Returns theId
attribute- Returns:
- the
Id
attribute
-
addKeyName
Method addKeyName- Parameters:
keynameString
-
-
add
Method add- Parameters:
keyname
-
-
addKeyValue
Method addKeyValue- Parameters:
pk
-
-
addKeyValue
Method addKeyValue- Parameters:
unknownKeyValueElement
-
-
add
Method add- Parameters:
dsakeyvalue
-
-
add
Method add- Parameters:
rsakeyvalue
-
-
add
Method add- Parameters:
pk
-
-
add
Method add- Parameters:
keyvalue
-
-
addMgmtData
Method addMgmtData- Parameters:
mgmtdata
-
-
add
Method add- Parameters:
mgmtdata
-
-
add
Method addPGPData- Parameters:
pgpdata
-
-
addRetrievalMethod
Method addRetrievalMethod- Parameters:
URI
-transforms
-Type
-
-
add
Method add- Parameters:
retrievalmethod
-
-
add
Method add- Parameters:
spkidata
-
-
add
Method addX509Data- Parameters:
x509data
-
-
add
Method addEncryptedKey- Parameters:
encryptedKey
-- Throws:
XMLEncryptionException
-
addUnknownElement
Method addUnknownElement- Parameters:
element
-
-
lengthKeyName
public int lengthKeyName()Method lengthKeyName- Returns:
- the number of the KeyName tags
-
lengthKeyValue
public int lengthKeyValue()Method lengthKeyValue- Returns:
- the number of the KeyValue tags
-
lengthMgmtData
public int lengthMgmtData()Method lengthMgmtData- Returns:
- the number of the MgmtData tags
-
lengthPGPData
public int lengthPGPData()Method lengthPGPData- Returns:
- the number of the PGPDat. tags
-
lengthRetrievalMethod
public int lengthRetrievalMethod()Method lengthRetrievalMethod- Returns:
- the number of the RetrievalMethod tags
-
lengthSPKIData
public int lengthSPKIData()Method lengthSPKIData- Returns:
- the number of the SPKIData tags
-
lengthX509Data
public int lengthX509Data()Method lengthX509Data- Returns:
- the number of the X509Data tags
-
lengthUnknownElement
public int lengthUnknownElement()Method lengthUnknownElement NOTE posibly buggy.- Returns:
- the number of the UnknownElement tags
-
itemKeyName
Method itemKeyName- Parameters:
i
-- Returns:
- the asked KeyName element, null if the index is too big
- Throws:
XMLSecurityException
-
itemKeyValue
Method itemKeyValue- Parameters:
i
-- Returns:
- the asked KeyValue element, null if the index is too big
- Throws:
XMLSecurityException
-
itemMgmtData
Method itemMgmtData- Parameters:
i
-- Returns:
- the asked MgmtData element, null if the index is too big
- Throws:
XMLSecurityException
-
itemPGPData
Method itemPGPData- Parameters:
i
-- Returns:
- the asked PGPData element, null if the index is too big
- Throws:
XMLSecurityException
-
itemRetrievalMethod
Method itemRetrievalMethod- Parameters:
i
-- Returns:
- the asked RetrievalMethod element, null if the index is too big
- Throws:
XMLSecurityException
-
itemSPKIData
Method itemSPKIData- Parameters:
i
-- Returns:
- the asked SPKIData element, null if the index is too big
- Throws:
XMLSecurityException
-
itemX509Data
Method itemX509Data- Parameters:
i
-- Returns:
- the asked X509Data element, null if the index is too big
- Throws:
XMLSecurityException
-
itemEncryptedKey
Method itemEncryptedKey- Parameters:
i
-- Returns:
- the asked EncryptedKey element, null if the index is too big
- Throws:
XMLSecurityException
-
itemUnknownElement
Method itemUnknownElement- Parameters:
i
- index- Returns:
- the element number of the unknown elemens
-
isEmpty
public boolean isEmpty()Method isEmpty- Returns:
- true if the element has no descedants.
-
containsKeyName
public boolean containsKeyName()Method containsKeyName- Returns:
- If the KeyInfo contains a KeyName node
-
containsKeyValue
public boolean containsKeyValue()Method containsKeyValue- Returns:
- If the KeyInfo contains a KeyValue node
-
containsMgmtData
public boolean containsMgmtData()Method containsMgmtData- Returns:
- If the KeyInfo contains a MgmtData node
-
containsPGPData
public boolean containsPGPData()Method containsPGPData- Returns:
- If the KeyInfo contains a PGPData node
-
containsRetrievalMethod
public boolean containsRetrievalMethod()Method containsRetrievalMethod- Returns:
- If the KeyInfo contains a RetrievalMethod node
-
containsSPKIData
public boolean containsSPKIData()Method containsSPKIData- Returns:
- If the KeyInfo contains a SPKIData node
-
containsUnknownElement
public boolean containsUnknownElement()Method containsUnknownElement- Returns:
- If the KeyInfo contains a UnknownElement node
-
containsX509Data
public boolean containsX509Data()Method containsX509Data- Returns:
- If the KeyInfo contains a X509Data node
-
getPublicKey
This method returns the public key.- Returns:
- If the KeyInfo contains a PublicKey node
- Throws:
KeyResolverException
-
getX509Certificate
Method getX509Certificate- Returns:
- The certificate contined in this KeyInfo
- Throws:
KeyResolverException
-
getSecretKey
This method returns a secret (symmetric) key. This is for XML Encryption.- Returns:
- the secret key contained in this KeyInfo
- Throws:
KeyResolverException
-
registerInternalKeyResolver
This method is used to add a customKeyResolverSpi
to a KeyInfo object.- Parameters:
realKeyResolver
-
-
addStorageResolver
Method addStorageResolver- Parameters:
storageResolver
-
-
init
public static void init()init the keyinfo (Still needed?) -
getBaseLocalName
Description copied from class:ElementProxy
Returns the localname of the Elements of the sub-class.- Specified by:
getBaseLocalName
in classElementProxy
- Returns:
- the localname of the Elements of the sub-class.
-