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

项目:ipack    文件:CMSUtils.java   
static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos)
{
    List others = new ArrayList();

    for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();)
    {
        ASN1Encodable info = (ASN1Encodable)it.next();

        if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(otherRevocationInfoFormat))
        {
            OCSPResponse resp = OCSPResponse.getInstance(info);

            if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
            {
                throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
            }
        }

        others.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, info)));
    }

    return others;
}
项目:ipack    文件:CMSTimeStampedDataParser.java   
private void initialize(ContentInfoParser contentInfo)
    throws CMSException
{
    try
    {
        if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType()))
        {
            this.timeStampedData = TimeStampedDataParser.getInstance(contentInfo.getContent(BERTags.SEQUENCE));
        }
        else
        {
            throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId());
        }
    }
    catch (IOException e)
    {
        throw new CMSException("parsing exception: " + e.getMessage(), e);
    }
}
项目:gwt-crypto    文件:CMSTimeStampedDataParser.java   
private void initialize(ContentInfoParser contentInfo)
    throws CMSException
{
    try
    {
        if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType()))
        {
            this.timeStampedData = TimeStampedDataParser.getInstance(contentInfo.getContent(BERTags.SEQUENCE));
        }
        else
        {
            throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId());
        }
    }
    catch (IOException e)
    {
        throw new CMSException("parsing exception: " + e.getMessage(), e);
    }
}
项目:Aki-SSL    文件:CMSTimeStampedDataParser.java   
private void initialize(ContentInfoParser contentInfo)
    throws CMSException
{
    try
    {
        if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType()))
        {
            this.timeStampedData = TimeStampedDataParser.getInstance(contentInfo.getContent(BERTags.SEQUENCE));
        }
        else
        {
            throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId());
        }
    }
    catch (IOException e)
    {
        throw new CMSException("parsing exception: " + e.getMessage(), e);
    }
}
项目:dss    文件:CAdESOCSPSource.java   
private void addBasicOcspRespFrom_id_ri_ocsp_response(final List<BasicOCSPResp> basicOCSPResps) {
    final Store otherRevocationInfo = cmsSignedData.getOtherRevocationInfo(CMSObjectIdentifiers.id_ri_ocsp_response);
    final Collection otherRevocationInfoMatches = otherRevocationInfo.getMatches(null);
    for (final Object object : otherRevocationInfoMatches) {
        if (object instanceof DERSequence) {
            final DERSequence otherRevocationInfoMatch = (DERSequence) object;
            final BasicOCSPResp basicOCSPResp;
            if (otherRevocationInfoMatch.size() == 4) {
                basicOCSPResp = CMSUtils.getBasicOcspResp(otherRevocationInfoMatch);
            } else {
                final OCSPResp ocspResp = CMSUtils.getOcspResp(otherRevocationInfoMatch);
                basicOCSPResp = CMSUtils.getBasicOCSPResp(ocspResp);
            }
            addBasicOcspResp(basicOCSPResps, basicOCSPResp);
        } else {
            LOG.warn("Unsupported object type for id_ri_ocsp_response (SHALL be DER encoding) : " + object.getClass().getSimpleName());
        }
    }
}
项目:irma_future_id    文件:CMSUtils.java   
static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos)
{
    List others = new ArrayList();

    for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();)
    {
        ASN1Encodable info = (ASN1Encodable)it.next();

        if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(otherRevocationInfoFormat))
        {
            OCSPResponse resp = OCSPResponse.getInstance(info);

            if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
            {
                throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
            }
        }

        others.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, info)));
    }

    return others;
}
项目:irma_future_id    文件:CMSTimeStampedDataParser.java   
private void initialize(ContentInfoParser contentInfo)
    throws CMSException
{
    try
    {
        if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType()))
        {
            this.timeStampedData = TimeStampedDataParser.getInstance(contentInfo.getContent(BERTags.SEQUENCE));
        }
        else
        {
            throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId());
        }
    }
    catch (IOException e)
    {
        throw new CMSException("parsing exception: " + e.getMessage(), e);
    }
}
项目:irma_future_id    文件:CMSUtils.java   
static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos)
{
    List others = new ArrayList();

    for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();)
    {
        ASN1Encodable info = (ASN1Encodable)it.next();

        if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(otherRevocationInfoFormat))
        {
            OCSPResponse resp = OCSPResponse.getInstance(info);

            if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
            {
                throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
            }
        }

        others.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, info)));
    }

    return others;
}
项目:irma_future_id    文件:CMSTimeStampedDataParser.java   
private void initialize(ContentInfoParser contentInfo)
    throws CMSException
{
    try
    {
        if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType()))
        {
            this.timeStampedData = TimeStampedDataParser.getInstance(contentInfo.getContent(BERTags.SEQUENCE));
        }
        else
        {
            throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId());
        }
    }
    catch (IOException e)
    {
        throw new CMSException("parsing exception: " + e.getMessage(), e);
    }
}
项目:irma_future_id    文件:CMSUtils.java   
static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos)
{
    List others = new ArrayList();

    for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();)
    {
        ASN1Encodable info = (ASN1Encodable)it.next();

        if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(otherRevocationInfoFormat))
        {
            OCSPResponse resp = OCSPResponse.getInstance(info);

            if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
            {
                throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
            }
        }

        others.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, info)));
    }

    return others;
}
项目:irma_future_id    文件:CMSTimeStampedDataParser.java   
private void initialize(ContentInfoParser contentInfo)
    throws CMSException
{
    try
    {
        if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType()))
        {
            this.timeStampedData = TimeStampedDataParser.getInstance(contentInfo.getContent(BERTags.SEQUENCE));
        }
        else
        {
            throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId());
        }
    }
    catch (IOException e)
    {
        throw new CMSException("parsing exception: " + e.getMessage(), e);
    }
}
项目:bc-java    文件:CMSUtils.java   
static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos)
{
    List others = new ArrayList();

    for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();)
    {
        ASN1Encodable info = (ASN1Encodable)it.next();

        if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(otherRevocationInfoFormat))
        {
            OCSPResponse resp = OCSPResponse.getInstance(info);

            if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
            {
                throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
            }
        }

        others.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, info)));
    }

    return others;
}
项目:bc-java    文件:CMSTimeStampedDataParser.java   
private void initialize(ContentInfoParser contentInfo)
    throws CMSException
{
    try
    {
        if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType()))
        {
            this.timeStampedData = TimeStampedDataParser.getInstance(contentInfo.getContent(BERTags.SEQUENCE));
        }
        else
        {
            throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId());
        }
    }
    catch (IOException e)
    {
        throw new CMSException("parsing exception: " + e.getMessage(), e);
    }
}
项目:bc-java    文件:CMSUtils.java   
static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos)
{
    List others = new ArrayList();

    for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();)
    {
        ASN1Encodable info = (ASN1Encodable)it.next();

        if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(otherRevocationInfoFormat))
        {
            OCSPResponse resp = OCSPResponse.getInstance(info);

            if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
            {
                throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
            }
        }

        others.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, info)));
    }

    return others;
}
项目:bc-java    文件:CMSTimeStampedDataParser.java   
private void initialize(ContentInfoParser contentInfo)
    throws CMSException
{
    try
    {
        if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType()))
        {
            this.timeStampedData = TimeStampedDataParser.getInstance(contentInfo.getContent(BERTags.SEQUENCE));
        }
        else
        {
            throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId());
        }
    }
    catch (IOException e)
    {
        throw new CMSException("parsing exception: " + e.getMessage(), e);
    }
}
项目:bc-java    文件:CMSUtils.java   
static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos)
{
    List others = new ArrayList();

    for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();)
    {
        ASN1Encodable info = (ASN1Encodable)it.next();

        if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(otherRevocationInfoFormat))
        {
            OCSPResponse resp = OCSPResponse.getInstance(info);

            if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
            {
                throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
            }
        }

        others.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, info)));
    }

    return others;
}
项目:bc-java    文件:CMSTimeStampedDataParser.java   
private void initialize(ContentInfoParser contentInfo)
    throws CMSException
{
    try
    {
        if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType()))
        {
            this.timeStampedData = TimeStampedDataParser.getInstance(contentInfo.getContent(BERTags.SEQUENCE));
        }
        else
        {
            throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId());
        }
    }
    catch (IOException e)
    {
        throw new CMSException("parsing exception: " + e.getMessage(), e);
    }
}
项目:ipack    文件:CMSAuthenticatedDataGenerator.java   
/**
 * generate an authenticated object that contains an CMS Authenticated Data
 * object using the given provider and the passed in key generator.
 * @deprecated
 */
