Package org.jruby.ext.openssl.x509store

Examples of org.jruby.ext.openssl.x509store.X509AuxCertificate


            dflags = args[2];
        }
        IRubyObject pkey = args[0];
        IRubyObject cert = args[1];
        PrivateKey key = ((PKey)pkey).getPrivateKey();
        X509AuxCertificate x509 = ((X509Cert)cert).getAuxCert();
        int flg = dflags.isNil() ? 0 : RubyNumeric.fix2int(dflags);

        BIO out = BIO.mem();
        try {
            p7.decrypt(key, x509, out, flg);
View Full Code Here


                cert = args[0];
                key = args[1];
                data = args[2];
            }

            X509AuxCertificate x509 = ((X509Cert)cert).getAuxCert();
            PrivateKey pkey = ((PKey)key).getPrivateKey();
            int flg = flags.isNil() ? 0 : RubyNumeric.fix2int(flags);

            BIO in = obj2bio(data);
View Full Code Here

            throw new PKCS7Exception(F_PKCS7_GET0_SIGNERS,R_NO_SIGNERS);
        }

        for(SignerInfoWithPkey si : sinfos) {
            IssuerAndSerialNumber ias = si.getIssuerAndSerialNumber();
            X509AuxCertificate signer = null;
//             System.err.println("looking for: " + ias.getName() + " and " + ias.getCertificateSerialNumber());
//             System.err.println(" in: " + certs);
//             System.err.println(" in: " + getSign().getCert());
            if(certs != null) {
                signer = findByIssuerAndSerial(certs, ias.getName(), ias.getCertificateSerialNumber().getValue());
View Full Code Here

        }

        if((flags & NOSIGS) == 0) {
            for(int i=0; i<sinfos.size(); i++) {
                SignerInfoWithPkey si = sinfos.get(i);
                X509AuxCertificate signer = signers.get(i);
                signatureVerify(p7bio, si, signer);
            }
        }

        if(tmpin == indata) {
View Full Code Here

    public IRubyObject _initialize(IRubyObject[] args, Block block) {
        IRubyObject store;
        IRubyObject cert = getRuntime().getNil();
        IRubyObject chain = getRuntime().getNil();
        Store x509st;
        X509AuxCertificate x509 = null;
        List<X509AuxCertificate> x509s = new ArrayList<X509AuxCertificate>();

        if(org.jruby.runtime.Arity.checkArgumentCount(getRuntime(),args,1,3) > 1) {
            cert = args[1];
        }
View Full Code Here

    }

    @JRubyMethod
    public IRubyObject current_cert() {
        Ruby rt = getRuntime();
        X509AuxCertificate x509 = ctx.getCurrentCertificate();
        try {
            return cX509Cert.callMethod(rt.getCurrentContext(), "new", RubyString.newString(rt, x509.getEncoded()));
        } catch (CertificateEncodingException cee) {
            throw newStoreError(getRuntime(), cee.getMessage());
        }
    }
View Full Code Here

        return getRuntime().getNil();
    }

    @JRubyMethod
    public IRubyObject add_cert(IRubyObject _cert) {
        X509AuxCertificate cert = (_cert instanceof X509Cert) ? ((X509Cert)_cert).getAuxCert() : (X509AuxCertificate)null;
        if(store.addCertificate(cert) != 1) {
            raise(null);
        }
        return this;
    }
View Full Code Here

        }
    }

    private DERSequence firstCertificatesToASN1() {
        try {
            X509AuxCertificate c = cert.iterator().next();
            return (DERSequence) (new ASN1InputStream(new ByteArrayInputStream(c.getEncoded())).readObject());
        } catch (Exception e) {}
        return null;
    }
View Full Code Here

    }

    private static X509AuxCertificate certificateFromASN1(DEREncodable current) throws PKCS7Exception {
        X509CertificateStructure struct = X509CertificateStructure.getInstance(current);
        try {
            return new X509AuxCertificate(new X509CertificateObject(struct));
        } catch (CertificateParsingException cpe) {
            throw new PKCS7Exception(PKCS7.F_B64_READ_PKCS7, PKCS7.R_CERTIFICATE_VERIFY_ERROR, cpe);
        }
    }
View Full Code Here

            ArrayList<java.security.cert.X509Certificate> chain = new ArrayList<java.security.cert.X509Certificate>();
            if (ctx.extraChainCert != null) {
                chain.addAll(ctx.extraChainCert);
            } else if (ctx.cert != null) {
                StoreContext storeCtx = ctx.createStoreContext(null);
                X509AuxCertificate x = ctx.cert;
                while (true) {
                    chain.add(x);
                    if (x.getIssuerDN().equals(x.getSubjectDN())) {
                        break;
                    }
                    try {
                        Name xn = new Name(x.getIssuerX500Principal());
                        X509Object[] s_obj = new X509Object[1];
                        if (storeCtx.getBySubject(X509Utils.X509_LU_X509, xn, s_obj) <= 0) {
                            break;
                        }
                        x = ((Certificate) s_obj[0]).x509;
View Full Code Here

TOP

Related Classes of org.jruby.ext.openssl.x509store.X509AuxCertificate

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.