Examples of CertificationRequestInfo


Examples of org.apache.geronimo.util.asn1.pkcs.CertificationRequestInfo

       
        PKCS10CertificationRequest pkcs10certreq = new PKCS10CertificationRequest(data);
        if(!pkcs10certreq.verify()) {
            throw new Exception("CSR verification failed.");
        }
        CertificationRequestInfo certReqInfo = pkcs10certreq.getCertificationRequestInfo();
        Map map = new HashMap();
        map.put(CERT_REQ_SUBJECT, certReqInfo.getSubject());
        map.put(CERT_REQ_PUBLICKEY, certReqInfo.getSubjectPublicKeyInfo());
        map.put(CERT_REQ_PUBLICKEY_OBJ, getPublicKeyObject(certReqInfo.getSubjectPublicKeyInfo()));
        map.put(CERT_REQ_VERSION, certReqInfo.getVersion());
        return map;
    }
View Full Code Here

Examples of org.apache.geronimo.util.asn1.pkcs.CertificationRequestInfo

       
        PKCS10CertificationRequest pkcs10certreq = new PKCS10CertificationRequest(data);
        if(!pkcs10certreq.verify()) {
            throw new Exception("CSR verification failed.");
        }
        CertificationRequestInfo certReqInfo = pkcs10certreq.getCertificationRequestInfo();
        Map map = new HashMap();
        map.put(CERT_REQ_SUBJECT, certReqInfo.getSubject());
        map.put(CERT_REQ_PUBLICKEY, certReqInfo.getSubjectPublicKeyInfo());
        map.put(CERT_REQ_PUBLICKEY_OBJ, getPublicKeyObject(certReqInfo.getSubjectPublicKeyInfo()));
        map.put(CERT_REQ_VERSION, certReqInfo.getVersion());
        return map;
    }
View Full Code Here

Examples of org.apache.geronimo.util.asn1.pkcs.CertificationRequestInfo

        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

Examples of org.apache.harmony.security.pkcs10.CertificationRequestInfo

                new AlgorithmIdentifier("1.2.840.113549.1.1.2"), new byte[4]);
        List attributes = new ArrayList();
        // 1.2.840.113549.1.9.1 is OID of EMAILADDRESS
        attributes.add(new AttributeTypeAndValue("1.2.840.113549.1.9.1",
                new AttributeValue("a@b.com", false)));
        CertificationRequestInfo certReqInfo = new CertificationRequestInfo(
                version, subject, spki, attributes);
        AlgorithmIdentifier signatureAlgId = new AlgorithmIdentifier(
                "1.2.3.44.555");
        byte[] signature = { (byte) 0x01, (byte) 0x02, (byte) 0x03,
                (byte) 0x04, (byte) 0x05 };

        CertificationRequest certReq = new CertificationRequest(certReqInfo,
                signatureAlgId, signature);

        // check what we have constructed
        assertEquals(certReqInfo, certReq.getInfo());
        assertEquals(signatureAlgId, certReq.getAlgId());
        assertTrue(Arrays.equals(signature, certReq.getSignature()));

        // decode the encoded CSR
        byte[] encoding = certReq.getEncoded();
        CertificationRequest decoded = (CertificationRequest) CertificationRequest.ASN1
                .decode(encoding);

        // check what was decoded
        CertificationRequestInfo decodedCRinfo = certReq.getInfo();
       
        assertEquals(certReqInfo.getSubject(), decodedCRinfo.getSubject());
        assertEquals(certReqInfo.getSubjectPublicKeyInfo(), decodedCRinfo
                .getSubjectPublicKeyInfo());
        assertEquals(certReqInfo.getVersion(), decodedCRinfo.getVersion());
        assertEquals(certReqInfo.getAttributes(), decodedCRinfo.getAttributes());
       
        assertEquals(certReq.getAlgId(), decoded.getAlgId());
        assertTrue(Arrays.equals(certReq.getSignature(), decoded.getSignature()));
    }
View Full Code Here

Examples of org.apache.harmony.security.pkcs10.CertificationRequestInfo

        List attributes = new ArrayList();
        // 1.2.840.113549.1.9.1 is OID of EMAILADDRESS
        attributes.add(new AttributeTypeAndValue("1.2.840.113549.1.9.1",
                new AttributeValue("a@b.com", false)));

        CertificationRequestInfo certReqInfo = new CertificationRequestInfo(
                version, subject, spki, attributes);

        // check what we have constructed
        assertEquals(version, certReqInfo.getVersion());
        assertEquals(subject.getName(X500Principal.RFC1779), certReqInfo
                .getSubject().getName(X500Principal.RFC1779));
        assertTrue(Arrays.equals(spki.getEncoded(), certReqInfo
                .getSubjectPublicKeyInfo().getEncoded()));
        assertEquals(attributes, certReqInfo.getAttributes());

        // decode the encoded CertificationRequestInfo
        byte[] encoding = certReqInfo.getEncoded();
        CertificationRequestInfo decoded =
                (CertificationRequestInfo) CertificationRequestInfo.ASN1
                        .decode(encoding);

        // check what was decoded
        assertEquals(certReqInfo.getVersion(), decoded.getVersion());
        assertEquals(certReqInfo.getSubject().getName(X500Principal.CANONICAL),
                decoded.getSubject().getName(X500Principal.CANONICAL));
        assertTrue(Arrays.equals(certReqInfo.getSubjectPublicKeyInfo()
                .getEncoded(), decoded.getSubjectPublicKeyInfo().getEncoded()));
       
        AttributeTypeAndValue certReqInfoATaV = (AttributeTypeAndValue) certReqInfo
                .getAttributes().get(0);
        AttributeTypeAndValue decodedATaV = (AttributeTypeAndValue) decoded
                .getAttributes().get(0);
        assertEquals(certReqInfoATaV.getType(), decodedATaV.getType());
    }
View Full Code Here

Examples of org.apache.harmony.security.pkcs10.CertificationRequestInfo

                    "Failed to decode SubjectPublicKeyInfo. ").initCause(e);
        }

        // generate CertificationRequestInfo based on data taken from
        // the existing certificate.
        CertificationRequestInfo certReqInfo = new CertificationRequestInfo(
                cert.getVersion(), distinguishedName, subjectPublicKeyInfo,
                // attributes
                new Vector());
        byte[] infoEncoding = certReqInfo.getEncoded();

        // generate the signature
        String sigAlgName = (param.getSigAlg() != null) ? param.getSigAlg()
                : cert.getSigAlgName();
View Full Code Here

Examples of org.apache.harmony.security.pkcs10.CertificationRequestInfo

                    "Failed to decode SubjectPublicKeyInfo. ").initCause(e);
        }

        // generate CertificationRequestInfo based on data taken from
        // the existing certificate.
        CertificationRequestInfo certReqInfo = new CertificationRequestInfo(
                cert.getVersion(), distinguishedName, subjectPublicKeyInfo,
                // attributes
                new Vector());
        byte[] infoEncoding = certReqInfo.getEncoded();

        // generate the signature
        String sigAlgName = (param.getSigAlg() != null) ? param.getSigAlg()
                : cert.getSigAlgName();
View Full Code Here

Examples of org.bouncycastle.asn1.pkcs.CertificationRequestInfo

        ByteArrayInputStream    bIn = new ByteArrayInputStream(bytes);
        DERInputStream          dIn = new DERInputStream(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

Examples of org.bouncycastle.asn1.pkcs.CertificationRequestInfo

        }

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

Examples of org.bouncycastle.asn1.pkcs.CertificationRequestInfo

        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
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.