private CMSAuthenticatedData generate(
    final CMSProcessable  content,
    String          macOID,
    KeyGenerator    keyGen,
    Provider        provider)
    throws NoSuchAlgorithmException, CMSException
{
    Provider                encProvider = keyGen.getProvider();

    convertOldRecipients(rand, provider);

    return generate(new CMSTypedData()
    {
        public ASN1ObjectIdentifier getContentType()
        {
            return CMSObjectIdentifiers.data;
        }

        public void write(OutputStream out)
            throws IOException, CMSException
        {
            content.write(out);
        }

        public Object getContent()
        {
            return content;
        }
    }, new JceCMSMacCalculatorBuilder(new ASN1ObjectIdentifier(macOID)).setProvider(encProvider).setSecureRandom(rand).build());
}
项目:ipack    文件:CMSSignedDataStreamGenerator.java   
/**
 * generate a signed object that for a CMS Signed Data
 * object using the given provider - if encapsulate is true a copy
 * of the message will be included in the signature with the
 * default content type "data".
 */
public OutputStream open(
    OutputStream out,
    boolean      encapsulate)
    throws IOException
{
    return open(CMSObjectIdentifiers.data, out, encapsulate);
}
项目:ipack    文件:CMSEnvelopedDataStreamGenerator.java   
/**
 * generate an enveloped object that contains an CMS Enveloped Data
 * object using the given encryptor.
 */
