org.apache.xml.security.keys.provider
Class KeyElement

java.lang.Object
  |
  +--org.apache.xml.security.utils.ElementProxy
        |
        +--org.apache.xml.security.keys.provider.KeyBaseType
              |
              +--org.apache.xml.security.keys.provider.KeyElement

public class KeyElement
extends KeyBaseType

Author:
$Author: geuerp $

Field Summary
static byte[] salt
          Field salt
 
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
KeyElement(org.w3c.dom.Document doc, java.lang.String alias, byte[] key, java.security.cert.Certificate[] chain)
          Constructor KeyElement
KeyElement(org.w3c.dom.Document doc, java.lang.String alias, java.security.Key k, char[] password, java.security.cert.Certificate[] chain)
          Constructor KeyElement
KeyElement(org.w3c.dom.Element element, java.lang.String BaseURI)
          Constructor KeyElement
 
Method Summary
 java.lang.String getBaseLocalName()
          Method getBaseLocalName
 java.security.cert.Certificate[] getCertificateChain(java.lang.String alias)
          Method getCertificateChain
static byte[] PKCS12PasswordToBytes(char[] password)
          converts a password to a byte array according to the scheme in PKCS12 (unicode, big endian, 2 zero pad bytes at the end).
 void setCertificateChain(java.security.cert.Certificate[] chain)
          Method setCertificateChain
 java.security.Key unwrap(char[] password)
          Method unwrap
 
Methods inherited from class org.apache.xml.security.keys.provider.KeyBaseType
getAlias, getBaseNamespace, getDate, setDate
 
Methods inherited from class org.apache.xml.security.utils.ElementProxy
addBase64Element, addBase64Text, addBigIntegerElement, addText, addTextElement, createElementForFamily, getBaseURI, getBigIntegerFromChildElement, getBytesFromChildElement, getBytesFromTextChild, getChildElementLocalName, getDefaultPrefix, getDocument, getElement, getElementPlusReturns, getTextFromChildElement, getTextFromTextChild, guaranteeThatElementInCorrectSpace, length, setDefaultPrefix, setElement, setXPathNamespaceContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

salt

public static final byte[] salt
Field salt

Constructor Detail

KeyElement

public KeyElement(org.w3c.dom.Document doc,
                  java.lang.String alias,
                  java.security.Key k,
                  char[] password,
                  java.security.cert.Certificate[] chain)
           throws XMLSecurityException
Constructor KeyElement

Parameters:
doc -
alias -
k -
password -
chain -

KeyElement

public KeyElement(org.w3c.dom.Document doc,
                  java.lang.String alias,
                  byte[] key,
                  java.security.cert.Certificate[] chain)
           throws XMLSecurityException
Constructor KeyElement

Parameters:
doc -
alias -
key -
chain -

KeyElement

public KeyElement(org.w3c.dom.Element element,
                  java.lang.String BaseURI)
           throws XMLSecurityException
Constructor KeyElement

Parameters:
element -
BaseURI -
Throws:
XMLSecurityException
Method Detail

unwrap

public java.security.Key unwrap(char[] password)
                         throws java.security.NoSuchAlgorithmException,
                                java.security.UnrecoverableKeyException
Method unwrap

Parameters:
password -
Returns:
Throws:
java.security.NoSuchAlgorithmException
java.security.UnrecoverableKeyException

getBaseLocalName

public java.lang.String getBaseLocalName()
Method getBaseLocalName

Specified by:
getBaseLocalName in class ElementProxy
Returns:

setCertificateChain

public void setCertificateChain(java.security.cert.Certificate[] chain)
                         throws XMLSecurityException
Method setCertificateChain

Parameters:
chain -
Throws:
XMLSecurityException

getCertificateChain

public java.security.cert.Certificate[] getCertificateChain(java.lang.String alias)
Method getCertificateChain

Parameters:
alias -
Returns:

PKCS12PasswordToBytes

public static byte[] PKCS12PasswordToBytes(char[] password)
converts a password to a byte array according to the scheme in PKCS12 (unicode, big endian, 2 zero pad bytes at the end).

Parameters:
password - a character array reqpresenting the password.
Returns:
a byte array representing the password.