Examples of CertificationRequest


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

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

        } catch (SignatureException e) {
            throw new SignatureException("Failed to sign the certificate. ", e);
        }

        // generating the request
        CertificationRequest certReq = new CertificationRequest(certReqInfo,
                new AlgorithmIdentifier(cert.getSigAlgOID()), signatureValue);
        byte[] certReqEncoding = certReq.getEncoded();

        OutputStream output;
        // if no file name is given, output to System.out
        String fileName = param.getFileName();
        if (fileName == null) {
View Full Code Here

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

        } catch (SignatureException e) {
            throw new SignatureException("Failed to sign the certificate. ", e);
        }

        // generating the request
        CertificationRequest certReq = new CertificationRequest(certReqInfo,
                new AlgorithmIdentifier(cert.getSigAlgOID()), signatureValue);
        byte[] certReqEncoding = certReq.getEncoded();

        OutputStream output;
        // if no file name is given, output to System.out
        String fileName = param.getFileName();
        if (fileName == null) {
View Full Code Here

Examples of org.bouncycastle.asn1.pkcs.CertificationRequest

        try
        {
            ByteArrayInputStream    bIn = new ByteArrayInputStream(req);
            ASN1InputStream         aIn = new ASN1InputStream(bIn);

            CertificationRequest    r = new CertificationRequest((ASN1Sequence)aIn.readObject());

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

            dOut.writeObject(r.getDERObject());

            byte[]                    bytes = bOut.toByteArray();

            if (bytes.length != req.length)
            {
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.