Methods Summary |
---|
public void | add(com.sun.org.apache.xml.internal.security.keys.content.keyvalues.RSAKeyValue rsakeyvalue)Method add
this.add(new KeyValue(this._doc, rsakeyvalue));
|
public void | add(java.security.PublicKey pk)Method add
this.add(new KeyValue(this._doc, pk));
|
public void | add(com.sun.org.apache.xml.internal.security.keys.content.KeyValue keyvalue)Method add
if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(keyvalue.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
}
|
public void | add(com.sun.org.apache.xml.internal.security.keys.content.MgmtData mgmtdata)Method add
if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(mgmtdata.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
}
|
public void | add(com.sun.org.apache.xml.internal.security.keys.content.PGPData pgpdata)Method addPGPData
if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(pgpdata.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
}
|
public void | add(com.sun.org.apache.xml.internal.security.keys.content.RetrievalMethod retrievalmethod)Method add
if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(retrievalmethod.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
}
|
public void | add(com.sun.org.apache.xml.internal.security.keys.content.SPKIData spkidata)Method add
if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(spkidata.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
}
|
public void | add(com.sun.org.apache.xml.internal.security.keys.content.X509Data x509data)Method addX509Data
if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(x509data.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
}
|
public void | add(com.sun.org.apache.xml.internal.security.encryption.EncryptedKey encryptedKey)Method addEncryptedKey
if (this._state == MODE_SIGN) {
XMLCipher cipher = XMLCipher.getInstance();
this._constructionElement.appendChild(cipher.martial(encryptedKey));
}
|
public void | add(com.sun.org.apache.xml.internal.security.keys.content.KeyName keyname)Method add
if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(keyname.getElement());
XMLUtils.addReturnToElement(this._constructionElement);
}
|
public void | add(com.sun.org.apache.xml.internal.security.keys.content.keyvalues.DSAKeyValue dsakeyvalue)Method add
this.add(new KeyValue(this._doc, dsakeyvalue));
|
public void | addKeyName(java.lang.String keynameString)Method addKeyName
this.add(new KeyName(this._doc, keynameString));
|
public void | addKeyValue(java.security.PublicKey pk)Method addKeyValue
this.add(new KeyValue(this._doc, pk));
|
public void | addKeyValue(org.w3c.dom.Element unknownKeyValueElement)Method addKeyValue
this.add(new KeyValue(this._doc, unknownKeyValueElement));
|
public void | addMgmtData(java.lang.String mgmtdata)Method addMgmtData
this.add(new MgmtData(this._doc, mgmtdata));
|
public void | addRetrievalMethod(java.lang.String URI, com.sun.org.apache.xml.internal.security.transforms.Transforms transforms, java.lang.String Type)Method addRetrievalMethod
this.add(new RetrievalMethod(this._doc, URI, transforms, Type));
|
public void | addStorageResolver(com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storageResolver)Method addStorageResolver
if (storageResolver != null) {
this._storageResolvers.add(storageResolver);
}
|
public void | addUnknownElement(org.w3c.dom.Element element)Method addUnknownElement
if (this._state == MODE_SIGN) {
this._constructionElement.appendChild(element);
XMLUtils.addReturnToElement(this._constructionElement);
}
|
public boolean | containsKeyName()Method containsKeyName
return this.lengthKeyName() > 0;
|
public boolean | containsKeyValue()Method containsKeyValue
return this.lengthKeyValue() > 0;
|
public boolean | containsMgmtData()Method containsMgmtData
return this.lengthMgmtData() > 0;
|
public boolean | containsPGPData()Method containsPGPData
return this.lengthPGPData() > 0;
|
public boolean | containsRetrievalMethod()Method containsRetrievalMethod
return this.lengthRetrievalMethod() > 0;
|
public boolean | containsSPKIData()Method containsSPKIData
return this.lengthSPKIData() > 0;
|
public boolean | containsUnknownElement()Method containsUnknownElement
return this.lengthUnknownElement() > 0;
|
public boolean | containsX509Data()Method containsX509Data
return this.lengthX509Data() > 0;
|
public java.lang.String | getBaseLocalName()
return Constants._TAG_KEYINFO;
|
public java.lang.String | getId()Returns the Id attribute
return this._constructionElement.getAttributeNS(null, Constants._ATT_ID);
|
public java.security.PublicKey | getPublicKey()This method returns the public key.
PublicKey pk = this.getPublicKeyFromInternalResolvers();
if (pk != null) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "I could find a key using the per-KeyInfo key resolvers");
return pk;
}
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "I couldn't find a key using the per-KeyInfo key resolvers");
pk = this.getPublicKeyFromStaticResolvers();
if (pk != null) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "I could find a key using the system-wide key resolvers");
return pk;
}
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "I couldn't find a key using the system-wide key resolvers");
return null;
|
java.security.PublicKey | getPublicKeyFromInternalResolvers()Searches the per-KeyInfo keyresolvers for public keys
for (int i = 0; i < this.lengthInternalKeyResolver(); i++) {
KeyResolverSpi keyResolver = this.itemInternalKeyResolver(i);
if (true)
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Try " + keyResolver.getClass().getName());
Node currentChild=this._constructionElement.getFirstChild();
while (currentChild!=null) {
if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
if (this._storageResolvers.size() == 0) {
// if we do not have storage resolvers, we verify with null
StorageResolver storage = null;
if (keyResolver.engineCanResolve((Element) currentChild,
this.getBaseURI(),
storage)) {
PublicKey pk =
keyResolver
.engineResolvePublicKey((Element) currentChild, this
.getBaseURI(), storage);
if (pk != null) {
return pk;
}
}
} else {
for (int k = 0; k < this._storageResolvers.size(); k++) {
StorageResolver storage =
(StorageResolver) this._storageResolvers.get(k);
if (keyResolver.engineCanResolve((Element) currentChild,
this.getBaseURI(),
storage)) {
PublicKey pk = keyResolver
.engineResolvePublicKey((Element) currentChild, this
.getBaseURI(), storage);
if (pk != null) {
return pk;
}
}
}
}
}
currentChild=currentChild.getNextSibling();
}
}
return null;
|
java.security.PublicKey | getPublicKeyFromStaticResolvers()Searches the library wide keyresolvers for public keys
for (int i = 0; i < KeyResolver.length(); i++) {
KeyResolver keyResolver = KeyResolver.item(i);
Node currentChild=this._constructionElement.getFirstChild();
while (currentChild!=null) {
if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
if (this._storageResolvers.size() == 0) {
// if we do not have storage resolvers, we verify with null
StorageResolver storage = null;
if (keyResolver.canResolve((Element) currentChild,
this.getBaseURI(), storage)) {
PublicKey pk =
keyResolver.resolvePublicKey((Element) currentChild,
this.getBaseURI(),
storage);
if (pk != null) {
return pk;
}
}
} else {
for (int k = 0; k < this._storageResolvers.size(); k++) {
StorageResolver storage =
(StorageResolver) this._storageResolvers.get(k);
if (keyResolver.canResolve((Element) currentChild,
this.getBaseURI(), storage)) {
PublicKey pk =
keyResolver.resolvePublicKey((Element) currentChild,
this.getBaseURI(),
storage);
if (pk != null) {
return pk;
}
}
}
}
}
currentChild=currentChild.getNextSibling();
}
}
return null;
|
public javax.crypto.SecretKey | getSecretKey()This method returns a secret (symmetric) key. This is for XML Encryption.
SecretKey sk = this.getSecretKeyFromInternalResolvers();
if (sk != null) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "I could find a secret key using the per-KeyInfo key resolvers");
return sk;
}
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "I couldn't find a secret key using the per-KeyInfo key resolvers");
sk = this.getSecretKeyFromStaticResolvers();
if (sk != null) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "I could find a secret key using the system-wide key resolvers");
return sk;
}
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "I couldn't find a secret key using the system-wide key resolvers");
return null;
|
javax.crypto.SecretKey | getSecretKeyFromInternalResolvers()Searches the per-KeyInfo keyresolvers for secret keys
for (int i = 0; i < this.lengthInternalKeyResolver(); i++) {
KeyResolverSpi keyResolver = this.itemInternalKeyResolver(i);
if (true)
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Try " + keyResolver.getClass().getName());
Node currentChild=this._constructionElement.getFirstChild();
while (currentChild!=null) {
if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
if (this._storageResolvers.size() == 0) {
// if we do not have storage resolvers, we verify with null
StorageResolver storage = null;
if (keyResolver.engineCanResolve((Element) currentChild,
this.getBaseURI(),
storage)) {
SecretKey sk =
keyResolver
.engineResolveSecretKey((Element) currentChild, this
.getBaseURI(), storage);
if (sk != null) {
return sk;
}
}
} else {
for (int k = 0; k < this._storageResolvers.size(); k++) {
StorageResolver storage =
(StorageResolver) this._storageResolvers.get(k);
if (keyResolver.engineCanResolve((Element) currentChild,
this.getBaseURI(),
storage)) {
SecretKey sk = keyResolver
.engineResolveSecretKey((Element) currentChild, this
.getBaseURI(), storage);
if (sk != null) {
return sk;
}
}
}
}
}
currentChild=currentChild.getNextSibling();
}
}
return null;
|
javax.crypto.SecretKey | getSecretKeyFromStaticResolvers()Searches the library wide keyresolvers for Secret keys
for (int i = 0; i < KeyResolver.length(); i++) {
KeyResolver keyResolver = KeyResolver.item(i);
Node currentChild=this._constructionElement.getFirstChild();
while (currentChild!=null) {
if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
if (this._storageResolvers.size() == 0) {
// if we do not have storage resolvers, we verify with null
StorageResolver storage = null;
if (keyResolver.canResolve((Element) currentChild,
this.getBaseURI(), storage)) {
SecretKey sk =
keyResolver.resolveSecretKey((Element) currentChild,
this.getBaseURI(),
storage);
if (sk != null) {
return sk;
}
}
} else {
for (int k = 0; k < this._storageResolvers.size(); k++) {
StorageResolver storage =
(StorageResolver) this._storageResolvers.get(k);
if (keyResolver.canResolve((Element) currentChild,
this.getBaseURI(), storage)) {
SecretKey sk =
keyResolver.resolveSecretKey((Element) currentChild,
this.getBaseURI(),
storage);
if (sk != null) {
return sk;
}
}
}
}
}
currentChild=currentChild.getNextSibling();
}
}
return null;
|
java.util.List | getStorageResolvers()Method getStorageResolvers
return this._storageResolvers;
|
public java.security.cert.X509Certificate | getX509Certificate()Method getX509Certificate
// First search using the individual resolvers from the user
X509Certificate cert = this.getX509CertificateFromInternalResolvers();
if (cert != null) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE,
"I could find a X509Certificate using the per-KeyInfo key resolvers");
return cert;
}
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE,
"I couldn't find a X509Certificate using the per-KeyInfo key resolvers");
// Then use the system-wide Resolvers
cert = this.getX509CertificateFromStaticResolvers();
if (cert != null) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE,
"I could find a X509Certificate using the system-wide key resolvers");
return cert;
}
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE,
"I couldn't find a X509Certificate using the system-wide key resolvers");
return null;
|
java.security.cert.X509Certificate | getX509CertificateFromInternalResolvers()Method getX509CertificateFromInternalResolvers
if (true)
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Start getX509CertificateFromInternalResolvers() with "
+ this.lengthInternalKeyResolver() + " resolvers");
for (int i = 0; i < this.lengthInternalKeyResolver(); i++) {
KeyResolverSpi keyResolver = this.itemInternalKeyResolver(i);
if (true)
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Try " + keyResolver.getClass().getName());
Node currentChild=this._constructionElement.getFirstChild();
while (currentChild!=null) {
if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
if (this._storageResolvers.size() == 0) {
// if we do not have storage resolvers, we verify with null
StorageResolver storage = null;
if (keyResolver.engineCanResolve((Element) currentChild,
this.getBaseURI(),
storage)) {
X509Certificate cert =
keyResolver.engineResolveX509Certificate(
(Element) currentChild, this.getBaseURI(), storage);
if (cert != null) {
return cert;
}
}
} else {
for (int k = 0; k < this._storageResolvers.size(); k++) {
StorageResolver storage =
(StorageResolver) this._storageResolvers.get(k);
if (keyResolver.engineCanResolve((Element) currentChild,
this.getBaseURI(),
storage)) {
X509Certificate cert =
keyResolver.engineResolveX509Certificate(
(Element) currentChild, this.getBaseURI(),
storage);
if (cert != null) {
return cert;
}
}
}
}
}
currentChild=currentChild.getNextSibling();
}
}
return null;
|
java.security.cert.X509Certificate | getX509CertificateFromStaticResolvers()This method uses each System-wide {@link KeyResolver} to search the
child elements. Each combination of {@link KeyResolver} and child element
is checked against all {@link StorageResolver}s.
if (true)
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Start getX509CertificateFromStaticResolvers() with "
+ KeyResolver.length() + " resolvers");
for (int i = 0; i < KeyResolver.length(); i++) {
KeyResolver keyResolver = KeyResolver.item(i);
Node currentChild=this._constructionElement.getFirstChild();
while (currentChild!=null) {
if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
if (this._storageResolvers.size() == 0) {
// if we do not have storage resolvers, we verify with null
StorageResolver storage = null;
if (keyResolver.canResolve((Element) currentChild,
this.getBaseURI(), storage)) {
X509Certificate cert =
keyResolver
.resolveX509Certificate((Element) currentChild, this
.getBaseURI(), storage);
if (cert != null) {
return cert;
}
}
} else {
for (int k = 0; k < this._storageResolvers.size(); k++) {
StorageResolver storage =
(StorageResolver) this._storageResolvers.get(k);
if (keyResolver.canResolve((Element) currentChild,
this.getBaseURI(), storage)) {
X509Certificate cert = keyResolver
.resolveX509Certificate((Element) currentChild, this
.getBaseURI(), storage);
if (cert != null) {
return cert;
}
}
}
}
}
currentChild=currentChild.getNextSibling();
}
}
return null;
|
public static void | init()init the keyinfo (Still needed?)
if (!KeyInfo._alreadyInitialized) {
if (KeyInfo.log == null) {
/**
* $todo$ why the hell does the static initialization from the
* start not work ?
*/
KeyInfo.log =
java.util.logging.Logger.getLogger(KeyInfo.class.getName());
log.log(java.util.logging.Level.SEVERE, "Had to assign log in the init() function");
}
// KeyInfo._contentHandlerHash = new HashMap(10);
KeyInfo._alreadyInitialized = true;
}
|
public boolean | isEmpty()Method isEmpty
return this._constructionElement.getFirstChild()==null;
|
public com.sun.org.apache.xml.internal.security.encryption.EncryptedKey | itemEncryptedKey(int i)Method itemEncryptedKey
Element e =
XMLUtils.selectXencNode(this._constructionElement.getFirstChild(),
EncryptionConstants._TAG_ENCRYPTEDKEY,i);
if (e != null) {
XMLCipher cipher = XMLCipher.getInstance();
cipher.init(XMLCipher.UNWRAP_MODE, null);
return cipher.loadEncryptedKey(e);
}
return null;
|
com.sun.org.apache.xml.internal.security.keys.keyresolver.KeyResolverSpi | itemInternalKeyResolver(int i)Method itemInternalKeyResolver
return (KeyResolverSpi) this._internalKeyResolvers.get(i);
|
public com.sun.org.apache.xml.internal.security.keys.content.KeyName | itemKeyName(int i)Method itemKeyName
Element e = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
Constants._TAG_KEYNAME,i);
if (e != null) {
return new KeyName(e, this._baseURI);
}
return null;
|
public com.sun.org.apache.xml.internal.security.keys.content.KeyValue | itemKeyValue(int i)Method itemKeyValue
Element e = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
Constants._TAG_KEYVALUE,i);
if (e != null) {
return new KeyValue(e, this._baseURI);
}
return null;
|
public com.sun.org.apache.xml.internal.security.keys.content.MgmtData | itemMgmtData(int i)Method itemMgmtData
Element e = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
Constants._TAG_MGMTDATA,i);
if (e != null) {
return new MgmtData(e, this._baseURI);
}
return null;
|
public com.sun.org.apache.xml.internal.security.keys.content.PGPData | itemPGPData(int i)Method itemPGPData
Element e = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
Constants._TAG_PGPDATA,i);
if (e != null) {
return new PGPData(e, this._baseURI);
}
return null;
|
public com.sun.org.apache.xml.internal.security.keys.content.RetrievalMethod | itemRetrievalMethod(int i)Method itemRetrievalMethod
Element e = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
Constants._TAG_RETRIEVALMETHOD,i);
if (e != null) {
return new RetrievalMethod(e, this._baseURI);
}
return null;
|
public com.sun.org.apache.xml.internal.security.keys.content.SPKIData | itemSPKIData(int i)Method itemSPKIData
Element e = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
Constants._TAG_SPKIDATA,i);
if (e != null) {
return new SPKIData(e, this._baseURI);
}
return null;
|
public org.w3c.dom.Element | itemUnknownElement(int i)Method itemUnknownElement
NodeList nl = this._constructionElement.getChildNodes();
int res = 0;
for (int j = 0; j < nl.getLength(); j++) {
Node current = nl.item(j);
/**
* $todo$ using this method, we don't see unknown Elements
* from Signature NS; revisit
*/
if ((current.getNodeType() == Node.ELEMENT_NODE)
&& current.getNamespaceURI()
.equals(Constants.SignatureSpecNS)) {
res++;
if (res == i) {
return (Element) current;
}
}
}
return null;
|
public com.sun.org.apache.xml.internal.security.keys.content.X509Data | itemX509Data(int i)Method itemX509Data
Element e = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
Constants._TAG_X509DATA,i);
if (e != null) {
return new X509Data(e, this._baseURI);
}
return null;
|
int | lengthInternalKeyResolver()Method lengthInternalKeyResolver
return this._internalKeyResolvers.size();
|
public int | lengthKeyName()Method lengthKeyName
return this.length(Constants.SignatureSpecNS, Constants._TAG_KEYNAME);
|
public int | lengthKeyValue()Method lengthKeyValue
return this.length(Constants.SignatureSpecNS, Constants._TAG_KEYVALUE);
|
public int | lengthMgmtData()Method lengthMgmtData
return this.length(Constants.SignatureSpecNS, Constants._TAG_MGMTDATA);
|
public int | lengthPGPData()Method lengthPGPData
return this.length(Constants.SignatureSpecNS, Constants._TAG_PGPDATA);
|
public int | lengthRetrievalMethod()Method lengthRetrievalMethod
return this.length(Constants.SignatureSpecNS,
Constants._TAG_RETRIEVALMETHOD);
|
public int | lengthSPKIData()Method lengthSPKIData
return this.length(Constants.SignatureSpecNS, Constants._TAG_SPKIDATA);
|
public int | lengthUnknownElement()Method lengthUnknownElement
NOTE posibly buggy.
int res = 0;
NodeList nl = this._constructionElement.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node current = nl.item(i);
/**
* $todo$ using this method, we don't see unknown Elements
* from Signature NS; revisit
*/
if ((current.getNodeType() == Node.ELEMENT_NODE)
&& current.getNamespaceURI()
.equals(Constants.SignatureSpecNS)) {
res++;
}
}
return res;
|
public int | lengthX509Data()Method lengthX509Data
return this.length(Constants.SignatureSpecNS, Constants._TAG_X509DATA);
|
public void | registerInternalKeyResolver(com.sun.org.apache.xml.internal.security.keys.keyresolver.KeyResolverSpi realKeyResolver)This method is used to add a custom {@link KeyResolverSpi} to a KeyInfo
object.
this._internalKeyResolvers.add(realKeyResolver);
|
public void | setId(java.lang.String Id)Sets the Id attribute
if ((this._state == MODE_SIGN) && (Id != null)) {
this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id);
IdResolver.registerElementById(this._constructionElement, Id);
}
|