Package org.mozilla.jss.pkcs7
Class ContentInfo
java.lang.Object
org.mozilla.jss.pkcs7.ContentInfo
- All Implemented Interfaces:
ASN1Value
A PKCS #7 ContentInfo structure.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A template for decoding a ContentInfo blob -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ANY
private OBJECT_IDENTIFIER
static OBJECT_IDENTIFIER
static OBJECT_IDENTIFIER
static OBJECT_IDENTIFIER
static OBJECT_IDENTIFIER
private SEQUENCE
static OBJECT_IDENTIFIER
static OBJECT_IDENTIFIER
static final Tag
private static ContentInfo.Template
-
Constructor Summary
ConstructorsConstructorDescriptionContentInfo
(byte[] data) Creates a ContentInfo of typedata
.ContentInfo
(OBJECT_IDENTIFIER contentType, ASN1Value content) Creates a ContentInfo with the given type and content.Creates a ContentInfo of typedigestedData
.Creates a ContentInfo of typeencryptedData
.Creates a ContentInfo of typeenvelopedData
.Creates a ContentInfo of typesignedAndEnvelopedData
.Creates a ContentInfo of typesignedData
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
encode
(OutputStream ostream) Write this value's DER encoding to an output stream using its own base tag.void
encode
(Tag implicitTag, OutputStream ostream) Write this value's DER encoding to an output stream using an implicit tag.Returns the content encoded as an ANY.Returns the contentType field, which determines what kind of content is contained in this ContentInfo.Returns the content, interpreted based on its type.getTag()
Returns the base tag for this type, not counting any tags that may be imposed on it by its context.static ContentInfo.Template
Returns a singleton instance of a decoding template for ContentInfo.boolean
Returnstrue
if the content field is present.
-
Field Details
-
TAG
-
DATA
-
SIGNED_DATA
-
ENVELOPED_DATA
-
SIGNED_AND_ENVELOPED_DATA
-
DIGESTED_DATA
-
ENCRYPTED_DATA
-
contentType
-
-
sequence
-
templateInstance
-
-
Constructor Details
-
ContentInfo
Creates a ContentInfo with the given type and content.- Parameters:
contentType
- The contentType of the ContentInfo.content
- The content of the ContentInfo. May benull
to signify that the optional content field is not present.
-
ContentInfo
public ContentInfo(byte[] data) Creates a ContentInfo of typedata
. -
ContentInfo
Creates a ContentInfo of typesignedData
. -
ContentInfo
Creates a ContentInfo of typeenvelopedData
. -
ContentInfo
Creates a ContentInfo of typesignedAndEnvelopedData
. -
ContentInfo
Creates a ContentInfo of typedigestedData
. -
ContentInfo
Creates a ContentInfo of typeencryptedData
.
-
-
Method Details
-
getContentType
Returns the contentType field, which determines what kind of content is contained in this ContentInfo. It will usually be one of the six predefined types, but may also be a user-defined type. -
hasContent
public boolean hasContent()Returnstrue
if the content field is present. -
getInterpretedContent
Returns the content, interpreted based on its type. If there is no content,null
is returned.If the contentType is one of the six standard types, the returned object will be of that type. For example, if the ContentInfo has contentType signedData, a SignedData object will be returned. If the contentType is data, an OCTET_STRING will be returned.
If the contentType is not one of the six standard types, the returned object will be an ANY.
- Throws:
InvalidBERException
-
getContent
Returns the content encoded as an ANY. If there is no content,null
is returned. -
encode
Description copied from interface:ASN1Value
Write this value's DER encoding to an output stream using its own base tag.- Specified by:
encode
in interfaceASN1Value
- Parameters:
ostream
- Output stream.- Throws:
IOException
- If an error occurred.
-
encode
Description copied from interface:ASN1Value
Write this value's DER encoding to an output stream using an implicit tag.- Specified by:
encode
in interfaceASN1Value
- Parameters:
implicitTag
- Implicit tag.ostream
- Output stream.- Throws:
IOException
- If an error occurred.
-
getTag
Description copied from interface:ASN1Value
Returns the base tag for this type, not counting any tags that may be imposed on it by its context. -
getTemplate
Returns a singleton instance of a decoding template for ContentInfo.
-