Java 类org.bouncycastle.asn1.ASN1OutputStream 实例源码

项目:keepass2android    文件:PKCS12BagAttributeCarrierImpl.java   
public void writeObject(ObjectOutputStream out)
    throws IOException
{
    if (pkcs12Ordering.size() == 0)
    {
        out.writeObject(new Hashtable());
        out.writeObject(new Vector());
    }
    else
    {
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        ASN1OutputStream aOut = new ASN1OutputStream(bOut);

        Enumeration             e = this.getBagAttributeKeys();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier    oid = (DERObjectIdentifier)e.nextElement();

            aOut.writeObject(oid);
            aOut.writeObject(pkcs12Attributes.get(oid));
        }

        out.writeObject(bOut.toByteArray());
    }
}
项目:ipack    文件:X509CertificateObject.java   
public X500Principal getIssuerX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getIssuer());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:ipack    文件:X509CertificateObject.java   
public X500Principal getSubjectX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getSubject());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:ipack    文件:X509CertificateObject.java   
public X500Principal getIssuerX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getIssuer());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:ipack    文件:X509CertificateObject.java   
public X500Principal getSubjectX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getSubject());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:ipack    文件:PKCS12BagAttributeCarrierImpl.java   
public void writeObject(ObjectOutputStream out)
    throws IOException
{
    if (pkcs12Ordering.size() == 0)
    {
        out.writeObject(new Hashtable());
        out.writeObject(new Vector());
    }
    else
    {
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        ASN1OutputStream aOut = new ASN1OutputStream(bOut);

        Enumeration             e = this.getBagAttributeKeys();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier    oid = (DERObjectIdentifier)e.nextElement();

            aOut.writeObject(oid);
            aOut.writeObject((ASN1Encodable)pkcs12Attributes.get(oid));
        }

        out.writeObject(bOut.toByteArray());
    }
}
项目:KeePass2Android    文件:PKCS12BagAttributeCarrierImpl.java   
public void writeObject(ObjectOutputStream out)
    throws IOException
{
    if (pkcs12Ordering.size() == 0)
    {
        out.writeObject(new Hashtable());
        out.writeObject(new Vector());
    }
    else
    {
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        ASN1OutputStream aOut = new ASN1OutputStream(bOut);

        Enumeration             e = this.getBagAttributeKeys();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier    oid = (DERObjectIdentifier)e.nextElement();

            aOut.writeObject(oid);
            aOut.writeObject(pkcs12Attributes.get(oid));
        }

        out.writeObject(bOut.toByteArray());
    }
}
项目:itext2    文件:PdfPKCS7.java   
/**
 * Gets the bytes for the PKCS#1 object.
 * @return a byte array
 */
