Java 类com.jcraft.jsch.Cipher 实例源码

项目:keepass2android    文件:ARCFOUR256.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    cipher.init((mode==ENCRYPT_MODE?
   javax.crypto.Cipher.ENCRYPT_MODE:
   javax.crypto.Cipher.DECRYPT_MODE),
  _key);
    byte[] foo=new byte[1];
    for(int i=0; i<skip; i++){
      cipher.update(foo, 0, 1, foo, 0);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:keepass2android    文件:AES192CBC.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CBC/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:keepass2android    文件:ARCFOUR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }

  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    cipher.init((mode==ENCRYPT_MODE?
   javax.crypto.Cipher.ENCRYPT_MODE:
   javax.crypto.Cipher.DECRYPT_MODE),
  _key);
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:keepass2android    文件:AES192CTR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CTR/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:keepass2android    文件:AES256CTR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CTR/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:keepass2android    文件:BlowfishCBC.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
    String pad="NoPadding";      
//  if(padding) pad="PKCS5Padding";
    byte[] tmp;
    if(iv.length>ivsize){
      tmp=new byte[ivsize];
      System.arraycopy(iv, 0, tmp, 0, tmp.length);
      iv=tmp;
    }
    if(key.length>bsize){
      tmp=new byte[bsize];
      System.arraycopy(key, 0, tmp, 0, tmp.length);
      key=tmp;
    }
    try{
      SecretKeySpec skeySpec = new SecretKeySpec(key, "Blowfish");
      cipher=javax.crypto.Cipher.getInstance("Blowfish/CBC/"+pad);
      cipher.init((mode==ENCRYPT_MODE?
           javax.crypto.Cipher.ENCRYPT_MODE:
           javax.crypto.Cipher.DECRYPT_MODE),
          skeySpec, new IvParameterSpec(iv));
    }
    catch(Exception e){
      throw e;
    }
  }
