| Modifier and Type | Class and Description |
|---|---|
static class |
SafeBag.Template
A template for decoding SafeBags.
|
| Modifier and Type | Field and Description |
|---|---|
static OBJECT_IDENTIFIER |
CERT_BAG
A bag containing a certificate.
|
static OBJECT_IDENTIFIER |
CRL_BAG
A bag containing a certificate revocation list.
|
static OBJECT_IDENTIFIER |
FRIENDLY_NAME
A FriendlyName attribute.
|
static OBJECT_IDENTIFIER |
KEY_BAG
A bag containing a private key.
|
static OBJECT_IDENTIFIER |
LOCAL_KEY_ID
A LocalKeyID attribute.
|
static OBJECT_IDENTIFIER |
PKCS12_BAG_IDS
The OID branch for the PKCS #12 bag types.
|
static OBJECT_IDENTIFIER |
PKCS12_VERSION_1
The OID branch for PKCS #12, version 1.0.
|
static OBJECT_IDENTIFIER |
PKCS8_SHROUDED_KEY_BAG
A bag containing a private key encrypted a la PKCS #8.
|
static OBJECT_IDENTIFIER |
SAFE_CONTENTS_BAG
A bag containing a nested SafeContent .
|
static OBJECT_IDENTIFIER |
SECRET_BAG
A bag containing an arbitrary secret.
|
| Constructor and Description |
|---|
SafeBag(OBJECT_IDENTIFIER bagType,
ASN1Value bagContent,
SET bagAttributes)
Creates a new SafeBag from its components.
|
| Modifier and Type | Method and Description |
|---|---|
static SafeBag |
createCertBag(byte[] cert,
java.lang.String friendlyName)
Creates a SafeBag that contains an X.509 Certificate.
|
static SafeBag |
createCertBag(byte[] cert,
java.lang.String friendlyName,
byte[] localKeyID)
Creates a SafeBag that contains an X.509 Certificate.
|
static SafeBag |
createEncryptedPrivateKeyBag(PrivateKeyInfo privk,
java.lang.String friendlyName,
byte[] localKeyID,
Password password)
Creates a SafeBag containing a PKCS-8ShroudedKeyBag, which is
an EncryptedPrivateKeyInfo.
|
void |
encode(java.io.OutputStream ostream)
Write this value's DER encoding to an output stream using
its own base tag.
|
void |
encode(Tag implicitTag,
java.io.OutputStream ostream)
Write this value's DER encoding to an output stream using
an implicit tag.
|
SET |
getBagAttributes()
Returns the attributes of this bag.
|
ANY |
getBagContent()
Returns the contents of this bag as an ANY.
|
OBJECT_IDENTIFIER |
getBagType() |
ASN1Value |
getInterpretedBagContent()
Returns the bagContent interpreted by type.
|
static byte[] |
getLocalKeyIDFromCert(byte[] derCert)
Computes the LocalKeyID attribute that should be stored with a key
and certificate.
|
Tag |
getTag()
Returns the base tag for this type, not counting any tags
that may be imposed on it by its context.
|
static SafeBag.Template |
getTemplate() |
public static final OBJECT_IDENTIFIER PKCS12_VERSION_1
public static final OBJECT_IDENTIFIER PKCS12_BAG_IDS
public static final OBJECT_IDENTIFIER KEY_BAG
public static final OBJECT_IDENTIFIER PKCS8_SHROUDED_KEY_BAG
public static final OBJECT_IDENTIFIER CERT_BAG
CertBag.public static final OBJECT_IDENTIFIER CRL_BAG
CRLBag.public static final OBJECT_IDENTIFIER SECRET_BAG
SecretBag.public static final OBJECT_IDENTIFIER SAFE_CONTENTS_BAG
public static final OBJECT_IDENTIFIER FRIENDLY_NAME
public static final OBJECT_IDENTIFIER LOCAL_KEY_ID
public SafeBag(OBJECT_IDENTIFIER bagType, ASN1Value bagContent, SET bagAttributes)
bagType - The type of this bag. For compatibility, it should
be one of the constants defined in this class.bagContent - The contents of the bag. The type of this parameter
is defined by the bagType parameter.bagAttributes - A SET of Attributes for this SafeBag. Since
attributes are optional, this parameter may be null.public OBJECT_IDENTIFIER getBagType()
public ANY getBagContent()
public ASN1Value getInterpretedBagContent() throws InvalidBERException
InvalidBERExceptionpublic SET getBagAttributes()
org.mozilla.jss.pkix.primitive.Attribute.public static SafeBag createCertBag(byte[] cert, java.lang.String friendlyName) throws java.security.DigestException, java.security.NoSuchAlgorithmException, InvalidBERException
cert - A DER-encoded X.509 certificate.friendlyName - Will be stored in the friendlyName
attribute of the SafeBag. Should be the nickname of the cert.java.security.DigestExceptionjava.security.NoSuchAlgorithmExceptionInvalidBERExceptionpublic static SafeBag createCertBag(byte[] cert, java.lang.String friendlyName, byte[] localKeyID) throws InvalidBERException
cert - A DER-encoded X.509 certificate.friendlyName - Will be stored in the friendlyName
attribute of the SafeBag. Should be the nickname of the cert.localKeyID - The bytes to used for the localKeyID. These should
be obtained from the getLocalKeyIDFromCert method.InvalidBERException - If the cert is not a valid DER encoding.getLocalKeyIDFromCert(byte[])public static final byte[] getLocalKeyIDFromCert(byte[] derCert)
throws java.security.DigestException,
java.security.NoSuchAlgorithmException
derCert - A DER-encoded X.509 certificate.java.security.DigestExceptionjava.security.NoSuchAlgorithmExceptionpublic static SafeBag createEncryptedPrivateKeyBag(PrivateKeyInfo privk, java.lang.String friendlyName, byte[] localKeyID, Password password) throws CryptoManager.NotInitializedException, TokenException
privk - The PrivateKeyInfo containing the private key.friendlyName - The nickname for the key; should be the same
as the nickname of the associated cert.localKeyID - The localKeyID for the key; should be the same as
the localKeyID of the associated cert.password - The password used to encrypt the private key.CryptoManager.NotInitializedExceptionTokenExceptionpublic Tag getTag()
ASN1Valuepublic void encode(java.io.OutputStream ostream)
throws java.io.IOException
ASN1Valuepublic void encode(Tag implicitTag, java.io.OutputStream ostream) throws java.io.IOException
ASN1Valuepublic static SafeBag.Template getTemplate()