public OutputStream open(
    OutputStream    out,
    OutputEncryptor encryptor)
    throws CMSException, IOException
{
    return doOpen(new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId()), out, encryptor);
}
项目:ipack    文件:CMSAuthenticatedDataStreamGenerator.java   
/**
 * generate an authenticated data structure with the encapsulated bytes marked as DATA.
 *
 * @param out the stream to store the authenticated structure in.
 * @param macCalculator calculator for the MAC to be attached to the data.
 */
public OutputStream open(
    OutputStream    out,
    MacCalculator   macCalculator)
    throws CMSException
{
    return open(CMSObjectIdentifiers.data, out, macCalculator);
}
项目:ipack    文件:CMSAuthenticatedDataStreamGenerator.java   
public OutputStream open(
    OutputStream    out,
    MacCalculator   macCalculator,
    DigestCalculator digestCalculator)
    throws CMSException
{
    return open(CMSObjectIdentifiers.data, out, macCalculator, digestCalculator);
}
项目:ipack    文件:CMSCompressedDataStreamGenerator.java   
/**
 * @deprecated use open(OutputStream, ContentCompressor)
 */
public OutputStream open(
    OutputStream out,
    String       compressionOID) 
    throws IOException
{
    return open(out, CMSObjectIdentifiers.data.getId(), compressionOID);
}
项目:ipack    文件:CMSCompressedDataStreamGenerator.java   
/**
 * @deprecated use open(OutputStream, ASN1ObjectIdentifier, ContentCompressor)
 */
public OutputStream open(
    OutputStream  out,        
    String        contentOID,
    String        compressionOID) 
    throws IOException
{
    BERSequenceGenerator sGen = new BERSequenceGenerator(out);

    sGen.addObject(CMSObjectIdentifiers.compressedData);

    //
    // Compressed Data
    //
    BERSequenceGenerator cGen = new BERSequenceGenerator(sGen.getRawOutputStream(), 0, true);

    cGen.addObject(new ASN1Integer(0));

    //
    // AlgorithmIdentifier
    //
    DERSequenceGenerator algGen = new DERSequenceGenerator(cGen.getRawOutputStream());

    algGen.addObject(new ASN1ObjectIdentifier(ZLIB));

    algGen.close();

    //
    // Encapsulated ContentInfo
    //
    BERSequenceGenerator eiGen = new BERSequenceGenerator(cGen.getRawOutputStream());

    eiGen.addObject(new ASN1ObjectIdentifier(contentOID));

    OutputStream octetStream = CMSUtils.createBEROctetOutputStream(
        eiGen.getRawOutputStream(), 0, true, _bufferSize);

    return new CmsCompressedOutputStream(
        new DeflaterOutputStream(octetStream), sGen, cGen, eiGen);
}
项目:ipack    文件:CMSCompressedDataStreamGenerator.java   
public OutputStream open(
    OutputStream out,
    OutputCompressor compressor)
    throws IOException
{
    return open(CMSObjectIdentifiers.data, out, compressor);
}
项目:ipack    文件:CMSCompressedDataStreamGenerator.java   
/**
 * Open a compressing output stream.
 *
 * @param contentOID
 * @param out
 * @param compressor
 * @return
 * @throws IOException
 */
