iaik.pkcs.pkcs12
Class KeyBag

java.lang.Object
  |
  +--iaik.pkcs.pkcs12.Attributes
        |
        +--iaik.pkcs.pkcs12.SafeBag
              |
              +--iaik.pkcs.pkcs12.KeyBag
All Implemented Interfaces:
ASN1Type
Direct Known Subclasses:
PKCS8ShroudedKeyBag

public class KeyBag
extends SafeBag

This class contains a private key and any associated attributes.

Version:
File Revision 11
See Also:
SafeBag, Attributes

Constructor Summary
protected KeyBag()
          The default constructor.
  KeyBag(PrivateKey privateKey)
          Creates a new KeyBag from a private key.
  KeyBag(PrivateKey privateKey, String friendlyName, byte[] localKeyID)
          Creates a new KeyBag from a private key, a friendlyName and a locakKeyID.
 
Method Summary
 void decode(ASN1Object obj)
          Decodes the KeyBag given as ASN1Object.
 PrivateKey getPrivateKey()
          Returns the private key of this KeyBag.
 ASN1Object toASN1Object()
          Returns this KeyBag as ASN1Object.
 String toString()
          Returns a String representation of this KeyBag.
 
Methods inherited from class iaik.pkcs.pkcs12.SafeBag
create, encodeSafeContents, encodeSafeContentsAsASN1Object, getBagType, parseSafeContents, parseSafeContents, register
 
Methods inherited from class iaik.pkcs.pkcs12.Attributes
getAttributes, getFriendlyName, getLocalKeyID, setAttributes, setFriendlyName, setLocalKeyID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyBag

protected KeyBag()
The default constructor.

KeyBag

public KeyBag(PrivateKey privateKey)
Creates a new KeyBag from a private key.

KeyBag

public KeyBag(PrivateKey privateKey,
              String friendlyName,
              byte[] localKeyID)
Creates a new KeyBag from a private key, a friendlyName and a locakKeyID.
Method Detail

decode

public void decode(ASN1Object obj)
            throws CodingException
Decodes the KeyBag given as ASN1Object.
Parameters:
obj - the KeyBag as ASN1Object
Throws:
CodingException - if the KeyBag cannot be decoded

toASN1Object

public ASN1Object toASN1Object()
                        throws CodingException
Returns this KeyBag as ASN1Object.
Returns:
this KeyBag as ASN1Object

getPrivateKey

public PrivateKey getPrivateKey()
Returns the private key of this KeyBag.

toString

public String toString()
Returns a String representation of this KeyBag.
Overrides:
toString in class SafeBag

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK