Package org.apache.geronimo.util.asn1

Examples of org.apache.geronimo.util.asn1.ASN1InputStream.readObject()


     * This method returns a X509Name object corresponding to the subject in a given certificate
     * @param cert Certificate from which subject needs to be retrieved
     */
    public static X509Name getSubjectX509Name(Certificate cert) throws CertificateEncodingException, IOException {
        ASN1InputStream ais = new ASN1InputStream(cert.getEncoded());
        X509CertificateStructure x509Struct = new X509CertificateStructure((ASN1Sequence)ais.readObject());
        ais.close();
        return x509Struct.getSubject();
    }

    /**
 
View Full Code Here


    /**
     * This method returns a X509Name object corresponding to a given principal
     */
    public static X509Name getX509Name(X500Principal principal) throws CertificateEncodingException, IOException {
        ASN1InputStream ais = new ASN1InputStream(principal.getEncoded());
        X509Name name = new X509Name((ASN1Sequence)ais.readObject());
        ais.close();
        return name;
    }

    /**
 
View Full Code Here

     */
    public static Map processSPKAC(String spkac) throws IOException, NoSuchAlgorithmException, InvalidKeyException, SignatureException, Exception {
        Map map = new HashMap();
        byte[]data = Base64.decode(spkac);
        ASN1InputStream ais = new ASN1InputStream(new ByteArrayInputStream(data));
        DERSequence spkacSeq = (DERSequence)ais.readObject();

        // SPKAC = SEQ {PKAC, SIGN-ALG, SIGN}
        // Get PKAC and obtain PK and C
        DERSequence pkacSeq = (DERSequence)spkacSeq.getObjectAt(0);
        DERObject pk = (DERObject)pkacSeq.getObjectAt(0);
View Full Code Here

        try
        {
            ByteArrayInputStream    bIn = new ByteArrayInputStream(bytes);
            ASN1InputStream         dIn = new ASN1InputStream(bIn);

            return (ASN1Sequence)dIn.readObject();
        }
        catch (Exception e)
        {
            throw new IllegalArgumentException("badly encoded request");
        }
View Full Code Here

        ByteArrayInputStream    bIn = new ByteArrayInputStream(bytes);
        ASN1InputStream         dIn = new ASN1InputStream(bIn);

        try
        {
            this.reqInfo = new CertificationRequestInfo(subject, new SubjectPublicKeyInfo((ASN1Sequence)dIn.readObject()), attributes);
        }
        catch (IOException e)
        {
            throw new IllegalArgumentException("can't encode public key");
        }
View Full Code Here

        }

        ASN1InputStream aIn = new ASN1InputStream(
                                            new ByteArrayInputStream(data));

        return aIn.readObject();
    }

    /**
     * return true if the passed in String can be represented without
     * loss as a PrintableString, false otherwise.
View Full Code Here

        try
        {
            ByteArrayInputStream    bIn = new ByteArrayInputStream(((ASN1OctetString)e.nextElement()).getOctets());
            ASN1InputStream         aIn = new ASN1InputStream(bIn);

            privKey = aIn.readObject();
        }
        catch (IOException ex)
        {
            throw new IllegalArgumentException("Error recoverying private key from sequence");
        }
View Full Code Here

    {
        FileInputStream fIn = new FileInputStream(args[0]);
        ASN1InputStream bIn = new ASN1InputStream(fIn);
        Object          obj = null;

        while ((obj = bIn.readObject()) != null)
        {
            System.out.println(ASN1Dump.dumpAsString(obj));
        }
    }
}
View Full Code Here

            ByteArrayInputStream    bIn = new ByteArrayInputStream((byte[])obj);
            ASN1InputStream         aIn = new ASN1InputStream(bIn);

            DERObjectIdentifier    oid;

            while ((oid = (DERObjectIdentifier)aIn.readObject()) != null)
            {
                this.setBagAttribute(oid, aIn.readObject());
            }
        }
View Full Code Here

            DERObjectIdentifier    oid;

            while ((oid = (DERObjectIdentifier)aIn.readObject()) != null)
            {
                this.setBagAttribute(oid, aIn.readObject());
            }
        }

        this.privateExponent = (BigInteger)in.readObject();
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.