public abstract class CMSContentInfo
extends java.lang.Object
A CMS object consists of a content type, and content.
Subclasses must override the getExposedContent
and
inputContent
methods.
Modifier | Constructor and Description |
---|---|
protected |
CMSContentInfo(ASN1ObjectID contentType)
Creates a
CMSContentInfo object with the specified content type. |
Modifier and Type | Method and Description |
---|---|
byte[] |
computeDigest(java.security.MessageDigest md)
Computes the Message Digest of the exposed content.
|
static java.lang.String |
contentTypeName(ASN1ObjectID contentType)
Returns the content type of the CMS Object.
|
ASN1ObjectID |
getContentType()
Returns the content type of the CMS object.
|
protected abstract byte[] |
getExposedContent()
Returns the contents octets of the DER encoding of the content field of this CMS
object.
|
void |
input(java.io.InputStream is)
Initialize this CMS Object by reading a BER encoding from the specified input stream.
|
protected abstract void |
inputContent(java.io.InputStream is)
Initializes this object by reading the Content field of the CMS ContentInfo structure i.e.
|
static CMSContentInfo |
inputInstance(java.io.InputStream is)
Creates a
CMSContentInfo object by reading a BER encoding from the
given input stream. |
boolean |
isDegenerate()
Returns
false , except as noted below. |
abstract boolean |
isDetached()
This method must be implemented by the subclasses.
|
int |
length()
Returns the length of this object's encoding.
|
void |
output(java.io.OutputStream os)
Outputs this object to the specified output stream.
|
protected abstract void |
setExposedContent(byte[] expContent)
Returns the contents octets of the DER encoding of the content field of this CMS
object.
|
protected void |
update()
Clears the internal output cache.
|
protected CMSContentInfo(ASN1ObjectID contentType)
CMSContentInfo
object with the specified content type.contentType
- The content type of the object.CMS
public static CMSContentInfo inputInstance(java.io.InputStream is) throws java.io.IOException
CMSContentInfo
object by reading a BER encoding from the
given input stream.
This method is typically used to read nested CMS Objects instead of using the
CMSInputStream
classes.
is
- The input stream containing an encoded CMS Object.java.io.IOException
- If an I/O error occurred or the CMS object encoding was
incorrect or the CMS object content type is not supported.CMSInputStream
public ASN1ObjectID getContentType()
CMS
protected abstract byte[] getExposedContent()
null
for a detached CMS object.isDetached()
public static java.lang.String contentTypeName(ASN1ObjectID contentType)
public boolean isDegenerate()
false
, except as noted below.
CMS (RFC-2630) defines a degenerate case only for the CMSSignedDataContentInfo
i.e.
signed-data
, so this method is overridden to return true
when
appropriate.
public abstract boolean isDetached()
A detached object is defined as one in which the protected content is not present.
In the case of CMSDigestedDataContentInfo
,
CMSSignedDataContentInfo
and CMSAuthenticatedDataContentInfo
the econtent is missing in the EncapsulatedContentInfo structure. In the
case of CMSEncryptedDataContentInfo
and CMSEnvelopedDataContentInfo
the encryptedContent is missing in the EncryptedContentInfo structure.
NOTE: This method only indicates the presence of protected content. There is no way to distinguish between missing content and empty protected content.
true
if the protected content is missing true
; false
otherwisefalse
.protected abstract void setExposedContent(byte[] expContent)
isDetached()
public byte[] computeDigest(java.security.MessageDigest md)
Note the changes in the Method signature
Previously public byte[] computeDigest (oracle.security.crypto.core.MessageDigest md)
Now public byte[] computeDigest (java.security.MessageDigest md)
md
- The message digest.getExposedContent()
public void input(java.io.InputStream is) throws java.io.IOException
is
- The input stream containing CMS Objects.java.io.IOException
- An I/O error occurred or the CMS Object encoding was
incorrect or the CMS Object content type is not supported.protected abstract void inputContent(java.io.InputStream is) throws java.io.IOException
This method must be implemented by subclasses. It is unlikely that package users will ever need to call it directly.
java.io.IOException
public void output(java.io.OutputStream os) throws java.io.IOException
You must ensure that the CMSContentInfo
object has been
properly initialized.
java.io.IOException
- If the content is null
or an I/O error occurs.public int length()
protected void update()