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

项目:ipack    文件:DVCSTime.java   
public static DVCSTime getInstance(Object obj)
{
    if (obj instanceof DVCSTime)
    {
        return (DVCSTime)obj;
    }
    else if (obj instanceof ASN1GeneralizedTime)
    {
        return new DVCSTime(ASN1GeneralizedTime.getInstance(obj));
    }
    else if (obj != null)
    {
        return new DVCSTime(ContentInfo.getInstance(obj));
    }

    return null;
}
项目:ipack    文件:CMSSignedData.java   
public CMSSignedData(
    ContentInfo sigData)
    throws CMSException
{
    this.contentInfo = sigData;
    this.signedData = getSignedData();

    //
    // this can happen if the signed message is sent simply to send a
    // certificate chain.
    //
    if (signedData.getEncapContentInfo().getContent() != null)
    {
        this.signedContent = new CMSProcessableByteArray(signedData.getEncapContentInfo().getContentType(),
                ((ASN1OctetString)(signedData.getEncapContentInfo()
                                            .getContent())).getOctets());
    }
    else
    {
        this.signedContent = null;
    }
}
项目:ipack    文件:CMSCompressedData.java   
/**
 * Return the uncompressed content.
 *
 * @return the uncompressed content
 * @throws CMSException if there is an exception uncompressing the data.
 * @deprecated use getContent(InputExpanderProvider)
 */
public byte[] getContent()
    throws CMSException
{
    ContentInfo     content = comData.getEncapContentInfo();

    ASN1OctetString bytes = (ASN1OctetString)content.getContent();

    InflaterInputStream     zIn = new InflaterInputStream(bytes.getOctetStream());

    try
    {
        return CMSUtils.streamToByteArray(zIn);
    }
    catch (IOException e)
    {
        throw new CMSException("exception reading compressed stream.", e);
    }
}
项目:ipack    文件:CMSCompressedData.java   
/**
 * Return the uncompressed content, throwing an exception if the data size
 * is greater than the passed in limit. If the content is exceeded getCause()
 * on the CMSException will contain a StreamOverflowException
 *
 * @param limit maximum number of bytes to read
 * @return the content read
 * @throws CMSException if there is an exception uncompressing the data.
 * @deprecated use getContent(InputExpanderProvider)
 */
public byte[] getContent(int limit)
    throws CMSException
{
    ContentInfo     content = comData.getEncapContentInfo();

    ASN1OctetString bytes = (ASN1OctetString)content.getContent();

    InflaterInputStream     zIn = new InflaterInputStream(bytes.getOctetStream());

    try
    {
        return CMSUtils.streamToByteArray(zIn, limit);
    }
    catch (IOException e)
    {
        throw new CMSException("exception reading compressed stream.", e);
    }
}
项目:ipack    文件:CMSCompressedData.java   
/**
 * Return the uncompressed content.
 *
 * @param expanderProvider a provider of expander algorithm implementations.
 * @return the uncompressed content
 * @throws CMSException if there is an exception un-compressing the data.
 */
public byte[] getContent(InputExpanderProvider expanderProvider)
    throws CMSException
{
    ContentInfo     content = comData.getEncapContentInfo();

    ASN1OctetString bytes = (ASN1OctetString)content.getContent();
    InputExpander   expander = expanderProvider.get(comData.getCompressionAlgorithmIdentifier());
    InputStream     zIn = expander.getInputStream(bytes.getOctetStream());

    try
    {
        return CMSUtils.streamToByteArray(zIn);
    }
    catch (IOException e)
    {
        throw new CMSException("exception reading compressed stream.", e);
    }
}
项目:gwt-crypto    文件:DVCSTime.java   
public static DVCSTime getInstance(Object obj)
{
    if (obj instanceof DVCSTime)
    {
        return (DVCSTime)obj;
    }
    else if (obj instanceof ASN1GeneralizedTime)
    {
        return new DVCSTime(ASN1GeneralizedTime.getInstance(obj));
    }
    else if (obj != null)
    {
        return new DVCSTime(ContentInfo.getInstance(obj));
    }

    return null;
}
项目:gwt-crypto    文件:CMSCompressedData.java   
/**
 * Return the uncompressed content.
 *
 * @param expanderProvider a provider of expander algorithm implementations.
 * @return the uncompressed content
 * @throws CMSException if there is an exception un-compressing the data.
 */
