org.bouncycastle.sasn1.cms.ContentInfoParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcmail-jdk15 Show documentation
Show all versions of bcmail-jdk15 Show documentation
The Bouncy Castle Java CMS and S/MIME APIs for handling the CMS and S/MIME protocols. This jar contains CMS and S/MIME APIs for JDK 1.5. The APIs can be used in conjunction with a JCE/JCA provider such as the one provided with the Bouncy Castle Cryptography APIs. If the S/MIME API is used, the JavaMail API and the Java activation framework will also be needed.
package org.bouncycastle.sasn1.cms;
import org.bouncycastle.sasn1.Asn1Object;
import org.bouncycastle.sasn1.Asn1ObjectIdentifier;
import org.bouncycastle.sasn1.Asn1Sequence;
import org.bouncycastle.sasn1.Asn1TaggedObject;
import java.io.IOException;
/**
* Produce an object suitable for an ASN1OutputStream.
*
* ContentInfo ::= SEQUENCE {
* contentType ContentType,
* content
* [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
*
* @deprecated use corresponding class in org.bouncycastle.asn1.cms
*/
public class ContentInfoParser
{
private Asn1ObjectIdentifier contentType;
private Asn1TaggedObject content;
public ContentInfoParser(
Asn1Sequence seq)
throws IOException
{
contentType = (Asn1ObjectIdentifier)seq.readObject();
content = (Asn1TaggedObject)seq.readObject();
}
public Asn1ObjectIdentifier getContentType()
{
return contentType;
}
public Asn1Object getContent(
int tag)
throws IOException
{
if (content != null)
{
return content.getObject(tag, true);
}
return null;
}
}