codec.pkcs12
Class KeyBag

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.ArrayList
                    |
                    +--codec.asn1.ASN1AbstractCollection
                          |
                          +--codec.asn1.ASN1Sequence
                                |
                                +--codec.pkcs8.PrivateKeyInfo
                                      |
                                      +--codec.pkcs12.KeyBag
All Implemented Interfaces:
ASN1Collection, ASN1RegisteredType, ASN1Type, Cloneable, Collection, Externalizable, List, Serializable

public class KeyBag
extends PrivateKeyInfo
implements ASN1RegisteredType, Serializable

This class represents a KeyBag as defined in PKCS#12. The ASN.1 definition of this structure is

 KeyBag::= PrivateKeyInfo
 

PrivateKeyInfo is defined in PKCS#8, the Private Key Information Syntax Standard.

Version:
"$Id: KeyBag.java,v 1.4 2005/03/22 14:05:26 flautens Exp $"
Author:
Michele Boivin
See Also:
Serialized Form

Fields inherited from class codec.pkcs8.PrivateKeyInfo
algorithm_, attributes_, VERSION, version_, VERSION_1_2
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
KeyBag()
          default constructor.
KeyBag(AlgorithmIdentifier aID, ASN1Type key)
           
KeyBag(AlgorithmIdentifier aID, byte[] key)
           
KeyBag(PrivateKey pk)
           
 
Method Summary
 ASN1ObjectIdentifier getOID()
          Returns the ObjectIdentifier for this bagtype.
 PrivateKey getPrivateKey()
          Returns the private key
 String toString()
          Prints this collection.
 
Methods inherited from class codec.pkcs8.PrivateKeyInfo
getAlgorithmIdentifier, getAttributes, getDecodedRawKey, getRawKey, getVersion, setAlgorithm, setAttributes, setPrivateKey, setRawKey, setVersion
 
Methods inherited from class codec.asn1.ASN1Sequence
getTag
 
Methods inherited from class codec.asn1.ASN1AbstractCollection
checkConstraints, decode, encode, getCollection, getConstraint, getTagClass, getValue, isExplicit, isOptional, isType, readExternal, setConstraint, setExplicit, setOptional, writeExternal
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, remove, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface codec.asn1.ASN1Type
checkConstraints, decode, encode, getConstraint, getTag, getTagClass, getValue, isExplicit, isOptional, isType, setConstraint, setExplicit, setOptional
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList
 

Constructor Detail

KeyBag

public KeyBag()
default constructor.

KeyBag

public KeyBag(AlgorithmIdentifier aID,
              byte[] key)

KeyBag

public KeyBag(AlgorithmIdentifier aID,
              ASN1Type key)

KeyBag

public KeyBag(PrivateKey pk)
       throws InvalidKeyException
Method Detail

getOID

public ASN1ObjectIdentifier getOID()
Returns the ObjectIdentifier for this bagtype.
Specified by:
getOID in interface ASN1RegisteredType
Returns:
the ObjectIdentifier

getPrivateKey

public PrivateKey getPrivateKey()
                         throws NoSuchAlgorithmException
Returns the private key
Overrides:
getPrivateKey in class PrivateKeyInfo
Returns:
The private key
Throws:
NoSuchAlgorithmException - DOCUMENT ME!

toString

public String toString()
Description copied from class: ASN1AbstractCollection
Prints this collection. This default implementation derives a descriptive name from the name of the fully qualified name of this class (or that of the respective subclass). The last component of the class name is extracted and a prefix of "ASN1" is removed from it. Then the elements contained in this collection are printed.
Overrides:
toString in class ASN1AbstractCollection
Returns:
the string that describes this Keybag object.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.