Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.1.2)

Part Number E27170-01

weblogic.xml.security.keyinfo
Class KeyInfo

java.lang.Object
  extended by weblogic.xml.security.keyinfo.KeyInfo
All Implemented Interfaces:
DSIGConstants

public class KeyInfo
extends Object
implements DSIGConstants

KeyInfo is an optional element that enables the recipient(s) to obtain the key needed to validate the signature. KeyInfo may contain keys, names, certificates and other public key management information, such as in-band key distribution or key agreement data.


Field Summary
 
Fields inherited from interface weblogic.xml.security.signature.DSIGConstants
ATTR_ALGORITHM, ATTR_ID, ATTR_PREFIX_LIST, ATTR_URI, ATTR_XMLNS, DSIG_PREFIX, DSIG_URI, EXC_C14N_DEFAULT_PREFIX, TAG_C14N_METHOD, TAG_DIGEST_METHOD, TAG_DIGEST_VALUE, TAG_DSA_G, TAG_DSA_KEY_VALUE, TAG_DSA_P, TAG_DSA_Q, TAG_DSA_Y, TAG_HMAC_OUTPUT_LENGTH, TAG_INCLUSIVE_NAMESPACES, TAG_KEY_INFO, TAG_KEY_NAME, TAG_KEY_VALUE, TAG_OBJECT, TAG_REFERENCE, TAG_RSA_EXPONENT, TAG_RSA_KEY_VALUE, TAG_RSA_MODULUS, TAG_SIGNATURE, TAG_SIGNATURE_METHOD, TAG_SIGNATURE_VALUE, TAG_SIGNED_INFO, TAG_TRANSFORM, TAG_TRANSFORMS, TAG_X509_CERTIFICATE, TAG_X509_DATA, TAG_X509_ISSUER_NAME, TAG_X509_ISSUER_SERIAL, TAG_X509_SERIAL_NUMBER, TAG_X509_SUBJECT_NAME, TAG_XPATH, TC_C14N_METHOD, TC_DIGEST_METHOD, TC_DSA_KEY_VALUE, TC_KEY_INFO, TC_KEY_VALUE, TC_REFERENCE, TC_RSA_KEY_VALUE, TC_SIGNATURE, TC_SIGNATURE_METHOD, TC_SIGNED_INFO, TC_TRANSFORMS, TC_X509_DATA, VERBOSE, VERBOSE_PROPERTY, VERBOSE_PROPERTY_ALT
 
Constructor Summary
KeyInfo(EncryptedKey encryptedKey)
           
KeyInfo(String keyName)
           
KeyInfo(Token token)
           
KeyInfo(X509Certificate cert)
          Constructs a KeyInfo from a certificate.
KeyInfo(XMLInputStream in, String ns)
           
 
Method Summary
 void addEncryptedKey(EncryptedKey encryptedKey)
          Adds an EncryptedKey to the KeyInfo element.
 void addKeyName(String keyName)
          Adds a KeyName to the KeyInfo element.
 void addKeyValue(KeyValue keyValue)
          Adds a KeyValue to the KeyInfo element.
 void addSecurityTokenReference(SecurityTokenReference ref)
          Adds an SecurityTokenReference to the KeyInfo element.
 void addSecurityTokenReference(Token token)
           
 void addX509Data(X509Data x509Data)
          Adds an X509Data to the KeyInfo element.
 Iterator getCertificates()
          Gets all of the Certificate contained in this KeyInfo.
 Iterator getEncryptedKeys()
           
 String getKeyName()
           
 Iterator getKeyNames()
           
 Iterator getKeyValues()
           
 Iterator getPublicKeys()
          Returns the PublicKeys contained in the KeyInfo element.
 Iterator getSecurityTokenReferences()
           
 Iterator getSubjectNames()
          Gets all of the Certificate contained in this KeyInfo.
 Iterator getX509Data()
           
static void main(String[] args)
           
 void removeEncryptedKey(EncryptedKey encryptedKey)
          Removes an EncryptedKey from the KeyInfo element.
 void removeKeyName(String keyName)
          Removes a KeyName from the KeyInfo element.
 void removeKeyValue(KeyValue keyValue)
          Removes a KeyValue from the KeyInfo element.
 void removeSecurityTokenReference(SecurityTokenReference ref)
          Removes a SecurityTokenReference from the KeyInfo element.
 void removeX509Data(X509Data x509Data)
          Removes a KeyValue from the KeyInfo element.
 String toString()
           
 void toXML(XMLOutputStream os, int indent)
           
 void toXML(XMLOutputStream os, String ns, int indent)
           
 void validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyInfo

