org.mozilla.jss.pkix.cms

Class ContentInfo

public class ContentInfo extends Object implements ASN1Value

A PKCS #7 ContentInfo structure.
Nested Class Summary
static classContentInfo.Template
A template for decoding a ContentInfo blob
Field Summary
static OBJECT_IDENTIFIERDATA
static OBJECT_IDENTIFIERDIGESTED_DATA
static OBJECT_IDENTIFIERENCRYPTED_DATA
static OBJECT_IDENTIFIERENVELOPED_DATA
static OBJECT_IDENTIFIERSIGNED_AND_ENVELOPED_DATA
static OBJECT_IDENTIFIERSIGNED_DATA
static TagTAG
Constructor Summary
ContentInfo(OBJECT_IDENTIFIER contentType, ASN1Value content)
Creates a ContentInfo with the given type and content.
ContentInfo(byte[] data)
Creates a ContentInfo of type data.
ContentInfo(SignedData sd)
Creates a ContentInfo of type signedData.
ContentInfo(EnvelopedData ed)
Creates a ContentInfo of type envelopedData.
ContentInfo(SignedAndEnvelopedData sed)
Creates a ContentInfo of type signedAndEnvelopedData.
ContentInfo(DigestedData dd)
Creates a ContentInfo of type digestedData.
ContentInfo(EncryptedData ed)
Creates a ContentInfo of type encryptedData.
Method Summary
voidencode(OutputStream ostream)
voidencode(Tag implicitTag, OutputStream ostream)
ANYgetContent()
Returns the content encoded as an ANY.
OBJECT_IDENTIFIERgetContentType()
Returns the contentType field, which determines what kind of content is contained in this ContentInfo.
ASN1ValuegetInterpretedContent()
Returns the content, interpreted based on its type.
TaggetTag()
static ContentInfo.TemplategetTemplate()
Returns a singleton instance of a decoding template for ContentInfo.
booleanhasContent()
Returns true if the content field is present.

Field Detail

DATA

public static OBJECT_IDENTIFIER DATA

DIGESTED_DATA

public static OBJECT_IDENTIFIER DIGESTED_DATA

ENCRYPTED_DATA

public static OBJECT_IDENTIFIER ENCRYPTED_DATA

ENVELOPED_DATA

public static OBJECT_IDENTIFIER ENVELOPED_DATA

SIGNED_AND_ENVELOPED_DATA

public static OBJECT_IDENTIFIER SIGNED_AND_ENVELOPED_DATA

SIGNED_DATA

public static OBJECT_IDENTIFIER SIGNED_DATA

TAG

public static final Tag TAG

Constructor Detail

ContentInfo

public ContentInfo(OBJECT_IDENTIFIER contentType, ASN1Value content)
Creates a ContentInfo with the given type and content.

Parameters: contentType The contentType of the ContentInfo. content The content of the ContentInfo. May be null to signify that the optional content field is not present.

ContentInfo

public ContentInfo(byte[] data)
Creates a ContentInfo of type data.

ContentInfo

public ContentInfo(SignedData sd)
Creates a ContentInfo of type signedData.

ContentInfo

public ContentInfo(EnvelopedData ed)
Creates a ContentInfo of type envelopedData.

ContentInfo

public ContentInfo(SignedAndEnvelopedData sed)
Creates a ContentInfo of type signedAndEnvelopedData.

ContentInfo

public ContentInfo(DigestedData dd)
Creates a ContentInfo of type digestedData.

ContentInfo

public ContentInfo(EncryptedData ed)
Creates a ContentInfo of type encryptedData.

Method Detail

encode

public void encode(OutputStream ostream)

encode

public void encode(Tag implicitTag, OutputStream ostream)

getContent

public ANY getContent()
Returns the content encoded as an ANY. If there is no content, null is returned.

getContentType

public OBJECT_IDENTIFIER 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.

getInterpretedContent

public ASN1Value 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.

getTag

public Tag getTag()

getTemplate

public static ContentInfo.Template getTemplate()
Returns a singleton instance of a decoding template for ContentInfo.

hasContent

public boolean hasContent()
Returns true if the content field is present.