项目:keepass2android    文件:AES256CBC.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CBC/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:keepass2android    文件:ARCFOUR128.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    cipher.init((mode==ENCRYPT_MODE?
   javax.crypto.Cipher.ENCRYPT_MODE:
   javax.crypto.Cipher.DECRYPT_MODE),
  _key);
    byte[] foo=new byte[1];
    for(int i=0; i<skip; i++){
      cipher.update(foo, 0, 1, foo, 0);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:aos-FileCoreLibrary    文件:ARCFOUR256.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    synchronized(javax.crypto.Cipher.class){
      cipher.init((mode==ENCRYPT_MODE?
                   javax.crypto.Cipher.ENCRYPT_MODE:
                   javax.crypto.Cipher.DECRYPT_MODE),
                  _key);
    }
    byte[] foo=new byte[1];
    for(int i=0; i<skip; i++){
      cipher.update(foo, 0, 1, foo, 0);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:aos-FileCoreLibrary    文件:ARCFOUR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }

  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    synchronized(javax.crypto.Cipher.class){
      cipher.init((mode==ENCRYPT_MODE?
                   javax.crypto.Cipher.ENCRYPT_MODE:
                   javax.crypto.Cipher.DECRYPT_MODE),
    _key);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:aos-FileCoreLibrary    文件:ARCFOUR128.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    synchronized(javax.crypto.Cipher.class){
      cipher.init((mode==ENCRYPT_MODE?
                   javax.crypto.Cipher.ENCRYPT_MODE:
                   javax.crypto.Cipher.DECRYPT_MODE),
                  _key);
    }
    byte[] foo=new byte[1];
    for(int i=0; i<skip; i++){
      cipher.update(foo, 0, 1, foo, 0);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:parabuild-ci    文件:ARCFOUR256.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    cipher.init((mode==ENCRYPT_MODE?
   javax.crypto.Cipher.ENCRYPT_MODE:
   javax.crypto.Cipher.DECRYPT_MODE),
  _key);
    byte[] foo=new byte[1];
    for(int i=0; i<skip; i++){
      cipher.update(foo, 0, 1, foo, 0);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:parabuild-ci    文件:AES192CBC.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CBC/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:parabuild-ci    文件:ARCFOUR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }

  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    cipher.init((mode==ENCRYPT_MODE?
   javax.crypto.Cipher.ENCRYPT_MODE:
   javax.crypto.Cipher.DECRYPT_MODE),
  _key);
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:parabuild-ci    文件:AES192CTR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CTR/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:parabuild-ci    文件:AES256CTR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CTR/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:parabuild-ci    文件:BlowfishCBC.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
    String pad="NoPadding";      
//  if(padding) pad="PKCS5Padding";
    byte[] tmp;
    if(iv.length>ivsize){
      tmp=new byte[ivsize];
      System.arraycopy(iv, 0, tmp, 0, tmp.length);
      iv=tmp;
    }
    if(key.length>bsize){
      tmp=new byte[bsize];
      System.arraycopy(key, 0, tmp, 0, tmp.length);
      key=tmp;
    }
    try{
      SecretKeySpec skeySpec = new SecretKeySpec(key, "Blowfish");
      cipher=javax.crypto.Cipher.getInstance("Blowfish/CBC/"+pad);
      cipher.init((mode==ENCRYPT_MODE?
           javax.crypto.Cipher.ENCRYPT_MODE:
           javax.crypto.Cipher.DECRYPT_MODE),
          skeySpec, new IvParameterSpec(iv));
    }
    catch(Exception e){
      throw e;
    }
  }
项目:parabuild-ci    文件:AES256CBC.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CBC/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:parabuild-ci    文件:ARCFOUR128.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    cipher.init((mode==ENCRYPT_MODE?
   javax.crypto.Cipher.ENCRYPT_MODE:
   javax.crypto.Cipher.DECRYPT_MODE),
  _key);
    byte[] foo=new byte[1];
    for(int i=0; i<skip; i++){
      cipher.update(foo, 0, 1, foo, 0);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:KeePass2Android    文件:ARCFOUR256.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    cipher.init((mode==ENCRYPT_MODE?
   javax.crypto.Cipher.ENCRYPT_MODE:
   javax.crypto.Cipher.DECRYPT_MODE),
  _key);
    byte[] foo=new byte[1];
    for(int i=0; i<skip; i++){
      cipher.update(foo, 0, 1, foo, 0);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:KeePass2Android    文件:AES192CBC.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CBC/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:KeePass2Android    文件:ARCFOUR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }

  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    cipher.init((mode==ENCRYPT_MODE?
   javax.crypto.Cipher.ENCRYPT_MODE:
   javax.crypto.Cipher.DECRYPT_MODE),
  _key);
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:KeePass2Android    文件:AES192CTR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CTR/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:KeePass2Android    文件:AES256CTR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CTR/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:KeePass2Android    文件:BlowfishCBC.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
    String pad="NoPadding";      
//  if(padding) pad="PKCS5Padding";
    byte[] tmp;
    if(iv.length>ivsize){
      tmp=new byte[ivsize];
      System.arraycopy(iv, 0, tmp, 0, tmp.length);
      iv=tmp;
    }
    if(key.length>bsize){
      tmp=new byte[bsize];
      System.arraycopy(key, 0, tmp, 0, tmp.length);
      key=tmp;
    }
    try{
      SecretKeySpec skeySpec = new SecretKeySpec(key, "Blowfish");
      cipher=javax.crypto.Cipher.getInstance("Blowfish/CBC/"+pad);
      cipher.init((mode==ENCRYPT_MODE?
           javax.crypto.Cipher.ENCRYPT_MODE:
           javax.crypto.Cipher.DECRYPT_MODE),
          skeySpec, new IvParameterSpec(iv));
    }
    catch(Exception e){
      throw e;
    }
  }
项目:KeePass2Android    文件:AES256CBC.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CBC/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:KeePass2Android    文件:ARCFOUR128.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    cipher.init((mode==ENCRYPT_MODE?
   javax.crypto.Cipher.ENCRYPT_MODE:
   javax.crypto.Cipher.DECRYPT_MODE),
  _key);
    byte[] foo=new byte[1];
    for(int i=0; i<skip; i++){
      cipher.update(foo, 0, 1, foo, 0);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:colony    文件:ARCFOUR256.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    synchronized(javax.crypto.Cipher.class){
      cipher.init((mode==ENCRYPT_MODE?
                   javax.crypto.Cipher.ENCRYPT_MODE:
                   javax.crypto.Cipher.DECRYPT_MODE),
                  _key);
    }
    byte[] foo=new byte[1];
    for(int i=0; i<skip; i++){
      cipher.update(foo, 0, 1, foo, 0);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:colony    文件:ARCFOUR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }

  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    synchronized(javax.crypto.Cipher.class){
      cipher.init((mode==ENCRYPT_MODE?
                   javax.crypto.Cipher.ENCRYPT_MODE:
                   javax.crypto.Cipher.DECRYPT_MODE),
    _key);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:colony    文件:ARCFOUR128.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    synchronized(javax.crypto.Cipher.class){
      cipher.init((mode==ENCRYPT_MODE?
                   javax.crypto.Cipher.ENCRYPT_MODE:
                   javax.crypto.Cipher.DECRYPT_MODE),
                  _key);
    }
    byte[] foo=new byte[1];
    for(int i=0; i<skip; i++){
      cipher.update(foo, 0, 1, foo, 0);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:tigervnc    文件:ARCFOUR256.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    synchronized(javax.crypto.Cipher.class){
      cipher.init((mode==ENCRYPT_MODE?
                   javax.crypto.Cipher.ENCRYPT_MODE:
                   javax.crypto.Cipher.DECRYPT_MODE),
                  _key);
    }
    byte[] foo=new byte[1];
    for(int i=0; i<skip; i++){
      cipher.update(foo, 0, 1, foo, 0);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:tigervnc    文件:ARCFOUR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }

  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    synchronized(javax.crypto.Cipher.class){
      cipher.init((mode==ENCRYPT_MODE?
                   javax.crypto.Cipher.ENCRYPT_MODE:
                   javax.crypto.Cipher.DECRYPT_MODE),
    _key);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:tigervnc    文件:ARCFOUR128.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    synchronized(javax.crypto.Cipher.class){
      cipher.init((mode==ENCRYPT_MODE?
                   javax.crypto.Cipher.ENCRYPT_MODE:
                   javax.crypto.Cipher.DECRYPT_MODE),
                  _key);
    }
    byte[] foo=new byte[1];
    for(int i=0; i<skip; i++){
      cipher.update(foo, 0, 1, foo, 0);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:SPA    文件:ARCFOUR256.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    cipher.init((mode==ENCRYPT_MODE?
   javax.crypto.Cipher.ENCRYPT_MODE:
   javax.crypto.Cipher.DECRYPT_MODE),
  _key);
    byte[] foo=new byte[1];
    for(int i=0; i<skip; i++){
      cipher.update(foo, 0, 1, foo, 0);
    }
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:SPA    文件:AES192CBC.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CBC/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:SPA    文件:ARCFOUR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }

  try{
    cipher=javax.crypto.Cipher.getInstance("RC4");
    SecretKeySpec _key = new SecretKeySpec(key, "RC4");
    cipher.init((mode==ENCRYPT_MODE?
   javax.crypto.Cipher.ENCRYPT_MODE:
   javax.crypto.Cipher.DECRYPT_MODE),
  _key);
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:SPA    文件:AES192CTR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CTR/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:SPA    文件:AES256CTR.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CTR/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}
项目:SPA    文件:BlowfishCBC.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
    String pad="NoPadding";      
//  if(padding) pad="PKCS5Padding";
    byte[] tmp;
    if(iv.length>ivsize){
      tmp=new byte[ivsize];
      System.arraycopy(iv, 0, tmp, 0, tmp.length);
      iv=tmp;
    }
    if(key.length>bsize){
      tmp=new byte[bsize];
      System.arraycopy(key, 0, tmp, 0, tmp.length);
      key=tmp;
    }
    try{
      SecretKeySpec skeySpec = new SecretKeySpec(key, "Blowfish");
      cipher=javax.crypto.Cipher.getInstance("Blowfish/CBC/"+pad);
      cipher.init((mode==ENCRYPT_MODE?
           javax.crypto.Cipher.ENCRYPT_MODE:
           javax.crypto.Cipher.DECRYPT_MODE),
          skeySpec, new IvParameterSpec(iv));
    }
    catch(Exception e){
      throw e;
    }
  }
项目:SPA    文件:AES256CBC.java   
public void init(int mode, byte[] key, byte[] iv) throws Exception{
  String pad="NoPadding";      
  byte[] tmp;
  if(iv.length>ivsize){
    tmp=new byte[ivsize];
    System.arraycopy(iv, 0, tmp, 0, tmp.length);
    iv=tmp;
  }
  if(key.length>bsize){
    tmp=new byte[bsize];
    System.arraycopy(key, 0, tmp, 0, tmp.length);
    key=tmp;
  }
  try{
    SecretKeySpec keyspec=new SecretKeySpec(key, "AES");
    cipher=javax.crypto.Cipher.getInstance("AES/CBC/"+pad);
    cipher.init((mode==ENCRYPT_MODE?
                 javax.crypto.Cipher.ENCRYPT_MODE:
                 javax.crypto.Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv));
  }
  catch(Exception e){
    cipher=null;
    throw e;
  }
}