Package org.apache.geronimo.crypto.asn1

Examples of org.apache.geronimo.crypto.asn1.DERInputStream.readObject()


        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", e);
        }
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

            algId = new AlgorithmIdentifier(PKCSObjectIdentifiers.sha1WithRSAEncryption);
        else
            throw new CertificationAuthorityException("Signature algorithm "+algorithm+" is not supported.");
       
        ASN1InputStream ais = new ASN1InputStream(subPubKey.getEncoded());
        DERObject subPubkeyDerObj = ais.readObject();
        SubjectPublicKeyInfo subPubKeyInfo = SubjectPublicKeyInfo.getInstance(subPubkeyDerObj);
       
        // Create certificate generator and initialize fields
        // Certificate version is v3
        V3TBSCertificateGenerator v3certGen = new V3TBSCertificateGenerator();
View Full Code Here

        throws IOException
    {
        ByteArrayInputStream    bIn = new ByteArrayInputStream(keyData.getBytes());
        ASN1InputStream         aIn = new ASN1InputStream(bIn);

        return aIn.readObject();
    }

    /**
     * for when the public key is raw bits...
     */
 
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

    private String generateCSR(X509Certificate cert, PrivateKey signingKey) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchProviderException, SignatureException, KeyStoreException, IOException {
        String sigalg = cert.getSigAlgName();
        X509Name subject;
        try{
            ASN1InputStream ais = new ASN1InputStream(cert.getEncoded());
            X509CertificateStructure x509Struct = new X509CertificateStructure((ASN1Sequence)ais.readObject());
            ais.close();
            subject = x509Struct.getSubject();
        } catch(CertificateEncodingException e) {
            log.warn(e.toString()+" while retrieving subject from certificate to create CSR.  Using subjectDN instead.");
            subject = new X509Name(cert.getSubjectDN().toString());
View Full Code Here

    public static DERObjectIdentifier decodeOIDDERObjectIdentifier(byte[] oid) throws IOException {
        ByteArrayInputStream bIn = new ByteArrayInputStream(oid);
        DERInputStream dIn = new DERInputStream(bIn);

        return (DERObjectIdentifier) dIn.readObject();
    }

    public static byte[] encodeGeneralName(String name) throws IOException {
        return encodeGeneralName(new X509Name(name));
    }
View Full Code Here

    public static DERObjectIdentifier decodeOIDDERObjectIdentifier(byte[] oid) throws IOException {
        ByteArrayInputStream bIn = new ByteArrayInputStream(oid);
        DERInputStream dIn = new DERInputStream(bIn);

        return (DERObjectIdentifier) dIn.readObject();
    }

    public static byte[] encodeGeneralName(String name) throws IOException {
        return encodeGeneralName(new X509Name(name));
    }
View Full Code Here

    public static DERObjectIdentifier decodeOIDDERObjectIdentifier(byte[] oid) throws IOException {
        ByteArrayInputStream bIn = new ByteArrayInputStream(oid);
        DERInputStream dIn = new DERInputStream(bIn);

        return (DERObjectIdentifier) dIn.readObject();
    }

    public static byte[] encodeGeneralName(String name) throws IOException {
        return encodeGeneralName(new X509Name(name));
    }
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.