|
IAIK CMS/SMIME Toolkit API Documentation
Version 6.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectiaik.cms.EncapsulatedContentInfoStream
iaik.cms.EncapsulatedContentInfo
public class EncapsulatedContentInfo
This class represents the non-stream implementation of the CMS
EncapsulatedContentInfo type.
The Cryptographic Message Syntax (CMS) (RFC 5652) specifies the EncapsualtedContentInfo type for carrying the inherent content of an CMS object:
EncapsulatedContentInfo ::= SEQUENCE {
eContentType ContentType,
eContent [0] EXPLICIT OCTET STRING OPTIONAL }
ContentType ::= OBJECT IDENTIFIER
The eContentType field associates a content type
with some particular content, encoded as OCTET STRING. The content
field may be omitted to transmit the content by other means.
The stream-supporting equivalent to this class is implemented by the
EncapsulatedContentInfoStream class.
This class does NOT interpret the content to be transmitted, i.e. the content
is only treated as byte material. When creating a new EncapsulatedContentInfo to be
sent use the EncapsulatedContentInfo(byte[] content, ObjectID contentType) constructor
for supplying content bytes and content type and subsequently call the toASN1Object or writeTo method, e.g.:
// the content bytes byte[] content = ...; // the content type (e.g. cms data): ObjectID contentType = ObjectID.cms_data; ... // create a EncapsulatedContentInfo object and encode it to a stream: EncapsulatedContentInfo eci = new EncapsulatedContentInfo(content, contentType); OutputStream encoded_stream = ...; eci.writeTo(encoded_stream);If you want to use an EncapsulatedContentInfo without any content, you only have to supply the content type identifier when
creating an EncapsulatedContentInfo object, e.g.:
EncapsulatedContentInfo eci = new EncapsulatedContentInfo(ObjectID.cms_data); eci.writeTo(encoded_stream);For parsing an already existing EncapsulatedContentInfo (given as ASN1Object or DER encoding) use the
EncapsulatedContentInfo(ASN1Object obj) or EncapsulatedContentInfo(InputStream is) constructor.
However, GENERALLY there should be no need for an application to immediately access this class at all. This library implements the CMS types in a way that handles the EncapsulatedContentInfo type transparent inside the corresponding classes (e.g. SignedData, ...).
| Field Summary |
|---|
| Fields inherited from class iaik.cms.EncapsulatedContentInfoStream |
|---|
blockSize_, contentData_, contentType_ |
| Constructor Summary | |
|---|---|
protected |
EncapsulatedContentInfo()
Default constructor. |
|
EncapsulatedContentInfo(iaik.asn1.ASN1Object obj)
Creates a CMS EncapsulatedContentInfo from an ASN1Object. |
|
EncapsulatedContentInfo(byte[] content,
iaik.asn1.ObjectID contentType)
Creates a CMS EncapsulatedContentInfo from given content value
and content type. |
|
EncapsulatedContentInfo(java.io.InputStream is)
Creates a new EncapsulatedContentInfo where the DER encoded data is read from the given InputStream. |
|
EncapsulatedContentInfo(iaik.asn1.ObjectID contentType)
Creates an CMS EncapsulatedContentInfo from the given content type. |
| Method Summary | |
|---|---|
protected void |
decode(iaik.asn1.DerInputStream is)
Reads and decodes an encoded EncapsulatedContentInfo from a input stream. |
byte[] |
getContent()
Returns the content of this CMS EncapsulatedContentInfo. |
java.io.InputStream |
getContentInputStream()
Returns an InputStream supplying the content bytes of this CMS EncapsulatedContentInfo. |
iaik.asn1.ObjectID |
getContentType()
Returns the content type of this CMS EncapsulatedContentInfo. |
boolean |
hasContent()
Returns true if this EncapsulatedContentInfo has a content. |
iaik.asn1.ASN1Object |
toASN1Object()
Returns this CMS EncapsulatedContentInfo as ASN1Object. |
byte[] |
toByteArray()
Returns this CMS EncapsulatedContentInfo as DER encoded byte array. |
java.lang.String |
toString()
Returns a string giving some information about this CMS EncapsulatedContentInfo. |
java.lang.String |
toString(boolean detailed)
Returns a string giving some - if requested - detailed information about this CMS EncapsulatedContentInfo. |
void |
writeTo(java.io.OutputStream os)
Writes the DER encoding of this object to the given OutputStream. |
| Methods inherited from class iaik.cms.EncapsulatedContentInfoStream |
|---|
setBlockSize |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected EncapsulatedContentInfo()
public EncapsulatedContentInfo(byte[] content,
iaik.asn1.ObjectID contentType)
EncapsulatedContentInfo from given content value
and content type.
content - the content byte materialcontentType - the content typepublic EncapsulatedContentInfo(iaik.asn1.ObjectID contentType)
EncapsulatedContentInfo from the given content type.
Since no content is specified, it is set to null. The content
value may be transmitted by other means.
contentType - the type of the content
public EncapsulatedContentInfo(iaik.asn1.ASN1Object obj)
throws CMSParsingException
EncapsulatedContentInfo
object which may have been created by using the
toASN1Object method of this class.
obj - the CMS EncapsulatedContentInfo as an ASN1Object
CMSParsingException - if the ASN1Object could not be parsed
public EncapsulatedContentInfo(java.io.InputStream is)
throws java.io.IOException,
CMSParsingException
EncapsulatedContentInfo object which may have been written to a stream by using
the writeTo method of this class.
is - the InputStream holding a DER encoded CMS EncapsulatedContentInfo object
java.io.IOException - if an I/O error occurs during reading from the InputStream
CMSParsingException - if an error occurs while parsing the object| Method Detail |
|---|
protected void decode(iaik.asn1.DerInputStream is)
throws java.io.IOException,
CMSParsingException
decode in class EncapsulatedContentInfoStreamis - the InputStream holding a DER encoded CMS EncapsulatedContentInfo object
java.io.IOException - if an I/O error occurs during reading from the InputStream
CMSParsingException - if an error occurs while parsing the object
public iaik.asn1.ASN1Object toASN1Object()
throws CMSException
EncapsulatedContentInfo from an ASN1Object by calling the
EncapsulatedContentInfo(ASN1Object obj) constructor.
toASN1Object in class EncapsulatedContentInfoStreamCMSException - if an ASN.1 parsing error occurs
public byte[] toByteArray()
throws CMSException
CMSException - if an error occurs while encoding the object
public void writeTo(java.io.OutputStream os)
throws java.io.IOException,
CMSException
writeTo in class EncapsulatedContentInfoStreamos - the OutputStream where the encoding shall be written to
java.io.IOException - if an I/O error occurs during writing to the OutputStream
CMSException - if an error occurs while encoding the objectpublic boolean hasContent()
hasContent in class EncapsulatedContentInfoStreampublic byte[] getContent()
null if there is no contentpublic java.io.InputStream getContentInputStream()
getContentInputStream in class EncapsulatedContentInfoStreamnull if there is no contentpublic iaik.asn1.ObjectID getContentType()
getContentType in class EncapsulatedContentInfoStreampublic java.lang.String toString()
toString in class EncapsulatedContentInfoStreampublic java.lang.String toString(boolean detailed)
toString in class EncapsulatedContentInfoStreamdetailed - - whether or not to give detailed information
|
IAIK CMS/SMIME Toolkit API Documentation
Version 6.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
|
v6.1 (c) 2002 IAIK, (c) 2003 - 2025 SIC |
|