codec.pkcs12
Class SafeBag

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

public class SafeBag
extends ASN1Sequence
implements Serializable

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

 SafeBag  ::= SEQUENCE {
   bagId           BAG-TYPE.&id ({PKCS12BagSet}),
   bagValue        [0] EXPLICIT BAG-TYPE.&Type ({PKCS12BagSet}{@bagId})
   bagAttributes   SET OF PKCS12Attribute OPTIONAL
 }
 
 PKCS12Attribute::=SEQUENCE {
   attrId          Attribute.&id ({PKCS12AttrSet}),
   attrValues      SET OF ATTRIBUTE.&Type ({PKCS12AttrSet}{@attrId}) -- this type is compatible with the x.500 type 'Attribute'
 
 PKCS12AttrSet ATTRIBUTE::={
        friendlyName| -- from PKCS#9
        localKeyId,   -- from PKCS#9
        ...           -- Other Attributes allowed
 
 This class is sonly used for resolving pkcs12 PDUs. To construct a 
 PFXpdu please construct a SafeContents from one of the bag types directly.
 Supported bagtypes arekeyBag, 
 pkcs8ShroudedKeyBag, certBag, 
 crlBag, secretBag, 
 safeContents.  
 

Version:
"$Id: SafeBag.java,v 1.3 2003/01/28 04:46:06 jpeters Exp $"
Author:
Michele Boivin
See Also:
Serialized Form

Field Summary
protected  PKCS12OIDRegistry reg_
          The OID Registry for resolving
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
SafeBag()
          Default constructor.
 
Method Summary
 void decode(Decoder decoder)
          Decodes this instance.
 ASN1Type[] getAttributes()
           
 ASN1ObjectIdentifier getBagType()
          Returns the OID defining the type of this SafeBag
 ASN1Type getBagValue()
          Returns the actual bag in the SafeBag.
 void setAttributes(Attribute[] attr)
          Sets this SafeBag's attributes
 void setBagContents(ASN1ObjectIdentifier oid, ASN1Type bag)
          Sets the SafeBag's contents.
 void setBagContents(ASN1RegisteredType bag)
          Sets the SafeBag's contents as a RegisteredType
 
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 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

reg_

protected PKCS12OIDRegistry reg_
The OID Registry for resolving
Constructor Detail

SafeBag

public SafeBag()
Default constructor.
Method Detail

decode

public void decode(Decoder decoder)
            throws ASN1Exception,
                   IOException
Decodes this instance. This method extracts the actual content type from the ASN1OpenType.
Overrides:
decode in class ASN1AbstractCollection
Parameters:
decoder - The Decoder to use.

getAttributes

public ASN1Type[] getAttributes()

getBagType

public ASN1ObjectIdentifier getBagType()
Returns the OID defining the type of this SafeBag
Returns:
the OID defining the type of this SafeBag.

getBagValue

public ASN1Type getBagValue()
Returns the actual bag in the SafeBag.
Returns:
the actual bag in the SafeBag.

setAttributes

public void setAttributes(Attribute[] attr)
Sets this SafeBag's attributes
Parameters:
attr - an array of attributes to be set

setBagContents

public void setBagContents(ASN1ObjectIdentifier oid,
                           ASN1Type bag)
Sets the SafeBag's contents.
Parameters:
oid - the OID describing the content type
bag - the content itself

setBagContents

public void setBagContents(ASN1RegisteredType bag)
Sets the SafeBag's contents as a RegisteredType
Parameters:
bag - the content as a RegisteredType


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.