public byte[] getContent(InputExpanderProvider expanderProvider)
    throws CMSException
{
    ContentInfo     content = comData.getEncapContentInfo();

    ASN1OctetString bytes = (ASN1OctetString)content.getContent();
    InputExpander   expander = expanderProvider.get(comData.getCompressionAlgorithmIdentifier());
    InputStream     zIn = expander.getInputStream(bytes.getOctetStream());

    try
    {
        return CMSUtils.streamToByteArray(zIn);
    }
    catch (IOException e)
    {
        throw new CMSException("exception reading compressed stream.", e);
    }
}
项目:Aki-SSL    文件:DVCSTime.java   
public static DVCSTime getInstance(Object obj)
{
    if (obj instanceof DVCSTime)
    {
        return (DVCSTime)obj;
    }
    else if (obj instanceof ASN1GeneralizedTime)
    {
        return new DVCSTime(ASN1GeneralizedTime.getInstance(obj));
    }
    else if (obj != null)
    {
        return new DVCSTime(ContentInfo.getInstance(obj));
    }

    return null;
}
项目:Aki-SSL    文件:CMSCompressedData.java   
/**
 * Return the uncompressed content.
 *
 * @param expanderProvider a provider of expander algorithm implementations.
 * @return the uncompressed content
 * @throws CMSException if there is an exception un-compressing the data.
 */
public byte[] getContent(InputExpanderProvider expanderProvider)
    throws CMSException
{
    ContentInfo     content = comData.getEncapContentInfo();

    ASN1OctetString bytes = (ASN1OctetString)content.getContent();
    InputExpander   expander = expanderProvider.get(comData.getCompressionAlgorithmIdentifier());
    InputStream     zIn = expander.getInputStream(bytes.getOctetStream());

    try
    {
        return CMSUtils.streamToByteArray(zIn);
    }
    catch (IOException e)
    {
        throw new CMSException("exception reading compressed stream.", e);
    }
}
项目:animamea    文件:CardSecurityParser.java   
/**
 * @param args
 * @throws Exception 
 */
