Package jcifs.spnego.asn1

Examples of jcifs.spnego.asn1.DEROutputStream


    private byte[] derEncode(
        byte[]  hash)
        throws IOException
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        DEROutputStream         dOut = new DEROutputStream(bOut);
        DigestInfo              dInfo = new DigestInfo(algId, hash);

        dOut.writeObject(dInfo);

        return bOut.toByteArray();
    }
View Full Code Here


     * @return a PKCS8 representation of the key.
     */
    public byte[] getEncoded()
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        DEROutputStream         dOut = new DEROutputStream(bOut);
        X962Parameters          params = null;

        if (ecSpec instanceof ECNamedCurveParameterSpec)
        {
            params = new X962Parameters(X962NamedCurves.getOID(((ECNamedCurveParameterSpec)ecSpec).getName()));
        }
        else
        {
            X9ECParameters          ecP = new X9ECParameters(
                                            ecSpec.getCurve(),
                                            ecSpec.getG(),
                                            ecSpec.getN(),
                                            ecSpec.getH(),
                                            ecSpec.getSeed());
            params = new X962Parameters(ecP);
        }

        PrivateKeyInfo          info = new PrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, params.getDERObject()), new ECPrivateKeyStructure(this.getD()).getDERObject());

        try
        {
            dOut.writeObject(info);
            dOut.close();
        }
        catch (IOException e)
        {
            throw new RuntimeException("Error encoding EC private key");
        }
View Full Code Here

      X509Extension   ext = exts.getExtension(new DERObjectIdentifier(oid));

      if (ext != null)
      {
                ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
                DEROutputStream dOut = new DEROutputStream(bOut);

                try
                {
                    dOut.writeObject(ext.getValue());

                    return bOut.toByteArray();
                }
                catch (Exception e)
                {
View Full Code Here

    public byte[] getEncoded()
        throws CRLException
  {
    ByteArrayOutputStream  bOut = new ByteArrayOutputStream();
    DEROutputStream      dOut = new DEROutputStream(bOut);

    try
    {
      dOut.writeObject(c);

      return bOut.toByteArray();
    }
    catch (IOException e)
    {
View Full Code Here

 
    public byte[] getTBSCertList()
    throws CRLException
  {
    ByteArrayOutputStream  bOut = new ByteArrayOutputStream();
    DEROutputStream      dOut = new DEROutputStream(bOut);

    try
    {
      dOut.writeObject(c.getTBSCertList());

      return bOut.toByteArray();
    }
    catch (IOException e)
    {
View Full Code Here

    if ( c.getSignatureAlgorithm().getParameters() != null )
    {
      try
      {
        DEROutputStream  dOut = new DEROutputStream(bOut);

        dOut.writeObject(c.getSignatureAlgorithm().getParameters());
      }
      catch (Exception e)
      {
        throw new RuntimeException("exception getting sig parameters " + e);
      }
View Full Code Here

    public byte[] getEncoded()
    throws CRLException
  {
    ByteArrayOutputStream  bOut = new ByteArrayOutputStream();
    DEROutputStream      dOut = new DEROutputStream(bOut);

    try
    {
      dOut.writeObject(c);

      return bOut.toByteArray();
    }
    catch (IOException e)
    {
View Full Code Here

    }

    public byte[] getEncoded()
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        DEROutputStream         dOut = new DEROutputStream(bOut);
        SubjectPublicKeyInfo    info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, new DERNull()), new RSAPublicKeyStructure(getModulus(), getPublicExponent()).getDERObject());

        try
        {
            dOut.writeObject(info);
            dOut.close();
        }
        catch (IOException e)
        {
            throw new RuntimeException("Error encoding RSA public key");
        }
View Full Code Here

            extensions = new Hashtable();
            extOrdering = new Vector();
        }

        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        DEROutputStream         dOut = new DEROutputStream(bOut);

        try
        {
            dOut.writeObject(value);
        }
        catch (IOException e)
        {
            throw new IllegalArgumentException("error encoding value: " + e);
        }
View Full Code Here

        TBSCertList tbsCrl = tbsGen.generateTBSCertList();

        try
        {
            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
            DEROutputStream         dOut = new DEROutputStream(bOut);

            dOut.writeObject(tbsCrl);

            sig.update(bOut.toByteArray());
        }
        catch (Exception e)
        {
View Full Code Here

TOP

Related Classes of jcifs.spnego.asn1.DEROutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.