Package java.security

Examples of java.security.InvalidKeyException


        signature.update(this.getTBSCertificate());

        if (!signature.verify(this.getSignature()))
        {
            throw new InvalidKeyException("Public key presented not for certificate signature");
        }
    }
View Full Code Here


        signature.update(this.getTBSCertificate());

        if (!signature.verify(this.getSignature()))
        {
            throw new InvalidKeyException("Public key presented not for certificate signature");
        }
    }
View Full Code Here

            return new ECPublicKeyParameters(
                            k.getQ(),
                            new ECDomainParameters(s.getCurve(), s.getG(), s.getN()));
        }

        throw new InvalidKeyException("can't identify EC public key.");
    }
View Full Code Here

            return new ECPrivateKeyParameters(
                            k.getD(),
                            new ECDomainParameters(s.getCurve(), s.getG(), s.getN()));
        }
                       
        throw new InvalidKeyException("can't identify EC private key.");
    }
View Full Code Here

                    param = DSAUtil.generatePublicKeyParameter(publicKey);
                }
                else
                {
                */
                    throw new InvalidKeyException("can't recognise key type in DSA based signer");
                //}
            }
            catch (Exception e)
            {
                throw new InvalidKeyException("can't recognise key type in DSA based signer");
            }
        }

        digest.reset();
        signer.init(false, param);
View Full Code Here

                }
            }
        }
        catch (InvalidKeySpecException e)
        {
            throw new InvalidKeyException("error decoding public key");
        }
    }
View Full Code Here

           
            if (Arrays.equals(passPhrase, DEFAULT_KEY.getBytes())) {
                LOG.warn("Using the default encryption key is not secure");
            }
        } catch (InvalidKeyException e) {
            throw new InvalidKeyException("InvalidKeyException due to invalid passPhrase: " + Arrays.toString(passPhrase));
        } catch (NoSuchAlgorithmException e) {
            throw new NoSuchAlgorithmException("NoSuchAlgorithmException while using algorithm: " + algorithm);
        } catch (InvalidKeySpecException e) {
            throw new InvalidKeySpecException("Invalid Key generated while using passPhrase: " + Arrays.toString(passPhrase));
        }
View Full Code Here

        byte[] pub = null;
        byte[] pri = null;
        try {
            pub = Base64.decode(sfs.get("pub"));
            if (pub.length > curve.modulusSize)
                throw new InvalidKeyException();
            ECPublicKey pubK = getPublicKey(pub, curve);

            pri = Base64.decode(sfs.get("pri"));
            PKCS8EncodedKeySpec ks = new PKCS8EncodedKeySpec(pri);
            KeyFactory kf = KeyFactory.getInstance("EC", curve.kfProvider);
View Full Code Here

  //CPU will result in fewer cache misses.  -- ejhuff 2003-10-12
  static synchronized Object makeKey(byte[] k, int blockSize)
  throws InvalidKeyException {
    if (RDEBUG) trace(IN, "makeKey("+k+", "+blockSize+ ')');
    if (k == null)
      throw new InvalidKeyException("Empty key");
    if (!((k.length == 16) || (k.length == 24) || (k.length == 32)))
      throw new InvalidKeyException("Incorrect key length");
    int ROUNDS = getRounds(k.length, blockSize);
    int BC = blockSize / 4;
    final int BCshift;
    if (BC == 4)
      BCshift = 2;
    else if (BC == 8)
      BCshift = 3;
    else
      /* Note: original code supported block size 192 bits */
      throw new InvalidKeyException("Unsupported block size: "+blockSize);
    int[][] Ke = new int[ROUNDS + 1][BC]; // encryption round keys
    int[][] Kd = new int[ROUNDS + 1][BC]; // decryption round keys
    int ROUND_KEY_COUNT = (ROUNDS + 1) << BCshift;
    int KC = k.length / 4;
    int[] tk = new int[KC];
View Full Code Here

    throws IllegalBlockSizeException, java.security.InvalidKeyException
    {
        byte[] encoded = key.getEncoded();
        if (encoded == null)
        {
            throw new InvalidKeyException("Cannot wrap key, null encoding.");
        }

        try
        {
            return engineDoFinal(encoded, 0, encoded.length);
View Full Code Here

TOP

Related Classes of java.security.InvalidKeyException

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.