public static void main(String[] args) throws Exception {
    byte[] efcsBytes = readBinaryFile("/home/tsenger/Desktop/EFCardSecurity.bin");
    ASN1Sequence asnSeq = (ASN1Sequence) ASN1Sequence.fromByteArray(efcsBytes);
    ContentInfo contentInfo = ContentInfo.getInstance(asnSeq);
    System.out.println(contentInfo.getContentType());
    DERSequence derSeq = (DERSequence) contentInfo.getContent();
    System.out.println(HexString.bufferToHex(derSeq.getEncoded(null)));
    SignedData signedData = SignedData.getInstance(derSeq);
    System.out.println("CMSVersion: "+signedData.getVersion().getValue().intValue());
    ContentInfo contentInfo2 = signedData.getEncapContentInfo();
    System.out.println(contentInfo2.getContentType());
    DEROctetString octString = (DEROctetString) contentInfo2.getContent();
    System.out.println("OctetString:\n"+HexString.bufferToHex(octString.getEncoded(null)));
    System.out.println("OctetString:\n"+HexString.bufferToHex(octString.getOctets()));

    SecurityInfos si = new SecurityInfos();
    si.decode(octString.getOctets());
    System.out.println(si);

    byte[] parameter = si.getChipAuthenticationPublicKeyInfoList().get(0).getPublicKey().getPublicKey();
    System.out.println(HexString.bufferToHex(parameter));
    System.out.println("Key Referenz: "+si.getChipAuthenticationPublicKeyInfoList().get(0).getKeyId());
    System.out.println("id_CA OID: "+si.getChipAuthenticationPublicKeyInfoList().get(0).getPublicKey().getAlgorithm().getAlgorithm());

}
项目:animamea    文件:Operator.java   
private SecurityInfos decodeEFCardSecurity(byte[] data)
        throws IOException, CertificateException, CMSException, OperatorCreationException {

    ASN1Sequence asnSeq = (ASN1Sequence) ASN1Sequence.fromByteArray(data);
    ContentInfo contentInfo = ContentInfo.getInstance(asnSeq);
    DERSequence derSeq = (DERSequence) contentInfo.getContent();

    SignedData cardSecurity = SignedData.getInstance(derSeq);

    // Get SecurityInfos
    ContentInfo encapContentInfo = cardSecurity.getEncapContentInfo();
    DEROctetString octString = (DEROctetString) encapContentInfo.getContent();
    SecurityInfos si = new SecurityInfos();
    si.decode(octString.getOctets());

    return si;
}
项目:TinyTravelTracker    文件:DVCSTime.java   
public static DVCSTime getInstance(Object obj)
{
    if (obj instanceof DVCSTime)
    {
        return (DVCSTime)obj;
    }
    else if (obj instanceof ASN1GeneralizedTime)
    {
        return new DVCSTime(ASN1GeneralizedTime.getInstance(obj));
    }
    else if (obj != null)
    {
        return new DVCSTime(ContentInfo.getInstance(obj));
    }

    return null;
}
项目:CryptMeme    文件:DVCSTime.java   
public static DVCSTime getInstance(Object obj)
{
    if (obj instanceof DVCSTime)
    {
        return (DVCSTime)obj;
    }
    else if (obj instanceof ASN1GeneralizedTime)
    {
        return new DVCSTime(ASN1GeneralizedTime.getInstance(obj));
    }
    else if (obj != null)
    {
        return new DVCSTime(ContentInfo.getInstance(obj));
    }

    return null;
}
项目:xipki    文件:ScepImpl.java   
public ContentInfo servicePkiOperation(CMSSignedData requestContent,
        String certProfileName, String msgId, AuditEvent event)
        throws MessageDecodingException, OperationException {
    CaStatus status = status();

    if (CaStatus.ACTIVE != status) {
        LOG.warn("SCEP {} is not active", caIdent);
        throw new OperationException(ErrorCode.SYSTEM_UNAVAILABLE);
    }

    DecodedPkiMessage req = DecodedPkiMessage.decode(requestContent,
            envelopedDataDecryptor, null);

    PkiMessage rep = servicePkiOperation0(requestContent, req, certProfileName, msgId, event);
    audit(event, CaAuditConstants.NAME_SCEP_pkiStatus, rep.pkiStatus().toString());
    if (rep.pkiStatus() == PkiStatus.FAILURE) {
        event.setStatus(AuditStatus.FAILED);
    }
    if (rep.failInfo() != null) {
        audit(event, CaAuditConstants.NAME_SCEP_failInfo, rep.failInfo().toString());
    }
    return encodeResponse(rep, req);
}
项目:xipki    文件:ScepImpl.java   
private ContentInfo encodeResponse(PkiMessage response, DecodedPkiMessage request)
        throws OperationException {
    ParamUtil.requireNonNull("response", response);
    ParamUtil.requireNonNull("request", request);

    String signatureAlgorithm = getSignatureAlgorithm(responderKey,
            request.digestAlgorithm());
    ContentInfo ci;
    try {
        X509Certificate[] cmsCertSet = control.includeSignerCert()
                ? new X509Certificate[]{responderCert} : null;

        ci = response.encode(responderKey, signatureAlgorithm, responderCert, cmsCertSet,
                request.signatureCert(), request.contentEncryptionAlgorithm());
    } catch (MessageEncodingException ex) {
        LogUtil.error(LOG, ex, "could not encode response");
        throw new OperationException(ErrorCode.SYSTEM_FAILURE, ex);
    }
    return ci;
}
项目:irma_future_id    文件:CMSSignedData.java   
public CMSSignedData(
    ContentInfo sigData)
    throws CMSException
{
    this.contentInfo = sigData;
    this.signedData = getSignedData();

    //
    // this can happen if the signed message is sent simply to send a
    // certificate chain.
    //
    if (signedData.getEncapContentInfo().getContent() != null)
    {
        this.signedContent = new CMSProcessableByteArray(signedData.getEncapContentInfo().getContentType(),
                ((ASN1OctetString)(signedData.getEncapContentInfo()
                                            .getContent())).getOctets());
    }
    else
    {
        this.signedContent = null;
    }
}
项目:irma_future_id    文件:CMSSignedData.java   
public CMSSignedData(
    ContentInfo sigData)
    throws CMSException
{
    this.contentInfo = sigData;
    this.signedData = getSignedData();

    //
    // this can happen if the signed message is sent simply to send a
    // certificate chain.
    //
    if (signedData.getEncapContentInfo().getContent() != null)
    {
        this.signedContent = new CMSProcessableByteArray(signedData.getEncapContentInfo().getContentType(),
                ((ASN1OctetString)(signedData.getEncapContentInfo()
                                            .getContent())).getOctets());
    }
    else
    {
        this.signedContent = null;
    }
}
项目:irma_future_id    文件:CMSCompressedData.java   
/**
 * Return the uncompressed content.
 *
 * @return the uncompressed content
 * @throws CMSException if there is an exception uncompressing the data.
 * @deprecated use getContent(InputExpanderProvider)
 */
public byte[] getContent()
    throws CMSException
{
    ContentInfo     content = comData.getEncapContentInfo();

    ASN1OctetString bytes = (ASN1OctetString)content.getContent();

    InflaterInputStream     zIn = new InflaterInputStream(bytes.getOctetStream());

    try
    {
        return CMSUtils.streamToByteArray(zIn);
    }
    catch (IOException e)
    {
        throw new CMSException("exception reading compressed stream.", e);
    }
}
项目:irma_future_id    文件:CMSCompressedData.java   
/**
 * Return the uncompressed content, throwing an exception if the data size
 * is greater than the passed in limit. If the content is exceeded getCause()
 * on the CMSException will contain a StreamOverflowException
 *
 * @param limit maximum number of bytes to read
 * @return the content read
 * @throws CMSException if there is an exception uncompressing the data.
 * @deprecated use getContent(InputExpanderProvider)
 */
public byte[] getContent(int limit)
    throws CMSException
{
    ContentInfo     content = comData.getEncapContentInfo();

    ASN1OctetString bytes = (ASN1OctetString)content.getContent();

    InflaterInputStream     zIn = new InflaterInputStream(bytes.getOctetStream());

    try
    {
        return CMSUtils.streamToByteArray(zIn, limit);
    }
    catch (IOException e)
    {
        throw new CMSException("exception reading compressed stream.", e);
    }
}
项目:irma_future_id    文件:CMSCompressedData.java   
/**
 * Return the uncompressed content.
 *
 * @param expanderProvider a provider of expander algorithm implementations.
 * @return the uncompressed content
 * @throws CMSException if there is an exception un-compressing the data.
 */
public byte[] getContent(InputExpanderProvider expanderProvider)
    throws CMSException
{
    ContentInfo     content = comData.getEncapContentInfo();

    ASN1OctetString bytes = (ASN1OctetString)content.getContent();
    InputExpander   expander = expanderProvider.get(comData.getCompressionAlgorithmIdentifier());
    InputStream     zIn = expander.getInputStream(bytes.getOctetStream());

    try
    {
        return CMSUtils.streamToByteArray(zIn);
    }
    catch (IOException e)
    {
        throw new CMSException("exception reading compressed stream.", e);
    }
}
项目:bc-java    文件:CMSCompressedData.java   
/**
 * Return the uncompressed content.
 *
 * @return the uncompressed content
 * @throws CMSException if there is an exception uncompressing the data.
 * @deprecated use getContent(InputExpanderProvider)
 */
public byte[] getContent()
    throws CMSException
{
    ContentInfo     content = comData.getEncapContentInfo();

    ASN1OctetString bytes = (ASN1OctetString)content.getContent();

    InflaterInputStream     zIn = new InflaterInputStream(bytes.getOctetStream());

    try
    {
        return CMSUtils.streamToByteArray(zIn);
    }
    catch (IOException e)
    {
        throw new CMSException("exception reading compressed stream.", e);
    }
}
项目:irma_future_id    文件:CMSSignedData.java   
public CMSSignedData(
    ContentInfo sigData)
    throws CMSException
{
    this.contentInfo = sigData;
    this.signedData = getSignedData();

    //
    // this can happen if the signed message is sent simply to send a
    // certificate chain.
    //
    if (signedData.getEncapContentInfo().getContent() != null)
    {
        this.signedContent = new CMSProcessableByteArray(signedData.getEncapContentInfo().getContentType(),
                ((ASN1OctetString)(signedData.getEncapContentInfo()
                                            .getContent())).getOctets());
    }
    else
    {
        this.signedContent = null;
    }
}
项目:irma_future_id    文件:CMSSignedData.java   
public CMSSignedData(
    ContentInfo sigData)
    throws CMSException
{
    this.contentInfo = sigData;
    this.signedData = getSignedData();

    //
    // this can happen if the signed message is sent simply to send a
    // certificate chain.
    //
    if (signedData.getEncapContentInfo().getContent() != null)
    {
        this.signedContent = new CMSProcessableByteArray(signedData.getEncapContentInfo().getContentType(),
                ((ASN1OctetString)(signedData.getEncapContentInfo()
                                            .getContent())).getOctets());
    }
    else
    {
        this.signedContent = null;
    }
}
项目:irma_future_id    文件:DVCSTime.java   
public static DVCSTime getInstance(Object obj)
{
    if (obj instanceof DVCSTime)
    {
        return (DVCSTime)obj;
    }
    else if (obj instanceof ASN1GeneralizedTime)
    {
        return new DVCSTime(ASN1GeneralizedTime.getInstance(obj));
    }
    else if (obj != null)
    {
        return new DVCSTime(ContentInfo.getInstance(obj));
    }

    return null;
}
项目:bc-java    文件:CMSCompressedData.java   
/**
 * Return the uncompressed content, throwing an exception if the data size
 * is greater than the passed in limit. If the content is exceeded getCause()
 * on the CMSException will contain a StreamOverflowException
 *
 * @param limit maximum number of bytes to read
 * @return the content read
 * @throws CMSException if there is an exception uncompressing the data.
 * @deprecated use getContent(InputExpanderProvider)
 */
