codec.pkcs12
Class SafeContents

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

public class SafeContents
extends ASN1SequenceOf
implements Serializable

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

 SafeContents  ::= SEQUENCE OF SafeBag
 SafeBags can be of type keyBag,
 pkcs8ShroudedKeyBag, certBag,
 crlBag, secretBag,
 safeContents.  All of these types have
 registered OIDs.
 @author Michele Boivin
 @version "$Id: SafeContents.java,v 1.4 2005/03/22 14:13:20 flautens Exp $"

See Also:
Serialized Form

Field Summary
protected static int[] FN_OID_
          The OID for the Attribute friendlyName
protected static int[] LK_OID_
          The OID for the Attribute localKeyId
protected static int[] OID_
          The OID of this structure.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
SafeContents()
          the default constructor.
SafeContents(ASN1RegisteredType bag)
          Constructs a SafeContents from a SafeBag.
SafeContents(ASN1RegisteredType bag, Attribute[] attr)
          Constructs a SafeContents from a SafeBag.
SafeContents(ASN1RegisteredType bag, String user_fn, byte[] lk_id)
          Constructs a SafeContents from a SafeBag and sets the attributes friendlyName and localKeyId.
 
Method Summary
 void addSafeBag(ASN1RegisteredType bag)
          Adds a SafeBag to the SafeContents.
 void addSafeBag(ASN1RegisteredType bag, Attribute[] attr)
          Adds a SafeBag to the SafeContents.
 ASN1ObjectIdentifier getOID()
          A SafeContents can be put recursively into a SafeBag.
 SafeBag getSafeBag(int i)
          returns the SafaBag at position i.
 SafeBag[] getSafeBags()
          returns the contents of the SafeContents as an array.
 
Methods inherited from class codec.asn1.ASN1SequenceOf
decode, getElementType, newElement
 
Methods inherited from class codec.asn1.ASN1Sequence
getTag
 
Methods inherited from class codec.asn1.ASN1AbstractCollection
checkConstraints, encode, getCollection, getConstraint, getTagClass, getValue, isExplicit, isOptional, isType, readExternal, setConstraint, setExplicit, setOptional, toString, 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.ASN1Collection
getCollection
 
Methods inherited from interface codec.asn1.ASN1Type
checkConstraints, 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
 

Field Detail

OID_

protected static final int[] OID_
The OID of this structure.

FN_OID_

protected static final int[] FN_OID_
The OID for the Attribute friendlyName

LK_OID_

protected static final int[] LK_OID_
The OID for the Attribute localKeyId
Constructor Detail

SafeContents

public SafeContents()
the default constructor.

SafeContents

public SafeContents(ASN1RegisteredType bag)
Constructs a SafeContents from a SafeBag.
Parameters:
bag - The SafeBag to put in the SafeContents

SafeContents

public SafeContents(ASN1RegisteredType bag,
                    Attribute[] attr)
Constructs a SafeContents from a SafeBag.
Parameters:
bag - The SafeBag to put in the SafeContents.
attr - an array of bag attributes.

SafeContents

public SafeContents(ASN1RegisteredType bag,
                    String user_fn,
                    byte[] lk_id)
Constructs a SafeContents from a SafeBag and sets the attributes friendlyName and localKeyId.
Parameters:
bag - The SafeBag to put in the SafeContents
user_fn - The friendlyName
lk_id - The localKeyId
Method Detail

addSafeBag

public void addSafeBag(ASN1RegisteredType bag)
Adds a SafeBag to the SafeContents.
Parameters:
bag - the bag to be added to the SafeContents.

addSafeBag

public void addSafeBag(ASN1RegisteredType bag,
                       Attribute[] attr)
Adds a SafeBag to the SafeContents.
Parameters:
bag - the bag to be added to the SafeContents.
attr - an array of bag attributes.

getOID

public ASN1ObjectIdentifier getOID()
A SafeContents can be put recursively into a SafeBag.
Returns:
the OID defining this structure as a SafeContents bag.

getSafeBag

public SafeBag getSafeBag(int i)
returns the SafaBag at position i.
Parameters:
i - The integer specifying the position.
Returns:
The SafeBag at position i.

getSafeBags

public SafeBag[] getSafeBags()
returns the contents of the SafeContents as an array.
Returns:
an array of SafeBags.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.