public byte[] getEncodedPKCS1() {
    try {
        if (externalDigest != null)
            digest = externalDigest;
        else
            digest = sig.sign();
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();

        ASN1OutputStream dout = new ASN1OutputStream(bOut);
        dout.writeObject(new DEROctetString(digest));
        dout.close();

        return bOut.toByteArray();
    }
    catch (Exception e) {
        throw new ExceptionConverter(e);
    }
}
项目:Direct-File-Downloader    文件:X509CRLObject.java   
public X500Principal getIssuerX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getIssuer());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:gwt-crypto    文件:OIDTest.java   
private void validOidCheck(
    String  oid)
    throws IOException
{
    ASN1ObjectIdentifier     o = new ASN1ObjectIdentifier(oid);
    ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
    ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

    aOut.writeObject(o);

    ByteArrayInputStream    bIn = new ByteArrayInputStream(bOut.toByteArray());
    ASN1InputStream         aIn = new ASN1InputStream(bIn);

    o = (ASN1ObjectIdentifier)aIn.readObject();

    if (!o.getId().equals(oid))
    {
        fail("failed oid check for " + oid);
    }
}
项目:cryptonit-applet    文件:PivTest.java   
private static TBSCertificate createTBS(ByteArrayOutputStream bOut, SubjectPublicKeyInfo ski, AlgorithmIdentifier algo) throws IOException {
    TBSCertificate tbs = null;

    V1TBSCertificateGenerator tbsGen = new V1TBSCertificateGenerator();
    tbsGen.setSerialNumber(new ASN1Integer(0x1));
    tbsGen.setStartDate(new Time(new Date(100, 01, 01, 00, 00, 00)));
    tbsGen.setEndDate(new Time(new Date(130, 12, 31, 23, 59, 59)));
    tbsGen.setIssuer(new X500Name("CN=Cryptonit"));
    tbsGen.setSubject(new X500Name("CN=Cryptonit"));
    tbsGen.setSignature(algo);
    tbsGen.setSubjectPublicKeyInfo(ski);
    tbs = tbsGen.generateTBSCertificate();

    ASN1OutputStream aOut = new ASN1OutputStream(bOut);
    aOut.writeObject(tbs);
    System.out.println("Build TBS");
    System.out.println(toHex(bOut.toByteArray()));
    Base64.encode(bOut.toByteArray(), System.out);
    System.out.println();

    return tbs;
}
项目:Aki-SSL    文件:X509CertificateObject.java   
public X500Principal getIssuerX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getIssuer());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:Aki-SSL    文件:X509CertificateObject.java   
public X500Principal getSubjectX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getSubject());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:Aki-SSL    文件:X509CertificateObject.java   
public X500Principal getIssuerX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getIssuer());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:Aki-SSL    文件:X509CertificateObject.java   
public X500Principal getSubjectX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getSubject());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:Aki-SSL    文件:PKCS12BagAttributeCarrierImpl.java   
public void writeObject(ObjectOutputStream out)
    throws IOException
{
    if (pkcs12Ordering.size() == 0)
    {
        out.writeObject(new Hashtable());
        out.writeObject(new Vector());
    }
    else
    {
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        ASN1OutputStream aOut = new ASN1OutputStream(bOut);

        Enumeration             e = this.getBagAttributeKeys();

        while (e.hasMoreElements())
        {
            ASN1ObjectIdentifier    oid = (ASN1ObjectIdentifier)e.nextElement();

            aOut.writeObject(oid);
            aOut.writeObject((ASN1Encodable)pkcs12Attributes.get(oid));
        }

        out.writeObject(bOut.toByteArray());
    }
}
项目:AcademicTorrents-Downloader    文件:X509CRLObject.java   
public X500Principal getIssuerX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getIssuer());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:CryptMeme    文件:X509CertificateObject.java   
public X500Principal getIssuerX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getIssuer());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:CryptMeme    文件:X509CertificateObject.java   
public X500Principal getSubjectX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getSubject());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:CryptMeme    文件:X509CertificateObject.java   
public X500Principal getIssuerX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getIssuer());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:CryptMeme    文件:X509CertificateObject.java   
public X500Principal getSubjectX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getSubject());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:CryptMeme    文件:PKCS12BagAttributeCarrierImpl.java   
public void writeObject(ObjectOutputStream out)
    throws IOException
{
    if (pkcs12Ordering.size() == 0)
    {
        out.writeObject(new Hashtable());
        out.writeObject(new Vector());
    }
    else
    {
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        ASN1OutputStream aOut = new ASN1OutputStream(bOut);

        Enumeration             e = this.getBagAttributeKeys();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier    oid = (DERObjectIdentifier)e.nextElement();

            aOut.writeObject(oid);
            aOut.writeObject((ASN1Encodable)pkcs12Attributes.get(oid));
        }

        out.writeObject(bOut.toByteArray());
    }
}
项目:irma_future_id    文件:OIDTest.java   
private void validOidCheck(
    String  oid)
    throws IOException
{
    DERObjectIdentifier     o = new DERObjectIdentifier(oid);
    ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
    ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

    aOut.writeObject(o);

    ByteArrayInputStream    bIn = new ByteArrayInputStream(bOut.toByteArray());
    ASN1InputStream         aIn = new ASN1InputStream(bIn);

    o = (DERObjectIdentifier)aIn.readObject();

    if (!o.getId().equals(oid))
    {
        fail("failed oid check for " + oid);
    }
}
项目:irma_future_id    文件:X509CertificateObject.java   
public X500Principal getIssuerX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getIssuer());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:irma_future_id    文件:X509CertificateObject.java   
public X500Principal getSubjectX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getSubject());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:irma_future_id    文件:X509CertificateObject.java   
public X500Principal getIssuerX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getIssuer());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:irma_future_id    文件:X509CertificateObject.java   
public X500Principal getSubjectX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getSubject());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:irma_future_id    文件:PKCS12BagAttributeCarrierImpl.java   
public void writeObject(ObjectOutputStream out)
    throws IOException
{
    if (pkcs12Ordering.size() == 0)
    {
        out.writeObject(new Hashtable());
        out.writeObject(new Vector());
    }
    else
    {
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        ASN1OutputStream aOut = new ASN1OutputStream(bOut);

        Enumeration             e = this.getBagAttributeKeys();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier    oid = (DERObjectIdentifier)e.nextElement();

            aOut.writeObject(oid);
            aOut.writeObject((ASN1Encodable)pkcs12Attributes.get(oid));
        }

        out.writeObject(bOut.toByteArray());
    }
}
项目:bc-java    文件:OIDTest.java   
private void validOidCheck(
    String  oid)
    throws IOException
{
    DERObjectIdentifier     o = new DERObjectIdentifier(oid);
    ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
    ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

    aOut.writeObject(o);

    ByteArrayInputStream    bIn = new ByteArrayInputStream(bOut.toByteArray());
    ASN1InputStream         aIn = new ASN1InputStream(bIn);

    o = (DERObjectIdentifier)aIn.readObject();

    if (!o.getId().equals(oid))
    {
        fail("failed oid check for " + oid);
    }
}
项目:bc-java    文件:X509CertificateObject.java   
public X500Principal getIssuerX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getIssuer());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:bc-java    文件:X509CertificateObject.java   
public X500Principal getSubjectX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getSubject());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:bc-java    文件:X509CertificateObject.java   
public X500Principal getIssuerX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getIssuer());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:bc-java    文件:X509CertificateObject.java   
public X500Principal getSubjectX500Principal()
{
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

        aOut.writeObject(c.getSubject());

        return new X500Principal(bOut.toByteArray());
    }
    catch (IOException e)
    {
        throw new IllegalStateException("can't encode issuer DN");
    }
}
项目:bc-java    文件:PKCS12BagAttributeCarrierImpl.java   
public void writeObject(ObjectOutputStream out)
    throws IOException
{
    if (pkcs12Ordering.size() == 0)
    {
        out.writeObject(new Hashtable());
        out.writeObject(new Vector());
    }
    else
    {
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        ASN1OutputStream aOut = new ASN1OutputStream(bOut);

        Enumeration             e = this.getBagAttributeKeys();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier    oid = (DERObjectIdentifier)e.nextElement();

            aOut.writeObject(oid);
            aOut.writeObject((ASN1Encodable)pkcs12Attributes.get(oid));
        }

        out.writeObject(bOut.toByteArray());
    }
}
项目:ipack    文件:OCSPReq.java   
/**
 * return the ASN.1 encoded representation of this object.
 */
