Package java.security

Examples of java.security.InvalidParameterException


            case Cipher.DECRYPT_MODE:
            case Cipher.UNWRAP_MODE:
                cipher.init(false, param);
                break;
            default:
                throw new InvalidParameterException("unknown opmode " + opmode + " passed");
            }
        }
        catch (Exception e)
        {
            throw new InvalidKeyException(e.getMessage());
View Full Code Here


                {
                    initialize((ECGenParameterSpec)ecParams, random);
                }
                catch (InvalidAlgorithmParameterException e)
                {
                    throw new InvalidParameterException("key size not configurable.");
                }
            }
            else
            {
                throw new InvalidParameterException("unknown key size.");
            }
        }
View Full Code Here

            int             strength,
            SecureRandom    random)
        {
            if (strength < 512 || strength > 1024 || strength % 64 != 0)
            {
                throw new InvalidParameterException("strength must be from 512 - 1024 and a multiple of 64");
            }

            this.strength = strength;
            this.random = random;
        }
View Full Code Here

            engine.init(new KeyGenerationParameters(random, keySize));
            uninitialised = false;
        }
        catch (IllegalArgumentException e)
        {
            throw new InvalidParameterException(e.getMessage());
        }
    }
View Full Code Here

        case Cipher.DECRYPT_MODE:
        case Cipher.UNWRAP_MODE:
            cipher.init(false, param);
            break;
        default:
            throw new InvalidParameterException("unknown opmode " + opmode + " passed to RSA");
        }
    }
View Full Code Here

            int             strength,
            SecureRandom    random)
        {
            if (strength < 512 || strength > 1024 || strength % 64 != 0)
            {
                throw new InvalidParameterException("strength must be from 512 - 1024 and a multiple of 64");
            }

            this.strength = strength;
            this.random = random;
        }
View Full Code Here

        case Cipher.DECRYPT_MODE:
        case Cipher.UNWRAP_MODE:
            cipher.init(false, param);
            break;
        default:
            throw new InvalidParameterException("unknown opmode " + opmode + " passed to ElGamal");
        }
    }
View Full Code Here

           
            if (originalSpec != null)
            {
                if (!JCEDigestUtil.isSameDigest(originalSpec.getDigestAlgorithm(), paramSpec.getDigestAlgorithm()))
                {
                    throw new InvalidParameterException("parameter must be using " + originalSpec.getDigestAlgorithm());
                }
            }
            if (!paramSpec.getMGFAlgorithm().equalsIgnoreCase("MGF1") && !paramSpec.getMGFAlgorithm().equals(PKCSObjectIdentifiers.id_mgf1.getId()))
            {
                throw new InvalidParameterException("unknown mask generation function specified");
            }
           
            if (!(paramSpec.getMGFParameters() instanceof MGF1ParameterSpec))
            {
                throw new InvalidParameterException("unkown MGF parameters");
            }
           
            MGF1ParameterSpec   mgfParams = (MGF1ParameterSpec)paramSpec.getMGFParameters();
           
            if (!JCEDigestUtil.isSameDigest(mgfParams.getDigestAlgorithm(), paramSpec.getDigestAlgorithm()))
            {
                throw new InvalidParameterException("digest algorithm for MGF should be the same as for PSS parameters.");
            }
           
            digest = JCEDigestUtil.getDigest(mgfParams.getDigestAlgorithm());
           
            if (digest == null)
            {
                throw new InvalidParameterException("no match on MGF digest algorithm: "+ mgfParams.getDigestAlgorithm());
            }
           
            this.saltLength = paramSpec.getSaltLength();
            this.trailer = getTrailer(paramSpec.getTrailerField());
        }
        else
        {
            throw new InvalidParameterException("Only PSSParameterSpec supported");
        }
    }
View Full Code Here

      for(byte b : pretty.getBytes())
        bytes[i++] = b;
    }

    if(bytes.length != 4)
      throw new InvalidParameterException("bytes.length != 4");
        return  ((bytes[3] << 0) & 0x000000FF) |
        ((bytes[2] << 8) & 0x0000FF00) |
        ((bytes[1] << 16) & 0x00FF0000) |
        ((bytes[0] << 24) & 0xFF000000);
  }
View Full Code Here

  }

  public static int StringToDWord(String str) {
    byte bytes[] = str.getBytes();
    if(bytes.length != 4)
      throw new InvalidParameterException("bytes.length != 4");
        return  ((bytes[0] << 0) & 0x000000FF) |
        ((bytes[1] << 8) & 0x0000FF00) |
        ((bytes[2] << 16) & 0x00FF0000) |
        ((bytes[3] << 24) & 0xFF000000);
  }
View Full Code Here

TOP

Related Classes of java.security.InvalidParameterException

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.