public KeyInfo(String keyName)

KeyInfo

public KeyInfo(X509Certificate cert)
        throws KeyInfoException
Constructs a KeyInfo from a certificate. The KeyName is set to the certificate's subject DN.

Throws:
KeyInfoException

KeyInfo

public KeyInfo(Token token)

KeyInfo

public KeyInfo(EncryptedKey encryptedKey)

KeyInfo

public KeyInfo(XMLInputStream in,
               String ns)
        throws XMLStreamException
Throws:
XMLStreamException
Method Detail

addKeyName

public void addKeyName(String keyName)
Adds a KeyName to the KeyInfo element.


removeKeyName

public void removeKeyName(String keyName)
Removes a KeyName from the KeyInfo element.


getKeyName

public String getKeyName()
Returns:
the first KeyName.

getKeyNames

public Iterator getKeyNames()
Returns:
all KeyNames contained in the KeyInfo element.

addKeyValue

public void addKeyValue(KeyValue keyValue)
Adds a KeyValue to the KeyInfo element.


removeKeyValue

public void removeKeyValue(KeyValue keyValue)
Removes a KeyValue from the KeyInfo element.


getKeyValues

public Iterator getKeyValues()
Returns:
all KeyValues contained in the KeyInfo element.

addX509Data

public void addX509Data(X509Data x509Data)
Adds an X509Data to the KeyInfo element.


removeX509Data

public void removeX509Data(X509Data x509Data)
Removes a KeyValue from the KeyInfo element.


getX509Data

public Iterator getX509Data()
Returns:
all X509Data contained in the KeyInfo element.

addEncryptedKey

public void addEncryptedKey(EncryptedKey encryptedKey)
Adds an EncryptedKey to the KeyInfo element.


removeEncryptedKey

public void removeEncryptedKey(EncryptedKey encryptedKey)
Removes an EncryptedKey from the KeyInfo element.


getEncryptedKeys

public Iterator getEncryptedKeys()
Returns:
all EncryptedKey contained in the KeyInfo element.

addSecurityTokenReference

public void addSecurityTokenReference(SecurityTokenReference ref)
Adds an SecurityTokenReference to the KeyInfo element.


addSecurityTokenReference

public void addSecurityTokenReference(Token token)

removeSecurityTokenReference

public void removeSecurityTokenReference(SecurityTokenReference ref)
Removes a SecurityTokenReference from the KeyInfo element.


getSecurityTokenReferences

public Iterator getSecurityTokenReferences()
Returns:
all SecurityTokenReferences contained in the KeyInfo element.

getSubjectNames

public Iterator getSubjectNames()
                         throws KeyInfoValidationException
Gets all of the Certificate contained in this KeyInfo.

Returns:
The Certificate, or null if this KeyInfo contains no certificates
Throws:
KeyInfoValidationException

getCertificates

public Iterator getCertificates()
                         throws KeyInfoValidationException
Gets all of the Certificate contained in this KeyInfo.

Returns:
The Certificate, or null if this KeyInfo contains no certificates
Throws:
KeyInfoValidationException

getPublicKeys

public Iterator getPublicKeys()
                       throws KeyInfoValidationException
Returns the PublicKeys contained in the KeyInfo element. NOTE: This PublicKey should not be used to perform signature validation since there is no way to verify that the key is valid. Instead, use the PublicKey contained in the certificate, if one is available.

Returns:
All of the PublicKeys contained in this KeyInfo or 'null' if this KeyInfo contains no PublicKeys
Throws:
KeyInfoValidationException

validate

public void validate()
              throws KeyInfoValidationException
Throws:
KeyInfoValidationException

toXML

public void toXML(XMLOutputStream os,
                  int indent)
           throws XMLStreamException
Throws:
XMLStreamException

toXML

public void toXML(XMLOutputStream os,
                  String ns,
                  int indent)
           throws XMLStreamException
Throws:
XMLStreamException

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

toString

public String toString()
Overrides:
toString in class Object

Copyright 1996, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.1.2)

Part Number E27170-01