not-yet-commons-ssl-0.3.11

 = (IntegerRMI)paramRemote;
    switch (paramInt)
    {
    case 0: 
      paramRemoteCall.releaseInputStream();
      int i = localIntegerRMI.getInt();
      try
      {
        ObjectOutput localObjectOutput = paramRemoteCall.getResultStream(true);
        localObjectOutput.writeInt(i);
      }
      catch (IOException localIOException)
      {
        throw new MarshalException("error marshalling return", localIOException);
      }
    default: 
      throw new UnmarshalException("invalid method number");
    }
  }
  
  public Operation[] getOperations()
  {
    return (Operation[])operations.clone();
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.ssl.rmi.IntegerRMI_Skel
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.ssl.rmi;

import java.io.DataInput;
import java.io.IOException;
import java.io.ObjectInput;
import java.lang.reflect.Method;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.UnexpectedException;
import java.rmi.UnmarshalException;
import java.rmi.server.Operation;
import java.rmi.server.RemoteCall;
import java.rmi.server.RemoteObject;
import java.rmi.server.RemoteRef;
import java.rmi.server.RemoteStub;

public final class IntegerRMI_Stub
  extends RemoteStub
  implements Remote, RemoteInteger
{
  private static final Operation[] operations = { new Operation("int getInt()") };
  private static final long interfaceHash = 6856628635405599356L;
  private static final long serialVersionUID = 2L;
  private static boolean useNewInvoke;
  private static Method $method_getInt_0;
  
  static
  {
    try
    {
      RemoteRef.class.getMethod("invoke", new Class[] { Remote.class, Method.class, new Object[0].getClass(), Long.TYPE });
      useNewInvoke = true;
      $method_getInt_0 = RemoteInteger.class.getMethod("getInt", new Class[0]);
    }
    catch (NoSuchMethodException localNoSuchMethodException)
    {
      useNewInvoke = false;
    }
  }
  
  public IntegerRMI_Stub() {}
  
  public IntegerRMI_Stub(RemoteRef paramRemoteRef)
  {
    super(paramRemoteRef);
  }
  
  public int getInt()
    throws RemoteException
  {
    try
    {
      if (useNewInvoke)
      {
        localObject1 = ref.invoke(this, $method_getInt_0, null, 8565631889465877029L);
        return ((Integer)localObject1).intValue();
      }
      Object localObject1 = ref.newCall(this, operations, 0, 6856628635405599356L);
      ref.invoke((RemoteCall)localObject1);
      int i;
      try
      {
        ObjectInput localObjectInput = ((RemoteCall)localObject1).getInputStream();
        i = localObjectInput.readInt();
      }
      catch (IOException localIOException)
      {
        throw new UnmarshalException("error unmarshalling return", localIOException);
      }
      finally
      {
        ref.done((RemoteCall)localObject1);
      }
      return i;
    }
    catch (RuntimeException localRuntimeException)
    {
      throw localRuntimeException;
    }
    catch (RemoteException localRemoteException)
    {
      throw localRemoteException;
    }
    catch (Exception localException)
    {
      throw new UnexpectedException("undeclared checked exception", localException);
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.ssl.rmi.IntegerRMI_Stub
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.ssl.rmi;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.Date;

public abstract interface RemoteDate
  extends Remote
{
  public abstract Date getDate()
    throws RemoteException;
}

/* Location:
 * Qualified Name:     org.apache.commons.ssl.rmi.RemoteDate
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.ssl.rmi;

import java.rmi.Remote;
import java.rmi.RemoteException;

public abstract interface RemoteInteger
  extends Remote
{
  public abstract int getInt()
    throws RemoteException;
}

/* Location:
 * Qualified Name:     org.apache.commons.ssl.rmi.RemoteInteger
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.ssl.rmi;

import java.io.PrintStream;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.RMISocketFactory;
import org.apache.commons.ssl.LogWrapper;
import org.apache.commons.ssl.RMISocketFactoryImpl;

public class Test
{
  private static final LogWrapper log = LogWrapper.getLogger(Test.class);
  private static final String TEST_DATE_NAME = "/org.apache.commons.ssl.rmi.testdate";
  private static final String TEST_INT_NAME = "/org.apache.commons.ssl.rmi.testint";
  protected static final int PORT;
  protected static final String URL;
  private static boolean rmiRunning = false;
  
  static
  {
    int port = 1099;
    String host = "127.0.0.1";
    PORT = port;
    
    URL = "rmi://" + host + ":" + port;
  }
  
  public static Object lookup(String ref)
    throws RemoteException, NotBoundException, MalformedURLException
  {
    return Naming.lookup(URL + ref);
  }
  
  public static void rebind(String ref, Remote obj)
    throws RemoteException, MalformedURLException
  {
    requireNameServer();
    String realRef = URL + ref;
    Naming.rebind(realRef, obj);
    try
    {
      Object o = lookup(ref);
      log.debug("Bound " + o.getClass().getName() + " to [" + realRef + "]");
    }
    catch (NotBoundException nbe)
    {
      log.debug("Error binding " + obj.getClass().getName() + " to [" + realRef + "]");
    }
  }
  
  private static void rebindTest()
    throws Exception
  {
    Remote remoteTest = new DateRMI();
    Naming.rebind(URL + "/org.apache.commons.ssl.rmi.testdate", remoteTest);
    Object o = Naming.lookup(URL + "/org.apache.commons.ssl.rmi.testdate");
    if (!remoteTest.equals(o)) {
      throw new RuntimeException("rmi: Test failed. Lookup != Rebind");
    }
  }
  
  private static synchronized void requireNameServer()
  {
    if (rmiRunning) {
      return;
    }
    try
    {
      rebindTest();
      rmiRunning = true;
    }
    catch (Exception e)
    {
      tryToStartNameServer();
      try
      {
        rebindTest();
        log.debug(Test.class.getName() + " successfully started.");
        rmiRunning = true;
        return;
      }
      catch (Exception e2)
      {
        e2.printStackTrace();
        log.error(e2.getMessage(), e2);
        
        String msg = Test.class.getName() + " cannot start.";
        log.error(msg);
        throw new RuntimeException(msg);
      }
    }
  }
  
  public static void tryToStartNameServer()
  {
    String className = Test.class.getName();
    log.debug(className + " probably not running.   Trying to start one.");
    try
    {
      LocateRegistry.createRegistry(PORT);
      log.debug("registry on " + PORT + " started!");
    }
    catch (Exception problem)
    {
      problem.printStackTrace();
      log.warn(problem, problem);
    }
  }
  
  public static void main(String[] args)
    throws Exception
  {
    System.setProperty("java.rmi.server.hostname", "localhost");
    RMISocketFactoryImpl impl = new RMISocketFactoryImpl();
    RMISocketFactory.setSocketFactory(impl);
    if (args.length <= 0)
    {
      requireNameServer();
      rebindTest();
      
      IntegerRMI remoteInt = new IntegerRMI();
      rebind("/org.apache.commons.ssl.rmi.testint", remoteInt);
    }
    Object o = lookup("/org.apache.commons.ssl.rmi.testdate");
    RemoteDate rd = (RemoteDate)o;
    System.out.println("The remote-date is: " + rd.getDate());
    
    o = lookup("/org.apache.commons.ssl.rmi.testint");
    RemoteInteger ri = (RemoteInteger)o;
    System.out.println("The remote-int  is: " + ri.getInt());
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.ssl.rmi.Test
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.ssl.util;

import java.io.ByteArrayInputStream;
import java.io.IOException;

public class ByteArrayReadLine
  extends ReadLine
{
  public ByteArrayReadLine(ByteArrayInputStream in)
  {
    super(in);
  }
  
  public String next()
  {
    return next(1);
  }
  
  public String next(int lines)
  {
    try
    {
      return super.next(lines);
    }
    catch (IOException ioe)
    {
      throw new RuntimeException("impossible", ioe);
    }
  }
  
  public byte[] nextAsBytes()
  {
    return nextAsBytes(1);
  }
  
  public byte[] nextAsBytes(int lines)
  {
    try
    {
      return super.nextAsBytes(lines);
    }
    catch (IOException ioe)
    {
      throw new RuntimeException("impossible", ioe);
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.ssl.util.ByteArrayReadLine
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.ssl.util;

public class Hex
{
  public static byte[] decode(String s)
  {
    byte[] b = new byte[s.length() / 2];
    for (int i = 0; i < b.length; i++)
    {
      String hex = s.substring(2 * i, 2 * (i + 1));
      b[i] = ((byte)Integer.parseInt(hex, 16));
    }
    return b;
  }
  
  public static byte[] decode(byte[] hexString)
  {
    byte[] b = new byte[hexString.length / 2];
    char[] chars = new char[2];
    for (int i = 0; i < b.length; i++)
    {
      chars[0] = ((char)hexString[(2 * i)]);
      chars[1] = ((char)hexString[(2 * i + 1)]);
      String hex = new String(chars);
      b[i] = ((byte)Integer.parseInt(hex, 16));
    }
    return b;
  }
  
  public static String encode(byte[] b)
  {
    return encode(b, 0, b.length);
  }
  
  public static String encode(byte[] b, int offset, int length)
  {
    StringBuffer buf = new StringBuffer();
    int len = Math.min(offset + length, b.length);
    for (int i = offset; i < len; i++)
    {
      int c = b[i];
      if (c < 0) {
        c += 256;
      }
      if ((c >= 0) && (c <= 15)) {
        buf.append('0');
      }
      buf.append(Integer.toHexString(c));
    }
    return buf.toString();
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.ssl.util.Hex
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.ssl.util;

import java.math.BigInteger;
import java.security.GeneralSecurityException;
import java.security.KeyException;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.interfaces.DSAParams;
import java.security.interfaces.DSAPrivateKey;
import java.security.interfaces.RSAPrivateCrtKey;
import java.security.spec.DSAPublicKeySpec;
import java.security.spec.RSAPublicKeySpec;

public class PublicKeyDeriver
{
  public static PublicKey derivePublicKey(PrivateKey key)
    throws GeneralSecurityException
  {
    if ((key instanceof DSAPrivateKey))
    {
      DSAPrivateKey dsaKey = (DSAPrivateKey)key;
      DSAParams keyParams = dsaKey.getParams();
      BigInteger g = keyParams.getG();
      BigInteger p = keyParams.getP();
      BigInteger q = keyParams.getQ();
      BigInteger x = dsaKey.getX();
      BigInteger y = q.modPow(x, p);
      DSAPublicKeySpec keySpec = new DSAPublicKeySpec(y, p, q, g);
      return KeyFactory.getInstance("DSA").generatePublic(keySpec);
    }
    if ((key instanceof RSAPrivateCrtKey))
    {
      RSAPrivateCrtKey rsaKey = (RSAPrivateCrtKey)key;
      BigInteger modulus = rsaKey.getModulus();
      BigInteger exponent = rsaKey.getPublicExponent();
      RSAPublicKeySpec keySpec = new RSAPublicKeySpec(modulus, exponent);
      return KeyFactory.getInstance("RSA").generatePublic(keySpec);
    }
    throw new KeyException("Private key was not a DSA or RSA key");
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.ssl.util.PublicKeyDeriver
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.ssl.util;

import java.io.IOException;
import java.io.InputStream;

public class ReadLine
{
  final InputStream in;
  final byte[] bytes = new byte['?'];
  int pos = 0;
  int avail = 0;
  
  public ReadLine(InputStream in)
  {
    this.in = in;
  }
  
  public String next()
    throws IOException
  {
    return next(1);
  }
  
  public String next(int lines)
    throws IOException
  {
    if (lines < 1) {
      lines = 1;
    }
    StringBuffer buf = new StringBuffer(128 * lines);
    if ((avail <= 0) || (pos >= avail))
    {
      pos = 0;
      avail = in.read(bytes);
    }
    while (avail >= 0)
    {
      while (pos < avail)
      {
        char c = (char)bytes[(pos++)];
        switch (c)
        {
        case '\n': 
        case '\r': 
          lines--;
          if ((lines < 1) && (buf.length() > 0)) {
            return buf.toString();
          }
          break;
        default: 
          buf.append(c);
        }
      }
      pos = 0;
      avail = in.read(bytes);
    }
    return buf.length() > 0 ? buf.toString() : null;
  }
  
  public byte[] nextAsBytes()
    throws IOException
  {
    return nextAsBytes(1);
  }
  
  public byte[] nextAsBytes(int lines)
    throws IOException
  {
    if (lines < 1) {
      lines = 1;
    }
    byte[] buf = new byte['?'];
    int bufPos = 0;
    if ((avail <= 0) || (pos >= avail))
    {
      pos = 0;
      avail = in.read(bytes);
    }
    while (avail >= 0)
    {
      while (pos < avail)
      {
        byte b = bytes[(pos++)];
        switch (b)
        {
        case 10: 
        case 13: 
          lines--;
          if ((lines == 0) && (bufPos > 0)) {
            return buf;
          }
          break;
        default: 
          if (bufPos >= buf.length)
          {
            byte[] moreBuff = new byte[buf.length * 2];
            System.arraycopy(buf, 0, moreBuff, 0, buf.length);
            buf = moreBuff;
          }
          buf[(bufPos++)] = b;
        }
      }
      pos = 0;
      avail = in.read(bytes);
    }
    return bufPos > 0 ? buf : null;
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.ssl.util.ReadLine
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.ssl.util;

import java.io.UnsupportedEncodingException;

public class UTF8
{
  public static String toString(byte[] bytes)
  {
    try
    {
      return new String(bytes, "UTF-8");
    }
    catch (UnsupportedEncodingException uee)
    {
      throw new RuntimeException("UTF8 unavailable", uee);
    }
  }
  
  public static byte[] toBytes(String s)
  {
    try
    {
      return s.getBytes("UTF-8");
    }
    catch (UnsupportedEncodingException uee)
    {
      throw new RuntimeException("UTF8 unavailable", uee);
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.ssl.util.UTF8
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
1 2 3 4 5 6 7 8 9 10 11 12 13

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd