Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.security.keys

public Class KeyInfo

extends SignatureElementProxy
Class Inheritance
Imports
java.security.PrivateKey, .PublicKey, java.security.cert.X509Certificate, java.util.ArrayList, .Iterator, .List, javax.crypto.SecretKey, com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException, com.sun.org.apache.xml.internal.security.keys.content.DEREncodedKeyValue, .KeyInfoReference, .KeyName, .KeyValue, .MgmtData, .PGPData, .RetrievalMethod, .SPKIData, .X509Data, com.sun.org.apache.xml.internal.security.keys.content.keyvalues.DSAKeyValue, .RSAKeyValue, com.sun.org.apache.xml.internal.security.keys.keyresolver.KeyResolver, .KeyResolverException, .KeyResolverSpi, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver, com.sun.org.apache.xml.internal.security.transforms.Transforms, com.sun.org.apache.xml.internal.security.utils.Constants, .ElementProxy, .SignatureElementProxy, .XMLUtils, org.w3c.dom.Attr, .Document, .Element, .Node

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 lengthXXX() methods provide access to the internal Key objects: 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.

Field Summary

Modifier and TypeField and Description
private List<KeyResolverSpi>
internalKeyResolvers

Stores the individual (per-KeyInfo) KeyResolverSpis

private static final Logger
private static final List<StorageResolver>
private boolean
private List<StorageResolver>
storageResolvers

Field storageResolvers

private List<X509Data>

Constructor Summary

AccessConstructor and Description
public
KeyInfo(Document doc)

Constructor KeyInfo

public
KeyInfo(Element element, String baseURI)

Constructor KeyInfo

Method Summary

Modifier and TypeMethod and Description
public void
add(KeyName keyname)

Method add

public void
add(DSAKeyValue dsakeyvalue)

Method add

public void
add(RSAKeyValue rsakeyvalue)

Method add

public void
add(PublicKey pk)

Method add

public void
add(KeyValue keyvalue)

Method add

public void
add(MgmtData mgmtdata)

Method add

public void
add(PGPData pgpdata)

Method addPGPData

public void
add(RetrievalMethod retrievalmethod)

Method add

public void
add(SPKIData spkidata)

Method add

public void
add(X509Data x509data)

Method addX509Data

public void
add(DEREncodedKeyValue derEncodedKeyValue)

Method add

public void
add(KeyInfoReference keyInfoReference)

Method add

public void
addDEREncodedKeyValue(PublicKey pk)

Method addDEREncodedKeyValue

public void
addKeyInfoReference(String URI)

Method addKeyInfoReference

public void
addKeyName(String keynameString)

Method addKeyName

public void
addKeyValue(PublicKey pk)

Method addKeyValue

public void
addKeyValue(Element unknownKeyValueElement)

Method addKeyValue

public void
addMgmtData(String mgmtdata)

Method addMgmtData

public void
addRetrievalMethod(String uri, Transforms transforms, String Type)

Method addRetrievalMethod

public void
addStorageResolver(StorageResolver storageResolver)

Method addStorageResolver

public void
addUnknownElement(Element element)

Method addUnknownElement

private X509Certificate
public boolean

Returns:

If the KeyInfo contains a DEREncodedKeyValue node
containsDEREncodedKeyValue
()

Method containsDEREncodedKeyValue

public boolean

Returns:

If the KeyInfo contains a KeyInfoReference node
containsKeyInfoReference
()

Method containsKeyInfoReference

public boolean

Returns:

If the KeyInfo contains a KeyName node
containsKeyName
()

Method containsKeyName

public boolean

Returns:

If the KeyInfo contains a KeyValue node
containsKeyValue
()

Method containsKeyValue

public boolean

Returns:

If the KeyInfo contains a MgmtData node
containsMgmtData
()

Method containsMgmtData

public boolean

Returns:

If the KeyInfo contains a PGPData node
containsPGPData
()

Method containsPGPData

public boolean

Returns:

If the KeyInfo contains a RetrievalMethod node
containsRetrievalMethod
()

Method containsRetrievalMethod

public boolean

Returns:

If the KeyInfo contains a SPKIData node
containsSPKIData
()

Method containsSPKIData

public boolean

Returns:

If the KeyInfo contains a UnknownElement node
containsUnknownElement
()

Method containsUnknownElement

public boolean

Returns:

If the KeyInfo contains a X509Data node
containsX509Data
()

Method containsX509Data

public String
getBaseLocalName()

Implements abstract com.sun.org.apache.xml.internal.security.utils.ElementProxy.getBaseLocalName.

Returns the localname of the Elements of the sub-class.

public String

Returns:

the Id attribute
getId
()

Returns the Id attribute

public PrivateKey

Returns:

the private key contained in this KeyInfo
getPrivateKey
()

This method returns a private key.

pack-priv PrivateKey

Returns:

the private key contained in this KeyInfo
getPrivateKeyFromInternalResolvers
()

Searches the per-KeyInfo KeyResolvers for private keys

pack-priv PrivateKey

Returns:

the private key contained in this KeyInfo
getPrivateKeyFromStaticResolvers
()

Searches the library wide KeyResolvers for Private keys

public PublicKey

Returns:

If the KeyInfo contains a PublicKey node
getPublicKey
()

This method returns the public key.

pack-priv PublicKey

Returns:

The public key contained in this Node.
getPublicKeyFromInternalResolvers
()

Searches the per-KeyInfo KeyResolvers for public keys

pack-priv PublicKey

Returns:

The public key contained in this Node.
getPublicKeyFromStaticResolvers
()

Searches the library wide KeyResolvers for public keys

public SecretKey

Returns:

the secret key contained in this KeyInfo
getSecretKey
()

This method returns a secret (symmetric) key.

pack-priv SecretKey

Returns:

the secret key contained in this KeyInfo
getSecretKeyFromInternalResolvers
()

Searches the per-KeyInfo KeyResolvers for secret keys

pack-priv SecretKey

Returns:

the secret key contained in this KeyInfo
getSecretKeyFromStaticResolvers
()

Searches the library wide KeyResolvers for Secret keys

public X509Certificate

Returns:

The certificate contained in this KeyInfo
getX509Certificate
()

Method getX509Certificate

pack-priv X509Certificate

Returns:

The certificate contained in this KeyInfo
getX509CertificateFromInternalResolvers
()

Method getX509CertificateFromInternalResolvers

pack-priv X509Certificate

Returns:

The certificate contained in this KeyInfo
getX509CertificateFromStaticResolvers
()

This method uses each System-wide KeyResolver to search the child elements.

public boolean

Returns:

true if the element has no descendants.
isEmpty
()

Method isEmpty

public DEREncodedKeyValue

Returns:

the asked DEREncodedKeyValue element, null if the index is too big
itemDEREncodedKeyValue
(int i)

Method itemDEREncodedKeyValue

pack-priv KeyResolverSpi

Returns:

the KeyResolverSpi for the index.
itemInternalKeyResolver
(int
the index
i
)

Method itemInternalKeyResolver

public KeyInfoReference

Returns:

the asked KeyInfoReference element, null if the index is too big
itemKeyInfoReference
(int i)

Method itemKeyInfoReference

public KeyName

Returns:

the asked KeyName element, null if the index is too big
itemKeyName
(int i)

Method itemKeyName

public KeyValue

Returns:

the asked KeyValue element, null if the index is too big
itemKeyValue
(int i)

Method itemKeyValue

public MgmtData

Returns:

the asked MgmtData element, null if the index is too big
itemMgmtData
(int i)

Method itemMgmtData

public PGPData

Returns:

the asked PGPData element, null if the index is too big
itemPGPData
(int i)

Method itemPGPData

public RetrievalMethod

Returns:

the asked RetrievalMethod element, null if the index is too big
itemRetrievalMethod
(int i)

Method itemRetrievalMethod

public SPKIData

Returns:

the asked SPKIData element, null if the index is too big
itemSPKIData
(int i)

Method itemSPKIData

public Element

Returns:

the element number of the unknown elements
itemUnknownElement
(int
index
i
)

Method itemUnknownElement

public X509Data

Returns:

the asked X509Data element, null if the index is too big
itemX509Data
(int i)

Method itemX509Data

public int

Returns:

the number of the DEREncodedKeyValue tags
lengthDEREncodedKeyValue
()

Method lengthDEREncodedKeyValue

pack-priv int

Returns:

the length of the key
lengthInternalKeyResolver
()

Method lengthInternalKeyResolver

public int

Returns:

the number of the KeyInfoReference tags
lengthKeyInfoReference
()

Method lengthKeyInfoReference

public int

Returns:

the number of the KeyName tags
lengthKeyName
()

Method lengthKeyName

public int

Returns:

the number of the KeyValue tags
lengthKeyValue
()

Method lengthKeyValue

public int

Returns:

the number of the MgmtData tags
lengthMgmtData
()

Method lengthMgmtData

public int

Returns:

the number of the PGPDat. tags
lengthPGPData
()

Method lengthPGPData

public int

Returns:

the number of the RetrievalMethod tags
lengthRetrievalMethod
()

Method lengthRetrievalMethod

public int

Returns:

the number of the SPKIData tags
lengthSPKIData
()

Method lengthSPKIData

public int

Returns:

the number of the UnknownElement tags
lengthUnknownElement
()

Method lengthUnknownElement NOTE possibly buggy.

public int

Returns:

the number of the X509Data tags
lengthX509Data
()

Method lengthX509Data

public void
registerInternalKeyResolver(KeyResolverSpi realKeyResolver)

This method is used to add a custom KeyResolverSpi to a KeyInfo object.

public void
setId(String
ID
id
)

Sets the Id attribute

public void
setSecureValidation(boolean secureValidation)

Set whether secure processing is enabled or not.

Inherited from com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy:
getBaseNamespace

Field Detail

internalKeyResolversback to summary
private List<KeyResolverSpi> internalKeyResolvers

Stores the individual (per-KeyInfo) KeyResolverSpis

LOGback to summary
private static final Logger LOG

Hides com.sun.org.apache.xml.internal.security.utils.ElementProxy.LOG.

nullListback to summary
private static final List<StorageResolver> nullList
secureValidationback to summary
private boolean secureValidation
storageResolversback to summary
private List<StorageResolver> storageResolvers

Field storageResolvers

x509Datasback to summary
private List<X509Data> x509Datas

Constructor Detail

KeyInfoback to summary
public KeyInfo(Document doc)

Constructor KeyInfo

KeyInfoback to summary
public KeyInfo(Element element, String baseURI) throws XMLSecurityException

Constructor KeyInfo

Method Detail

addback to summary
public void add(KeyName keyname)

Method add

addback to summary
public void add(DSAKeyValue dsakeyvalue)

Method add

addback to summary
public void add(RSAKeyValue rsakeyvalue)

Method add

addback to summary
public void add(PublicKey pk)

Method add

addback to summary
public void add(KeyValue keyvalue)

Method add

addback to summary
public void add(MgmtData mgmtdata)

Method add

addback to summary
public void add(PGPData pgpdata)

Method addPGPData

addback to summary
public void add(RetrievalMethod retrievalmethod)

Method add

addback to summary
public void add(SPKIData spkidata)

Method add

addback to summary
public void add(X509Data x509data)

Method addX509Data

addback to summary
public void add(DEREncodedKeyValue derEncodedKeyValue)

Method add

addback to summary
public void add(KeyInfoReference keyInfoReference)

Method add

addDEREncodedKeyValueback to summary
public void addDEREncodedKeyValue(PublicKey pk) throws XMLSecurityException

Method addDEREncodedKeyValue

addKeyInfoReferenceback to summary
public void addKeyInfoReference(String URI) throws XMLSecurityException

Method addKeyInfoReference

addKeyNameback to summary
public void addKeyName(String keynameString)

Method addKeyName

addKeyValueback to summary
public void addKeyValue(PublicKey pk)

Method addKeyValue

addKeyValueback to summary
public void addKeyValue(Element unknownKeyValueElement)

Method addKeyValue

addMgmtDataback to summary
public void addMgmtData(String mgmtdata)

Method addMgmtData

addRetrievalMethodback to summary
public void addRetrievalMethod(String uri, Transforms transforms, String Type)

Method addRetrievalMethod

addStorageResolverback to summary
public void addStorageResolver(StorageResolver storageResolver)

Method addStorageResolver

addUnknownElementback to summary
public void addUnknownElement(Element element)

Method addUnknownElement

applyCurrentResolverback to summary
private X509Certificate applyCurrentResolver(String uri, KeyResolverSpi keyResolver) throws KeyResolverException
containsDEREncodedKeyValueback to summary
public boolean containsDEREncodedKeyValue()

Method containsDEREncodedKeyValue

Returns:boolean

If the KeyInfo contains a DEREncodedKeyValue node

containsKeyInfoReferenceback to summary
public boolean containsKeyInfoReference()

Method containsKeyInfoReference

Returns:boolean

If the KeyInfo contains a KeyInfoReference node

containsKeyNameback to summary
public boolean containsKeyName()

Method containsKeyName

Returns:boolean

If the KeyInfo contains a KeyName node

containsKeyValueback to summary
public boolean containsKeyValue()

Method containsKeyValue