public OutputStream open(
    ASN1ObjectIdentifier contentOID,
    OutputStream out,
    OutputCompressor compressor)
    throws IOException
{
    BERSequenceGenerator sGen = new BERSequenceGenerator(out);

    sGen.addObject(CMSObjectIdentifiers.compressedData);

    //
    // Compressed Data
    //
    BERSequenceGenerator cGen = new BERSequenceGenerator(sGen.getRawOutputStream(), 0, true);

    cGen.addObject(new ASN1Integer(0));

    //
    // AlgorithmIdentifier
    //
    cGen.addObject(compressor.getAlgorithmIdentifier());

    //
    // Encapsulated ContentInfo
    //
    BERSequenceGenerator eiGen = new BERSequenceGenerator(cGen.getRawOutputStream());

    eiGen.addObject(contentOID);

    OutputStream octetStream = CMSUtils.createBEROctetOutputStream(
        eiGen.getRawOutputStream(), 0, true, _bufferSize);

    return new CmsCompressedOutputStream(
        compressor.getOutputStream(octetStream), sGen, cGen, eiGen);
}
项目:ipack    文件:CMSTimeStampedData.java   
private void initialize(ContentInfo contentInfo)
{
    this.contentInfo = contentInfo;

    if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType()))
    {
        this.timeStampedData = TimeStampedData.getInstance(contentInfo.getContent());
    }
    else
    {
        throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId());
    }

    util = new TimeStampDataUtil(this.timeStampedData);
}
项目:ipack    文件:CMSTimeStampedData.java   
/**
 * Return a new timeStampedData object with the additional token attached.
 *
 * @throws CMSException
 */
public CMSTimeStampedData addTimeStamp(TimeStampToken token)
    throws CMSException
{
    TimeStampAndCRL[] timeStamps = util.getTimeStamps();
    TimeStampAndCRL[] newTimeStamps = new TimeStampAndCRL[timeStamps.length + 1];

    System.arraycopy(timeStamps, 0, newTimeStamps, 0, timeStamps.length);

    newTimeStamps[timeStamps.length] = new TimeStampAndCRL(token.toCMSSignedData().toASN1Structure());

    return new CMSTimeStampedData(new ContentInfo(CMSObjectIdentifiers.timestampedData, new TimeStampedData(timeStampedData.getDataUri(), timeStampedData.getMetaData(), timeStampedData.getContent(), new Evidence(new TimeStampTokenEvidence(newTimeStamps)))));
}
项目:gwt-crypto    文件:CMSUtils.java   
private static void validateInfoFormat(OtherRevocationInfoFormat infoFormat)
{
    if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(infoFormat.getInfoFormat()))
    {
        OCSPResponse resp = OCSPResponse.getInstance(infoFormat.getInfo());

        if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
        {
            throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
        }
    }
}
项目:gwt-crypto    文件:CMSSignedDataStreamGenerator.java   
/**
 * generate a signed object that for a CMS Signed Data
 * object using the given provider - if encapsulate is true a copy
 * of the message will be included in the signature with the
 * default content type "data".
 */
public OutputStream open(
    OutputStream out,
    boolean      encapsulate)
    throws IOException
{
    return open(CMSObjectIdentifiers.data, out, encapsulate);
}
项目:gwt-crypto    文件:CMSEnvelopedDataStreamGenerator.java   
/**
 * generate an enveloped object that contains an CMS Enveloped Data
 * object using the given encryptor.
 */
public OutputStream open(
    OutputStream    out,
    OutputEncryptor encryptor)
    throws CMSException, IOException
{
    return doOpen(new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId()), out, encryptor);
}
项目:gwt-crypto    文件:CMSAuthenticatedDataStreamGenerator.java   
/**
 * generate an authenticated data structure with the encapsulated bytes marked as DATA.
 *
 * @param out the stream to store the authenticated structure in.
 * @param macCalculator calculator for the MAC to be attached to the data.
 */
public OutputStream open(
    OutputStream    out,
    MacCalculator   macCalculator)
    throws CMSException
{
    return open(CMSObjectIdentifiers.data, out, macCalculator);
}
项目:gwt-crypto    文件:CMSAuthenticatedDataStreamGenerator.java   
public OutputStream open(
    OutputStream    out,
    MacCalculator   macCalculator,
    DigestCalculator digestCalculator)
    throws CMSException
{
    return open(CMSObjectIdentifiers.data, out, macCalculator, digestCalculator);
}
项目:gwt-crypto    文件:CMSCompressedDataStreamGenerator.java   
/**
 * Open a compressing output stream.
 *
 * @param contentOID the content type OID.
 * @param out the stream to encode to.
 * @param compressor the type of compressor to use.
 * @return an output stream to write the data be compressed to.
 * @throws IOException
 */