public byte[] getEncoded()
    throws IOException
{
    ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
    ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

    aOut.writeObject(req);

    return bOut.toByteArray();
}
项目:ipack    文件:CertPathValidatorUtilities.java   
protected static final Set getQualifierSet(ASN1Sequence qualifiers)
    throws CertPathValidatorException
{
    Set pq = new HashSet();

    if (qualifiers == null)
    {
        return pq;
    }

    ByteArrayOutputStream bOut = new ByteArrayOutputStream();
    ASN1OutputStream aOut = new ASN1OutputStream(bOut);

    Enumeration e = qualifiers.getObjects();

    while (e.hasMoreElements())
    {
        try
        {
            aOut.writeObject((ASN1Encodable)e.nextElement());

            pq.add(new PolicyQualifierInfo(bOut.toByteArray()));
        }
        catch (IOException ex)
        {
            throw new ExtCertPathValidatorException("Policy qualifier info cannot be decoded.", ex);
        }

        bOut.reset();
    }

    return pq;
}
项目:ipack    文件:OCSPReq.java   
/**
 * return the ASN.1 encoded representation of this object.
 */
public byte[] getEncoded()
    throws IOException
{
    ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
    ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

    aOut.writeObject(req);

    return bOut.toByteArray();
}
项目:gwt-crypto    文件:OCSPReq.java   
/**
 * return the ASN.1 encoded representation of this object.
 */
public byte[] getEncoded()
    throws IOException
{
    ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
    ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

    aOut.writeObject(req);

    return bOut.toByteArray();
}
项目:Aki-SSL    文件:CertPathValidatorUtilities.java   
protected static final Set getQualifierSet(ASN1Sequence qualifiers)
    throws CertPathValidatorException
{
    Set pq = new HashSet();

    if (qualifiers == null)
    {
        return pq;
    }

    ByteArrayOutputStream bOut = new ByteArrayOutputStream();
    ASN1OutputStream aOut = new ASN1OutputStream(bOut);

    Enumeration e = qualifiers.getObjects();

    while (e.hasMoreElements())
    {
        try
        {
            aOut.writeObject((ASN1Encodable)e.nextElement());

            pq.add(new PolicyQualifierInfo(bOut.toByteArray()));
        }
        catch (IOException ex)
        {
            throw new ExtCertPathValidatorException("Policy qualifier info cannot be decoded.", ex);
        }

        bOut.reset();
    }

    return pq;
}
项目:Aki-SSL    文件:OCSPReq.java   
/**
 * return the ASN.1 encoded representation of this object.
 */
public byte[] getEncoded()
    throws IOException
{
    ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
    ASN1OutputStream        aOut = new ASN1OutputStream(bOut);

    aOut.writeObject(req);

    return bOut.toByteArray();
}