Package org.mozilla.jss.pkix.cms
Class ContentInfo
java.lang.Object
org.mozilla.jss.pkix.cms.ContentInfo
- All Implemented Interfaces:
ASN1Value
A PKCS #7 ContentInfo structure.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA template for decoding a ContentInfo blob -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ANYprivate OBJECT_IDENTIFIERstatic OBJECT_IDENTIFIERstatic OBJECT_IDENTIFIERstatic OBJECT_IDENTIFIERstatic OBJECT_IDENTIFIERprivate SEQUENCEstatic OBJECT_IDENTIFIERstatic OBJECT_IDENTIFIERstatic final Tagprivate 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 TypeMethodDescriptionvoidencode(OutputStream ostream) Write this value's DER encoding to an output stream using its own base tag.voidencode(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.TemplateReturns a singleton instance of a decoding template for ContentInfo.booleanReturnstrueif 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 benullto 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()Returnstrueif the content field is present. -
getInterpretedContent
Returns the content, interpreted based on its type. If there is no content,nullis 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,nullis returned. -
encode
Description copied from interface:ASN1ValueWrite this value's DER encoding to an output stream using its own base tag.- Specified by:
encodein interfaceASN1Value- Parameters:
ostream- Output stream.- Throws:
IOException- If an error occurred.
-
encode
Description copied from interface:ASN1ValueWrite this value's DER encoding to an output stream using an implicit tag.- Specified by:
encodein interfaceASN1Value- Parameters:
implicitTag- Implicit tag.ostream- Output stream.- Throws:
IOException- If an error occurred.
-
getTag
Description copied from interface:ASN1ValueReturns 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.
-