public OutputStream open(
    ASN1ObjectIdentifier contentOID,
    OutputStream out,
    OutputCompressor compressor)
    throws IOException
{
    BERSequenceGenerator sGen = new BERSequenceGenerator(out);

    sGen.addObject(CMSObjectIdentifiers.compressedData);

    //
    // Compressed Data
    //
    BERSequenceGenerator cGen = new BERSequenceGenerator(sGen.getRawOutputStream(), 0, true);

    cGen.addObject(new ASN1Integer(0));

    //
    // AlgorithmIdentifier
    //
    cGen.addObject(compressor.getAlgorithmIdentifier());

    //
    // Encapsulated ContentInfo
    //
    BERSequenceGenerator eiGen = new BERSequenceGenerator(cGen.getRawOutputStream());

    eiGen.addObject(contentOID);

    OutputStream octetStream = CMSUtils.createBEROctetOutputStream(
        eiGen.getRawOutputStream(), 0, true, _bufferSize);

    return new CmsCompressedOutputStream(
        compressor.getOutputStream(octetStream), sGen, cGen, eiGen);
}
项目:gwt-crypto    文件:CMSTimeStampedData.java   
private void initialize(ContentInfo contentInfo)
{
    this.contentInfo = contentInfo;

    if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType()))
    {
        this.timeStampedData = TimeStampedData.getInstance(contentInfo.getContent());
    }
    else
    {
        throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId());
    }

    util = new TimeStampDataUtil(this.timeStampedData);
}
项目:gwt-crypto    文件:CMSTimeStampedData.java   
/**
 * Return a new timeStampedData object with the additional token attached.
 *
 * @throws CMSException
 */
public CMSTimeStampedData addTimeStamp(TimeStampToken token)
    throws CMSException
{
    TimeStampAndCRL[] timeStamps = util.getTimeStamps();
    TimeStampAndCRL[] newTimeStamps = new TimeStampAndCRL[timeStamps.length + 1];

    System.arraycopy(timeStamps, 0, newTimeStamps, 0, timeStamps.length);

    newTimeStamps[timeStamps.length] = new TimeStampAndCRL(token.toCMSSignedData().toASN1Structure());

    return new CMSTimeStampedData(new ContentInfo(CMSObjectIdentifiers.timestampedData, new TimeStampedData(timeStampedData.getDataUri(), timeStampedData.getMetaData(), timeStampedData.getContent(), new Evidence(new TimeStampTokenEvidence(newTimeStamps)))));
}
项目:Aki-SSL    文件:CMSUtils.java   
private static void validateInfoFormat(OtherRevocationInfoFormat infoFormat)
{
    if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(infoFormat.getInfoFormat()))
    {
        OCSPResponse resp = OCSPResponse.getInstance(infoFormat.getInfo());

        if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
        {
            throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
        }
    }
}
项目:Aki-SSL    文件:CMSSignedDataStreamGenerator.java   
/**
 * generate a signed object that for a CMS Signed Data
 * object using the given provider - if encapsulate is true a copy
 * of the message will be included in the signature with the
 * default content type "data".
 */
public OutputStream open(
    OutputStream out,
    boolean      encapsulate)
    throws IOException
{
    return open(CMSObjectIdentifiers.data, out, encapsulate);
}
项目:Aki-SSL    文件:CMSEnvelopedDataStreamGenerator.java   
/**
 * generate an enveloped object that contains an CMS Enveloped Data
 * object using the given encryptor.
 */
public OutputStream open(
    OutputStream    out,
    OutputEncryptor encryptor)
    throws CMSException, IOException
{
    return doOpen(new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId()), out, encryptor);
}
项目:Aki-SSL    文件:CMSAuthenticatedDataStreamGenerator.java   
/**
 * generate an authenticated data structure with the encapsulated bytes marked as DATA.
 *
 * @param out the stream to store the authenticated structure in.
 * @param macCalculator calculator for the MAC to be attached to the data.
 */
public OutputStream open(
    OutputStream    out,
    MacCalculator   macCalculator)
    throws CMSException
{
    return open(CMSObjectIdentifiers.data, out, macCalculator);
}