Returns:boolean

If the KeyInfo contains a KeyValue node

containsMgmtDataback to summary
public boolean containsMgmtData()

Method containsMgmtData

Returns:boolean

If the KeyInfo contains a MgmtData node

containsPGPDataback to summary
public boolean containsPGPData()

Method containsPGPData

Returns:boolean

If the KeyInfo contains a PGPData node

containsRetrievalMethodback to summary
public boolean containsRetrievalMethod()

Method containsRetrievalMethod

Returns:boolean

If the KeyInfo contains a RetrievalMethod node

containsSPKIDataback to summary
public boolean containsSPKIData()

Method containsSPKIData

Returns:boolean

If the KeyInfo contains a SPKIData node

containsUnknownElementback to summary
public boolean containsUnknownElement()

Method containsUnknownElement

Returns:boolean

If the KeyInfo contains a UnknownElement node

containsX509Databack to summary
public boolean containsX509Data()

Method containsX509Data

Returns:boolean

If the KeyInfo contains a X509Data node

getBaseLocalNameback to summary
public String getBaseLocalName()

Implements abstract com.sun.org.apache.xml.internal.security.utils.ElementProxy.getBaseLocalName.

Doc from com.sun.org.apache.xml.internal.security.utils.ElementProxy.getBaseLocalName.

Returns the localname of the Elements of the sub-class.

Returns:String

the localname of the Elements of the sub-class.

Annotations
@Override
getIdback to summary
public String getId()

Returns the Id attribute

Returns:String

the Id attribute

getPrivateKeyback to summary
public PrivateKey getPrivateKey() throws KeyResolverException

This method returns a private key. This is for Key Transport in XML Encryption.

Returns:PrivateKey

the private key contained in this KeyInfo

getPrivateKeyFromInternalResolversback to summary
pack-priv PrivateKey getPrivateKeyFromInternalResolvers() throws KeyResolverException

Searches the per-KeyInfo KeyResolvers for private keys

Returns:PrivateKey

the private key contained in this KeyInfo

getPrivateKeyFromStaticResolversback to summary
pack-priv PrivateKey getPrivateKeyFromStaticResolvers() throws KeyResolverException

Searches the library wide KeyResolvers for Private keys

Returns:PrivateKey

the private key contained in this KeyInfo

getPublicKeyback to summary
public PublicKey getPublicKey() throws KeyResolverException

This method returns the public key.

Returns:PublicKey

If the KeyInfo contains a PublicKey node

getPublicKeyFromInternalResolversback to summary
pack-priv PublicKey getPublicKeyFromInternalResolvers() throws KeyResolverException

Searches the per-KeyInfo KeyResolvers for public keys

Returns:PublicKey

The public key contained in this Node.

getPublicKeyFromStaticResolversback to summary
pack-priv PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException

Searches the library wide KeyResolvers for public keys

Returns:PublicKey

The public key contained in this Node.

getSecretKeyback to summary
public SecretKey getSecretKey() throws KeyResolverException

This method returns a secret (symmetric) key. This is for XML Encryption.

Returns:SecretKey

the secret key contained in this KeyInfo

getSecretKeyFromInternalResolversback to summary
pack-priv SecretKey getSecretKeyFromInternalResolvers() throws KeyResolverException

Searches the per-KeyInfo KeyResolvers for secret keys

Returns:SecretKey

the secret key contained in this KeyInfo

getSecretKeyFromStaticResolversback to summary
pack-priv SecretKey getSecretKeyFromStaticResolvers() throws KeyResolverException

Searches the library wide KeyResolvers for Secret keys

Returns:SecretKey

the secret key contained in this KeyInfo

getX509Certificateback to summary
public X509Certificate getX509Certificate() throws KeyResolverException

Method getX509Certificate

Returns:X509Certificate

The certificate contained in this KeyInfo

getX509CertificateFromInternalResolversback to summary
pack-priv X509Certificate getX509CertificateFromInternalResolvers() throws KeyResolverException

Method getX509CertificateFromInternalResolvers

Returns:X509Certificate

The certificate contained in this KeyInfo

getX509CertificateFromStaticResolversback to summary
pack-priv X509Certificate getX509CertificateFromStaticResolvers() throws KeyResolverException

This method uses each System-wide KeyResolver to search the child elements. Each combination of KeyResolver and child element is checked against all StorageResolvers.

Returns:X509Certificate

The certificate contained in this KeyInfo

isEmptyback to summary
public boolean isEmpty()

Method isEmpty

