Package org.mozilla.jss.pkcs7
Class ContentInfo
- java.lang.Object
-
- org.mozilla.jss.pkcs7.ContentInfo
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classContentInfo.TemplateA template for decoding a ContentInfo blob
-
Field Summary
Fields Modifier and Type Field Description static OBJECT_IDENTIFIERDATAstatic OBJECT_IDENTIFIERDIGESTED_DATAstatic OBJECT_IDENTIFIERENCRYPTED_DATAstatic OBJECT_IDENTIFIERENVELOPED_DATAstatic OBJECT_IDENTIFIERSIGNED_AND_ENVELOPED_DATAstatic OBJECT_IDENTIFIERSIGNED_DATAstatic TagTAG
-
Constructor Summary
Constructors Constructor Description ContentInfo(byte[] data)Creates a ContentInfo of typedata.ContentInfo(OBJECT_IDENTIFIER contentType, ASN1Value content)Creates a ContentInfo with the given type and content.ContentInfo(DigestedData dd)Creates a ContentInfo of typedigestedData.ContentInfo(EncryptedData ed)Creates a ContentInfo of typeencryptedData.ContentInfo(EnvelopedData ed)Creates a ContentInfo of typeenvelopedData.ContentInfo(SignedAndEnvelopedData sed)Creates a ContentInfo of typesignedAndEnvelopedData.ContentInfo(SignedData sd)Creates a ContentInfo of typesignedData.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidencode(java.io.OutputStream ostream)Write this value's DER encoding to an output stream using its own base tag.voidencode(Tag implicitTag, java.io.OutputStream ostream)Write this value's DER encoding to an output stream using an implicit tag.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()Returns the base tag for this type, not counting any tags that may be imposed on it by its context.static ContentInfo.TemplategetTemplate()Returns a singleton instance of a decoding template for ContentInfo.booleanhasContent()Returnstrueif the content field is present.
-
-
-
Field Detail
-
TAG
public static final Tag TAG
-
DATA
public static OBJECT_IDENTIFIER DATA
-
SIGNED_DATA
public static OBJECT_IDENTIFIER SIGNED_DATA
-
ENVELOPED_DATA
public static OBJECT_IDENTIFIER ENVELOPED_DATA
-
SIGNED_AND_ENVELOPED_DATA
public static OBJECT_IDENTIFIER SIGNED_AND_ENVELOPED_DATA
-
DIGESTED_DATA
public static OBJECT_IDENTIFIER DIGESTED_DATA
-
ENCRYPTED_DATA
public static OBJECT_IDENTIFIER ENCRYPTED_DATA
-
-
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 benullto signify that the optional content field is not present.
-
ContentInfo
public ContentInfo(byte[] data)
Creates a ContentInfo of typedata.
-
ContentInfo
public ContentInfo(SignedData sd)
Creates a ContentInfo of typesignedData.
-
ContentInfo
public ContentInfo(EnvelopedData ed)
Creates a ContentInfo of typeenvelopedData.
-
ContentInfo
public ContentInfo(SignedAndEnvelopedData sed)
Creates a ContentInfo of typesignedAndEnvelopedData.
-
ContentInfo
public ContentInfo(DigestedData dd)
Creates a ContentInfo of typedigestedData.
-
ContentInfo
public ContentInfo(EncryptedData ed)
Creates a ContentInfo of typeencryptedData.
-
-
Method Detail
-
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.
-
hasContent
public boolean hasContent()
Returnstrueif the content field is present.
-
getInterpretedContent
public ASN1Value getInterpretedContent() throws InvalidBERException
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
public ANY getContent()
Returns the content encoded as an ANY. If there is no content,nullis returned.
-
encode
public void encode(java.io.OutputStream ostream) throws java.io.IOExceptionDescription copied from interface:ASN1ValueWrite this value's DER encoding to an output stream using its own base tag.
-
encode
public void encode(Tag implicitTag, java.io.OutputStream ostream) throws java.io.IOException
Description copied from interface:ASN1ValueWrite this value's DER encoding to an output stream using an implicit tag.
-
getTag
public Tag 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
public static ContentInfo.Template getTemplate()
Returns a singleton instance of a decoding template for ContentInfo.
-
-