public abstract class SafeBag extends Attributes implements ASN1Type
The
PKCS#12 Personal Information Exchange Syntax Standard defines the
SafeBag
structure as collection of one particular piece of
information (a key, a certificate, ...) and some additional attributes for
forming the basic building block of a PFX PDU:
SafeBag :== SEQUENCE { bagType OBJECT IDENTIFIER, bagContent [0] EXPLICIT ANY DEFINED BY bagType, bagAttributes Attributes OPTIONAL -- from X.501 }
AuthenticatedSafe
,
PKCS12
Modifier | Constructor and Description |
---|---|
protected |
SafeBag()
Default Constructor.
|
protected |
SafeBag(java.lang.String friendlyName,
byte[] localKeyID)
Creates a new SafeBag from a friendly name and a local key ID.
|
Modifier and Type | Method and Description |
---|---|
static SafeBag |
create(ObjectID oid)
Creates a new SafeBag from a given ObjectID.
|
protected static byte[] |
encodeSafeContents(SafeBag[] safeBags)
Creates the SafeContants byte array as needed by AuthenticatedSafe from an
array of SafeBags.
|
protected static ASN1Object |
encodeSafeContentsAsASN1Object(SafeBag[] safeBags)
Creates the SafeContants ASN1Object as needed by SafeContentsBag from an
array of SafeBags.
|
ObjectID |
getBagType()
Returns the type of this SafeBag.
|
protected static SafeBag[] |
parseSafeContents(ASN1Object safeContents)
Parses the SafeContents data structure and returns the included SafeBags.
|
protected static SafeBag[] |
parseSafeContents(byte[] safeContents)
Parses the SafeContents data structure and returns the included SafeBags.
|
static void |
register(ObjectID oid,
java.lang.Class cls)
Registers a new implementation for a PKCS#12 SafeBag defined through the
given ObjectID.
|
java.lang.String |
toString()
Returns a String representation of these Attributes.
|
getAttributes, getFriendlyName, getLocalKeyID, setAttributes, setFriendlyName, setLocalKeyID
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
decode, toASN1Object
protected SafeBag()
protected SafeBag(java.lang.String friendlyName, byte[] localKeyID)
friendlyName
- the friendly namelocalKeyID
- the local key idpublic static SafeBag create(ObjectID oid) throws PKCSException
oid
- the object id of the bag to createPKCSException
- if there is no bag type registered for the given object idpublic static void register(ObjectID oid, java.lang.Class cls)
oid
- the object id of the PKCS#12 SafeBag to be registeredcls
- the class that implements the PKCS#12 SafeBagprotected static byte[] encodeSafeContents(SafeBag[] safeBags) throws CodingException
safeBags
- the SafeBags to encodeCodingException
protected static ASN1Object encodeSafeContentsAsASN1Object(SafeBag[] safeBags) throws CodingException
safeBags
- the SafeBags to encodeCodingException
protected static SafeBag[] parseSafeContents(byte[] safeContents) throws CodingException
safeContents
- the SafeContents ASN.1 structure as byte arrayCodingException
- if an error occurs during parsing the safe contentsprotected static SafeBag[] parseSafeContents(ASN1Object safeContents) throws CodingException
safeContents
- the SafeContents ASN.1 structure as ASN1ObjectCodingException
- if an error occurs during parsing the safe contentspublic ObjectID getBagType()
Possible values are:
ObjectID
public java.lang.String toString()
toString
in class Attributes