public byte[] getContent(int limit)
    throws CMSException
{
    ContentInfo     content = comData.getEncapContentInfo();

    ASN1OctetString bytes = (ASN1OctetString)content.getContent();

    InflaterInputStream     zIn = new InflaterInputStream(bytes.getOctetStream());

    try
    {
        return CMSUtils.streamToByteArray(zIn, limit);
    }
    catch (IOException e)
    {
        throw new CMSException("exception reading compressed stream.", e);
    }
}
项目:bc-java    文件:CMSSignedData.java   
public CMSSignedData(
    ContentInfo sigData)
    throws CMSException
{
    this.contentInfo = sigData;
    this.signedData = getSignedData();

    //
    // this can happen if the signed message is sent simply to send a
    // certificate chain.
    //
    if (signedData.getEncapContentInfo().getContent() != null)
    {
        this.signedContent = new CMSProcessableByteArray(signedData.getEncapContentInfo().getContentType(),
                ((ASN1OctetString)(signedData.getEncapContentInfo()
                                            .getContent())).getOctets());
    }
    else
    {
        this.signedContent = null;
    }
}
项目:ipack    文件:TimeStampResp.java   
private TimeStampResp(ASN1Sequence seq)
{

    Enumeration e = seq.getObjects();

    // status
    pkiStatusInfo = PKIStatusInfo.getInstance(e.nextElement());

    if (e.hasMoreElements())
    {
        timeStampToken = ContentInfo.getInstance(e.nextElement());
    }
}
项目:ipack    文件:CertEtcToken.java   
private CertEtcToken(ASN1TaggedObject choice)
{
    this.tagNo = choice.getTagNo();

    switch (tagNo)
    {
    case TAG_CERTIFICATE:
        value = Certificate.getInstance(choice, false);
        break;
    case TAG_ESSCERTID:
        value = ESSCertID.getInstance(choice.getObject());
        break;
    case TAG_PKISTATUS:
        value = PKIStatusInfo.getInstance(choice, false);
        break;
    case TAG_ASSERTION:
        value = ContentInfo.getInstance(choice.getObject());
        break;
    case TAG_CRL:
        value = CertificateList.getInstance(choice, false);
        break;
    case TAG_OCSPCERTSTATUS:
        value = CertStatus.getInstance(choice.getObject());
        break;
    case TAG_OCSPCERTID:
        value = CertID.getInstance(choice, false);
        break;
    case TAG_OCSPRESPONSE:
        value = OCSPResponse.getInstance(choice, false);
        break;
    case TAG_CAPABILITIES:
        value = SMIMECapabilities.getInstance(choice.getObject());
        break;
    default:
        throw new IllegalArgumentException("Unknown tag: " + tagNo);
    }
}
项目:ipack    文件:CMSDigestedData.java   
/**
 * Return the digested content
 *
 * @return the digested content
 * @throws CMSException if there is an exception un-compressing the data.
 */
