Java 类org.bouncycastle.asn1.cms.EnvelopedDataParser 实例源码

项目:ipack    文件:CMSEnvelopedDataParser.java   
public CMSEnvelopedDataParser(
    InputStream    envelopedData) 
    throws CMSException, IOException
{
    super(envelopedData);

    this.attrNotRead = true;
    this.envelopedData = new EnvelopedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE));

    // TODO Validate version?
    //DERInteger version = this._envelopedData.getVersion();

    OriginatorInfo info = this.envelopedData.getOriginatorInfo();

    if (info != null)
    {
        this.originatorInfo = new OriginatorInformation(info);
    }

    //
    // read the recipients
    //
    ASN1Set recipientInfos = ASN1Set.getInstance(this.envelopedData.getRecipientInfos().toASN1Primitive());

    //
    // read the encrypted content info
    //
    EncryptedContentInfoParser encInfo = this.envelopedData.getEncryptedContentInfo();
    this.encAlg = encInfo.getContentEncryptionAlgorithm();
    CMSReadable readable = new CMSProcessableInputStream(
        ((ASN1OctetStringParser)encInfo.getEncryptedContent(BERTags.OCTET_STRING)).getOctetStream());
    CMSSecureReadable secureReadable = new CMSEnvelopedHelper.CMSEnvelopedSecureReadable(
        this.encAlg, readable);

    //
    // build the RecipientInformationStore
    //
    this.recipientInfoStore = CMSEnvelopedHelper.buildRecipientInformationStore(
        recipientInfos, this.encAlg, secureReadable);
}
项目:gwt-crypto    文件:CMSEnvelopedDataParser.java   
public CMSEnvelopedDataParser(
    InputStream    envelopedData) 
    throws CMSException, IOException
{
    super(envelopedData);

    this.attrNotRead = true;
    this.envelopedData = new EnvelopedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE));

    // TODO Validate version?
    //ASN1Integer version = this._envelopedData.getVersion();

    OriginatorInfo info = this.envelopedData.getOriginatorInfo();

    if (info != null)
    {
        this.originatorInfo = new OriginatorInformation(info);
    }

    //
    // read the recipients
    //
    ASN1Set recipientInfos = ASN1Set.getInstance(this.envelopedData.getRecipientInfos().toASN1Primitive());

    //
    // read the encrypted content info
    //
    EncryptedContentInfoParser encInfo = this.envelopedData.getEncryptedContentInfo();
    this.encAlg = encInfo.getContentEncryptionAlgorithm();
    CMSReadable readable = new CMSProcessableInputStream(
        ((ASN1OctetStringParser)encInfo.getEncryptedContent(BERTags.OCTET_STRING)).getOctetStream());
    CMSSecureReadable secureReadable = new CMSEnvelopedHelper.CMSEnvelopedSecureReadable(
        this.encAlg, readable);

    //
    // build the RecipientInformationStore
    //
    this.recipientInfoStore = CMSEnvelopedHelper.buildRecipientInformationStore(
        recipientInfos, this.encAlg, secureReadable);
}
项目:Aki-SSL    文件:CMSEnvelopedDataParser.java   
public CMSEnvelopedDataParser(
    InputStream    envelopedData) 
    throws CMSException, IOException
{
    super(envelopedData);

    this.attrNotRead = true;
    this.envelopedData = new EnvelopedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE));

    // TODO Validate version?
    //ASN1Integer version = this._envelopedData.getVersion();

    OriginatorInfo info = this.envelopedData.getOriginatorInfo();

    if (info != null)
    {
        this.originatorInfo = new OriginatorInformation(info);
    }

    //
    // read the recipients
    //
    ASN1Set recipientInfos = ASN1Set.getInstance(this.envelopedData.getRecipientInfos().toASN1Primitive());

    //
    // read the encrypted content info
    //
    EncryptedContentInfoParser encInfo = this.envelopedData.getEncryptedContentInfo();
    this.encAlg = encInfo.getContentEncryptionAlgorithm();
    CMSReadable readable = new CMSProcessableInputStream(
        ((ASN1OctetStringParser)encInfo.getEncryptedContent(BERTags.OCTET_STRING)).getOctetStream());
    CMSSecureReadable secureReadable = new CMSEnvelopedHelper.CMSEnvelopedSecureReadable(
        this.encAlg, readable);

    //
    // build the RecipientInformationStore
    //
    this.recipientInfoStore = CMSEnvelopedHelper.buildRecipientInformationStore(
        recipientInfos, this.encAlg, secureReadable);
}
项目:irma_future_id    文件:CMSEnvelopedDataParser.java   
public CMSEnvelopedDataParser(
    InputStream    envelopedData) 
    throws CMSException, IOException
{
    super(envelopedData);

    this.attrNotRead = true;
    this.envelopedData = new EnvelopedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE));

    // TODO Validate version?
    //DERInteger version = this._envelopedData.getVersion();

    OriginatorInfo info = this.envelopedData.getOriginatorInfo();

    if (info != null)
    {
        this.originatorInfo = new OriginatorInformation(info);
    }

    //
    // read the recipients
    //
    ASN1Set recipientInfos = ASN1Set.getInstance(this.envelopedData.getRecipientInfos().toASN1Primitive());

    //
    // read the encrypted content info
    //
    EncryptedContentInfoParser encInfo = this.envelopedData.getEncryptedContentInfo();
    this.encAlg = encInfo.getContentEncryptionAlgorithm();
    CMSReadable readable = new CMSProcessableInputStream(
        ((ASN1OctetStringParser)encInfo.getEncryptedContent(BERTags.OCTET_STRING)).getOctetStream());
    CMSSecureReadable secureReadable = new CMSEnvelopedHelper.CMSEnvelopedSecureReadable(
        this.encAlg, readable);

    //
    // build the RecipientInformationStore
    //
    this.recipientInfoStore = CMSEnvelopedHelper.buildRecipientInformationStore(
        recipientInfos, this.encAlg, secureReadable);
}
项目:irma_future_id    文件:CMSEnvelopedDataParser.java   
public CMSEnvelopedDataParser(
    InputStream    envelopedData) 
    throws CMSException, IOException
{
    super(envelopedData);

    this.attrNotRead = true;
    this.envelopedData = new EnvelopedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE));

    // TODO Validate version?
    //DERInteger version = this._envelopedData.getVersion();

    OriginatorInfo info = this.envelopedData.getOriginatorInfo();

    if (info != null)
    {
        this.originatorInfo = new OriginatorInformation(info);
    }

    //
    // read the recipients
    //
    ASN1Set recipientInfos = ASN1Set.getInstance(this.envelopedData.getRecipientInfos().toASN1Primitive());

    //
    // read the encrypted content info
    //
    EncryptedContentInfoParser encInfo = this.envelopedData.getEncryptedContentInfo();
    this.encAlg = encInfo.getContentEncryptionAlgorithm();
    CMSReadable readable = new CMSProcessableInputStream(
        ((ASN1OctetStringParser)encInfo.getEncryptedContent(BERTags.OCTET_STRING)).getOctetStream());
    CMSSecureReadable secureReadable = new CMSEnvelopedHelper.CMSEnvelopedSecureReadable(
        this.encAlg, readable);

    //
    // build the RecipientInformationStore
    //
    this.recipientInfoStore = CMSEnvelopedHelper.buildRecipientInformationStore(
        recipientInfos, this.encAlg, secureReadable);
}
项目:bc-java    文件:CMSEnvelopedDataParser.java   
public CMSEnvelopedDataParser(
    InputStream    envelopedData) 
    throws CMSException, IOException
{
    super(envelopedData);

    this.attrNotRead = true;
    this.envelopedData = new EnvelopedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE));

    // TODO Validate version?
    //DERInteger version = this._envelopedData.getVersion();

    OriginatorInfo info = this.envelopedData.getOriginatorInfo();

    if (info != null)
    {
        this.originatorInfo = new OriginatorInformation(info);
    }

    //
    // read the recipients
    //
    ASN1Set recipientInfos = ASN1Set.getInstance(this.envelopedData.getRecipientInfos().toASN1Primitive());

    //
    // read the encrypted content info
    //
    EncryptedContentInfoParser encInfo = this.envelopedData.getEncryptedContentInfo();
    this.encAlg = encInfo.getContentEncryptionAlgorithm();
    CMSReadable readable = new CMSProcessableInputStream(
        ((ASN1OctetStringParser)encInfo.getEncryptedContent(BERTags.OCTET_STRING)).getOctetStream());
    CMSSecureReadable secureReadable = new CMSEnvelopedHelper.CMSEnvelopedSecureReadable(
        this.encAlg, readable);

    //
    // build the RecipientInformationStore
    //
    this.recipientInfoStore = CMSEnvelopedHelper.buildRecipientInformationStore(
        recipientInfos, this.encAlg, secureReadable);
}
项目:bc-java    文件:CMSEnvelopedDataParser.java   
public CMSEnvelopedDataParser(
    InputStream    envelopedData) 
    throws CMSException, IOException
{
    super(envelopedData);

    this.attrNotRead = true;
    this.envelopedData = new EnvelopedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE));

    // TODO Validate version?
    //DERInteger version = this._envelopedData.getVersion();

    OriginatorInfo info = this.envelopedData.getOriginatorInfo();

    if (info != null)
    {
        this.originatorInfo = new OriginatorInformation(info);
    }

    //
    // read the recipients
    //
    ASN1Set recipientInfos = ASN1Set.getInstance(this.envelopedData.getRecipientInfos().toASN1Primitive());

    //
    // read the encrypted content info
    //
    EncryptedContentInfoParser encInfo = this.envelopedData.getEncryptedContentInfo();
    this.encAlg = encInfo.getContentEncryptionAlgorithm();
    CMSReadable readable = new CMSProcessableInputStream(
        ((ASN1OctetStringParser)encInfo.getEncryptedContent(BERTags.OCTET_STRING)).getOctetStream());
    CMSSecureReadable secureReadable = new CMSEnvelopedHelper.CMSEnvelopedSecureReadable(
        this.encAlg, readable);

    //
    // build the RecipientInformationStore
    //
    this.recipientInfoStore = CMSEnvelopedHelper.buildRecipientInformationStore(
        recipientInfos, this.encAlg, secureReadable);
}
项目:irma_future_id    文件:ParseTest.java   
private void parseEnveloped(byte[] data) throws IOException
{
    ASN1StreamParser aIn = new ASN1StreamParser(data);

    ContentInfoParser cP = new ContentInfoParser((ASN1SequenceParser)aIn.readObject());

    EnvelopedDataParser eP = new EnvelopedDataParser((ASN1SequenceParser)cP.getContent(BERTags.SEQUENCE));

    eP.getRecipientInfos().toASN1Primitive(); // Must drain the parser!

    EncryptedContentInfoParser ecP = eP.getEncryptedContentInfo();

    ASN1OctetStringParser content = (ASN1OctetStringParser)ecP.getEncryptedContent(BERTags.OCTET_STRING);

    Streams.drain(content.getOctetStream());
}
项目:bc-java    文件:ParseTest.java   
private void parseEnveloped(byte[] data) throws IOException
{
    ASN1StreamParser aIn = new ASN1StreamParser(data);

    ContentInfoParser cP = new ContentInfoParser((ASN1SequenceParser)aIn.readObject());

    EnvelopedDataParser eP = new EnvelopedDataParser((ASN1SequenceParser)cP.getContent(BERTags.SEQUENCE));

    eP.getRecipientInfos().toASN1Primitive(); // Must drain the parser!

    EncryptedContentInfoParser ecP = eP.getEncryptedContentInfo();

    ASN1OctetStringParser content = (ASN1OctetStringParser)ecP.getEncryptedContent(BERTags.OCTET_STRING);

    Streams.drain(content.getOctetStream());
}