Package org.jruby.runtime.builtin

Examples of org.jruby.runtime.builtin.IRubyObject.convertToString()


                        val = pkey.callMethod(tc,"to_der");
                    } else {
                        val = ASN1.decode(getRuntime().getClassFromPath("OpenSSL::ASN1"), pkey.callMethod(tc, "to_der")).callMethod(tc, "value")
                                .callMethod(tc, "[]", getRuntime().newFixnum(1)).callMethod(tc, "value");
                    }
                    byte[] b = getSHA1Digest(getRuntime(), val.convertToString().getBytes());
                    asnv.add(new DEROctetString(b));
                }
                value = new String(ByteList.plain(new DERSequence(asnv).getDEREncoded()));
            } else if(r_oid.equals(new DERObjectIdentifier("2.5.29.18"))) { //issuerAltName
                if(valuex.startsWith("issuer:copy")) {
View Full Code Here


            data = args[1];
        }
        name = type.toString();
        algo = getDigest(name, getRuntime());
        if (!data.isNil()) {
            update(data.convertToString());
        }
        return this;
    }

    @Override
View Full Code Here

            return in.read();
        }
        IRubyObject readValue = readAdapter.call(io.getRuntime().getCurrentContext(), io, io, numOne);
        int returnValue = -1;
        if (!readValue.isNil()) {
            returnValue = readValue.convertToString().getByteList().get(0);
        }
        return returnValue;
    }

    @Override
View Full Code Here

            return in.read(b, 0, b.length);
        }
        IRubyObject readValue = readAdapter.call(io.getRuntime().getCurrentContext(), io, io, io.getRuntime().newFixnum(b.length));
        int returnValue = -1;
        if (!readValue.isNil()) {
            ByteList str = readValue.convertToString().getByteList();
            System.arraycopy(str.getUnsafeBytes(), str.getBegin(), b, 0, str.getRealSize());
            returnValue = str.getRealSize();
        }
        return returnValue;
    }
View Full Code Here

            return in.read(b, off, len);
        }
        IRubyObject readValue = readAdapter.call(io.getRuntime().getCurrentContext(), io, io, io.getRuntime().newFixnum(len));
        int returnValue = -1;
        if (!readValue.isNil()) {
            ByteList str = readValue.convertToString().getByteList();
            System.arraycopy(str.getUnsafeBytes(), str.getBegin(), b, off, str.getRealSize());
            returnValue = str.getRealSize();
        }
        return returnValue;
     }
View Full Code Here

        while (!current.op_equal19(context, afterEnd).isTrue()) {
            IRubyObject next = null;
            if (excl || !current.op_equal19(context, end).isTrue()) next = current.callMethod(context, "succ");
            block.yield(context, asSymbol ? runtime.newSymbol(current.toString()) : current);
            if (next == null) break;
            current = next.convertToString();
            if (excl && current.op_equal19(context, end).isTrue()) break;
            if (current.getByteList().length() > end.getByteList().length() || current.getByteList().length() == 0) break;
        }
        return this;
    }
View Full Code Here

    @JRubyMethod(meta = true)
    public static IRubyObject decode(IRubyObject recv, IRubyObject obj) {
        try {
            IRubyObject obj2 = OpenSSLImpl.to_der_if_possible(obj);
            RubyModule asnM = (RubyModule)recv;
            ASN1InputStream asis = new ASN1InputStream(obj2.convertToString().getBytes());
            IRubyObject ret = decodeObj(asnM, asis.readObject());
            return ret;
        } catch(IOException e) {
            throw recv.getRuntime().newIOErrorFromException(e);
        } catch(Exception e) {
View Full Code Here

            } else if(imp == DERInteger.class && val instanceof RubyBignum) {
                return new DERInteger(((RubyBignum)val).getValue());
            } else if(imp == DERInteger.class) {
                return new DERInteger(new BigInteger(val.toString()));
            } else if(imp == DEROctetString.class) {
                return new DEROctetString(val.convertToString().getBytes());
            } else if(imp == DERBitString.class) {
                byte[] bs = val.convertToString().getBytes();
                int unused = 0;
                for(int i = (bs.length-1); i>-1; i--) {
                    if(bs[i] == 0) {
View Full Code Here

            } else if(imp == DERInteger.class) {
                return new DERInteger(new BigInteger(val.toString()));
            } else if(imp == DEROctetString.class) {
                return new DEROctetString(val.convertToString().getBytes());
            } else if(imp == DERBitString.class) {
                byte[] bs = val.convertToString().getBytes();
                int unused = 0;
                for(int i = (bs.length-1); i>-1; i--) {
                    if(bs[i] == 0) {
                        unused += 8;
                    } else {
View Full Code Here

                    // We do this b/c make_tmpname might be overridden
                    IRubyObject tmpname = callMethod(runtime.getCurrentContext(),
                                                     "make_tmpname", new IRubyObject[] {basename, runtime.newFixnum(counter)});
                    tmp = JRubyFile.create(getRuntime().getCurrentDirectory(),
                                           new File(dir.convertToString().toString(), tmpname.convertToString().toString()).getPath());
                    if (tmp.createNewFile()) {
                        tmpFile = tmp;
                        path = tmp.getPath();
                        try {
                            tmpFile.deleteOnExit();
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.