Returns:boolean

true if the element has no descendants.

itemDEREncodedKeyValueback to summary
public DEREncodedKeyValue itemDEREncodedKeyValue(int i) throws XMLSecurityException

Method itemDEREncodedKeyValue

Returns:DEREncodedKeyValue

the asked DEREncodedKeyValue element, null if the index is too big

itemInternalKeyResolverback to summary
pack-priv KeyResolverSpi itemInternalKeyResolver(int i)

Method itemInternalKeyResolver

Parameters
i:int

the index

Returns:KeyResolverSpi

the KeyResolverSpi for the index.

itemKeyInfoReferenceback to summary
public KeyInfoReference itemKeyInfoReference(int i) throws XMLSecurityException

Method itemKeyInfoReference

Returns:KeyInfoReference

the asked KeyInfoReference element, null if the index is too big

itemKeyNameback to summary
public KeyName itemKeyName(int i) throws XMLSecurityException

Method itemKeyName

Returns:KeyName

the asked KeyName element, null if the index is too big

itemKeyValueback to summary
public KeyValue itemKeyValue(int i) throws XMLSecurityException

Method itemKeyValue

Returns:KeyValue

the asked KeyValue element, null if the index is too big

itemMgmtDataback to summary
public MgmtData itemMgmtData(int i) throws XMLSecurityException

Method itemMgmtData

Returns:MgmtData

the asked MgmtData element, null if the index is too big

itemPGPDataback to summary
public PGPData itemPGPData(int i) throws XMLSecurityException

Method itemPGPData

Returns:PGPData

the asked PGPData element, null if the index is too big

itemRetrievalMethodback to summary
public RetrievalMethod itemRetrievalMethod(int i) throws XMLSecurityException

Method itemRetrievalMethod

Returns:RetrievalMethod

the asked RetrievalMethod element, null if the index is too big

itemSPKIDataback to summary
public SPKIData itemSPKIData(int i) throws XMLSecurityException

Method itemSPKIData

Returns:SPKIData

the asked SPKIData element, null if the index is too big

itemUnknownElementback to summary
public Element itemUnknownElement(int i)

Method itemUnknownElement

Parameters
i:int

index

Returns:Element

the element number of the unknown elements

itemX509Databack to summary
public X509Data itemX509Data(int i) throws XMLSecurityException

Method itemX509Data

Returns:X509Data

the asked X509Data element, null if the index is too big

lengthDEREncodedKeyValueback to summary
public int lengthDEREncodedKeyValue()

Method lengthDEREncodedKeyValue

Returns:int

the number of the DEREncodedKeyValue tags

lengthInternalKeyResolverback to summary
pack-priv int lengthInternalKeyResolver()

Method lengthInternalKeyResolver

Returns:int

the length of the key

lengthKeyInfoReferenceback to summary
public int lengthKeyInfoReference()

Method lengthKeyInfoReference

Returns:int

the number of the KeyInfoReference tags

lengthKeyNameback to summary
public int lengthKeyName()

Method lengthKeyName

Returns:int

the number of the KeyName tags

lengthKeyValueback to summary
public int lengthKeyValue()

Method lengthKeyValue

Returns:int

the number of the KeyValue tags

lengthMgmtDataback to summary
public int lengthMgmtData()

Method lengthMgmtData

Returns:int

the number of the MgmtData tags

lengthPGPDataback to summary
public int lengthPGPData()

Method lengthPGPData

Returns:int

the number of the PGPDat. tags

lengthRetrievalMethodback to summary
public int lengthRetrievalMethod()

Method lengthRetrievalMethod

Returns:int

the number of the RetrievalMethod tags

lengthSPKIDataback to summary
public int lengthSPKIData()

Method lengthSPKIData

Returns:int

the number of the SPKIData tags

lengthUnknownElementback to summary
public int lengthUnknownElement()

Method lengthUnknownElement NOTE possibly buggy.

Returns:int

the number of the UnknownElement tags

lengthX509Databack to summary
public int lengthX509Data()

Method lengthX509Data

Returns:int

the number of the X509Data tags

registerInternalKeyResolverback to summary
public void registerInternalKeyResolver(KeyResolverSpi realKeyResolver)

This method is used to add a custom KeyResolverSpi to a KeyInfo object.

setIdback to summary
public void setId(String id)

Sets the Id attribute

Parameters
id:String

ID

setSecureValidationback to summary
public void setSecureValidation(boolean secureValidation)

Set whether secure processing is enabled or not. The default is false.