public CMSProcessable getDigestedContent()
    throws CMSException
{
    ContentInfo     content = digestedData.getEncapContentInfo();

    try
    {
        return new CMSProcessableByteArray(content.getContentType(), ((ASN1OctetString)content.getContent()).getOctets());
    }
    catch (Exception e)
    {
        throw new CMSException("exception reading digested stream.", e);
    }
}
项目:ipack    文件:CMSSignedData.java   
public CMSSignedData(
    final CMSProcessable  signedContent,
    ContentInfo     sigData)
    throws CMSException
{
    if (signedContent instanceof CMSTypedData)
    {
        this.signedContent = (CMSTypedData)signedContent;
    }
    else
    {
        this.signedContent = new CMSTypedData()
        {
            public ASN1ObjectIdentifier getContentType()
            {
                return signedData.getEncapContentInfo().getContentType();
            }

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

            public Object getContent()
            {
                return signedContent.getContent();
            }
        };
    }

    this.contentInfo = sigData;
    this.signedData = getSignedData();
}
项目:ipack    文件:CMSSignedData.java   
public CMSSignedData(
    Map             hashes,
    ContentInfo     sigData)
    throws CMSException
{
    this.hashes = hashes;
    this.contentInfo = sigData;
    this.signedData = getSignedData();
}
项目:ipack    文件:CMSUtils.java   
static ContentInfo readContentInfo(
    byte[] input)
    throws CMSException
{
    // enforce limit checking as from a byte array
    return readContentInfo(new ASN1InputStream(input));
}
项目:ipack    文件:CMSUtils.java   
static ContentInfo readContentInfo(
    InputStream input)
    throws CMSException
{
    // enforce some limit checking
    return readContentInfo(new ASN1InputStream(input));
}
项目: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)))));
}
项目:ipack    文件:TimeStampToken.java   
private static CMSSignedData getSignedData(ContentInfo contentInfo)
    throws TSPException
{
    try
    {
        return new CMSSignedData(contentInfo);
    }
    catch (CMSException e)
    {
        throw new TSPException("TSP parsing error: " + e.getMessage(), e.getCause());
    }
}
项目:ipack    文件:PEMParser.java   
/**
 * Reads in a PKCS7 object. This returns a ContentInfo object suitable for use with the CMS
 * API.
 *
 * @return the X509Certificate
 * @throws java.io.IOException if an I/O error occured
 */
public Object parseObject(PemObject obj)
    throws IOException
{
    try
    {
        ASN1InputStream aIn = new ASN1InputStream(obj.getContent());

        return ContentInfo.getInstance(aIn.readObject());
    }
    catch (Exception e)
    {
        throw new PEMException("problem parsing PKCS7 object: " + e.toString(), e);
    }
}
项目:ipack    文件:PEMReader.java   
/**
 * Reads in a PKCS7 object. This returns a ContentInfo object suitable for use with the CMS
 * API.
 *
 * @return the X509Certificate
 * @throws IOException if an I/O error occured
 */
public Object parseObject(PemObject obj)
    throws IOException
{
    try
    {
        ASN1InputStream aIn = new ASN1InputStream(obj.getContent());

        return ContentInfo.getInstance(aIn.readObject());
    }
    catch (Exception e)
    {
        throw new PEMException("problem parsing PKCS7 object: " + e.toString(), e);
    }
}
项目:ipack    文件:DVCSRequestBuilder.java   
protected DVCSRequest createDVCRequest(Data data)
    throws DVCSException
{
    if (!extGenerator.isEmpty())
    {
        requestInformationBuilder.setExtensions(extGenerator.generate());
    }

    org.bouncycastle.asn1.dvcs.DVCSRequest request = new org.bouncycastle.asn1.dvcs.DVCSRequest(requestInformationBuilder.build(), data);

    return new DVCSRequest(new ContentInfo(DVCSObjectIdentifiers.id_ct_DVCSRequestData, request));
}
项目:ipack    文件:DVCSResponse.java   
/**
 * Construct a DVCS Request from a ContentInfo
 *
 * @param contentInfo the contentInfo representing the DVCSRequest
 * @throws org.bouncycastle.dvcs.DVCSConstructionException
 */
public DVCSResponse(ContentInfo contentInfo)
    throws DVCSConstructionException
{
    super(contentInfo);

    if (!DVCSObjectIdentifiers.id_ct_DVCSResponseData.equals(contentInfo.getContentType()))
    {
        throw new DVCSConstructionException("ContentInfo not a DVCS Request");
    }

    try
    {
        if (contentInfo.getContent().toASN1Primitive() instanceof ASN1Sequence)
        {
            this.asn1 = org.bouncycastle.asn1.dvcs.DVCSResponse.getInstance(contentInfo.getContent());
        }
        else
        {
            this.asn1 = org.bouncycastle.asn1.dvcs.DVCSResponse.getInstance(ASN1OctetString.getInstance(contentInfo.getContent()).getOctets());
        }
    }
    catch (Exception e)
    {
        throw new DVCSConstructionException("Unable to parse content: " + e.getMessage(), e);
    }
}