Examples of InvalidKeyException


Examples of com.adito.security.pki.InvalidKeyException

            // Extract the key information
            ByteArrayReader bar = new ByteArrayReader(encoded);
            String header = bar.readString();

            if (!header.equals(getAlgorithmName())) {
                throw new InvalidKeyException();
            }

            BigInteger e = bar.readBigInteger();
            BigInteger n = bar.readBigInteger();
            rsaKey = new RSAPublicKeySpec(n, e);

            try {
                KeyFactory kf = KeyFactory.getInstance("RSA");
                pubKey = (RSAPublicKey) kf.generatePublic(rsaKey);
            } catch (NoSuchAlgorithmException nsae) {
                throw new InvalidKeyException();
            } catch (InvalidKeySpecException ikpe) {
                throw new InvalidKeyException();
            }
        } catch (IOException ioe) {
            throw new InvalidKeyException();
        }
    }
View Full Code Here

Examples of com.adito.security.pki.InvalidKeyException

            // Read the public key
            String header = bar.readString();

            if (!header.equals(getAlgorithmName())) {
                throw new InvalidKeyException();
            }

            BigInteger e = bar.readBigInteger();
            BigInteger n = bar.readBigInteger();

            // Read the private key
            BigInteger p = bar.readBigInteger();
            RSAPrivateKeySpec prvSpec = new RSAPrivateKeySpec(n, p);
            RSAPublicKeySpec pubSpec = new RSAPublicKeySpec(n, e);
            KeyFactory kf = KeyFactory.getInstance("RSA");
            prvKey = (RSAPrivateKey) kf.generatePrivate(prvSpec);
            pubKey = (RSAPublicKey) kf.generatePublic(pubSpec);
        } catch (Exception e) {
            throw new InvalidKeyException();
        }
    }
View Full Code Here

Examples of com.adito.security.pki.InvalidKeyException

            // Extract the key information
            ByteArrayReader bar = new ByteArrayReader(key);
            String header = bar.readString();

            if (!header.equals(getAlgorithmName())) {
                throw new InvalidKeyException();
            }

            BigInteger p = bar.readBigInteger();
            BigInteger q = bar.readBigInteger();
            BigInteger g = bar.readBigInteger();
            BigInteger y = bar.readBigInteger();
            dsaKey = new DSAPublicKeySpec(y, p, q, g);

            KeyFactory kf = KeyFactory.getInstance("DSA");
           
            pubkey = (DSAPublicKey) kf.generatePublic(dsaKey);
        } catch (Exception e) {
            throw new InvalidKeyException();
        }
    }
View Full Code Here

Examples of com.adito.security.pki.InvalidKeyException

            // Extract the key information
            ByteArrayReader bar = new ByteArrayReader(key);
            String header = bar.readString();

            if (!header.equals(getAlgorithmName())) {
                throw new InvalidKeyException();
            }

            BigInteger p = bar.readBigInteger();
            BigInteger q = bar.readBigInteger();
            BigInteger g = bar.readBigInteger();
            BigInteger x = bar.readBigInteger();
            dsaKey = new DSAPrivateKeySpec(x, p, q, g);

            KeyFactory kf = KeyFactory.getInstance("DSA");
            prvkey = (DSAPrivateKey) kf.generatePrivate(dsaKey);
        } catch (Exception e) {
            throw new InvalidKeyException();
        }
    }
View Full Code Here

Examples of com.persistit.exception.InvalidKeyException

        final Key spareKey2 = exchange.getAuxiliaryKey2();
        spareKey1.copyTo(spareKey2);
        final byte[] baseBytes = spareKey2.getEncodedBytes();
        final int baseSize = spareKey2.getEncodedSize();
        if (baseSize < elisionCount || elisionCount + length > Key.MAX_KEY_LENGTH) {
            throw new InvalidKeyException("Key encoding in transaction is invalid");
        }
        System.arraycopy(bytes, offset, baseBytes, elisionCount, length);
        spareKey2.setEncodedSize(elisionCount + length);
    }
View Full Code Here

Examples of com.totalchange.jizz.services.InvalidKeyException

        logger.trace("Confirming DJ {}'s email address with key {}", dj, key);

        if (key == null || key.length() <= 0) {
            logger.info("Tried to confirm an email address with an empty "
                    + "key {}", key);
            throw new InvalidKeyException(JizzServicesErrors.getString(
                    dj.getLocale(), "confirmEmailNoKey"));
        }

        // Re-fetch the DJ as want to ensure no cheating is going on
        dj = jizzDjDao.getDj(dj.getId());

        // If no email address then what is being validated?
        if (dj.getEmail() == null || dj.getEmail().length() <= 0) {
            if (logger.isInfoEnabled()) {
                logger.info("Tried to confirm an empty email address ("
                        + dj.getEmail() + ") with key " + key + " for DJ " + dj);
            }
            throw new InvalidKeyException(JizzServicesErrors.getString(
                    dj.getLocale(), "confirmEmailNoEmail"));
        }

        // If email is already confirmed then why try again?
        if (dj.getEmailConfirmation() == null) {
            if (logger.isInfoEnabled()) {
                logger.info("Tried to confirm email address (" + dj.getEmail()
                        + ") with key " + key + " for DJ " + dj
                        + ", but DJ's confirm key ("
                        + dj.getEmailConfirmation()
                        + ") is empty so email is already valid(ated)");
            }
            throw new InvalidKeyException(JizzServicesErrors.getString(
                    dj.getLocale(), "confirmEmailAlreadyValidated"));
        }

        // Now compare the keys and make sure they match
        if (!key.equals(dj.getEmailConfirmation())) {
            if (logger.isInfoEnabled()) {
                logger.info("Tried to confirm email address (" + dj.getEmail()
                        + ") with key " + key + " for DJ " + dj
                        + ", but DJ's confirm key ("
                        + dj.getEmailConfirmation()
                        + ") is empty so email is already valid(ated)");
            }
            throw new InvalidKeyException(JizzServicesErrors.getString(
                    dj.getLocale(), "confirmEmailInvalidKey"));
        }

        logger.trace("Looks like the key {} matches that on record of {}, "
                + "recording that email address is confirmed", key,
View Full Code Here

Examples of com.zaranux.client.crypto.InvalidKeyException

        try {
            init(opmode, key, random, null);
        } catch (InvalidAlgorithmParameterException iape) {
            // never thrown when null parameters are used;
            // but re-throw it just in case
            InvalidKeyException ike =
                new InvalidKeyException("Wrong parameters");
            ike.initCause(iape);
            throw ike;
        }
    }
View Full Code Here

Examples of de.danet.an.workflow.api.InvalidKeyException

    public WfResource asResource (Principal principal)
        throws RemoteException, InvalidKeyException {
        try {
            return rms.asResource (principal);
        } catch (ResourceNotFoundException rnf) {
            throw new InvalidKeyException (rnf.getMessage());
        }
    }
View Full Code Here

Examples of java.security.InvalidKeyException

        PublicKey   publicKey)
        throws InvalidKeyException
    {
    if ( !(publicKey instanceof RSAPublicKey) )
    {
      throw new InvalidKeyException("Supplied key is not a RSAPublicKey instance");
    }

        CipherParameters    param = RSAUtil.generatePublicKeyParameter((RSAPublicKey)publicKey);

        digest.reset();
View Full Code Here

Examples of java.security.InvalidKeyException

        PrivateKey  privateKey)
        throws InvalidKeyException
    {
    if ( !(privateKey instanceof RSAPrivateKey) )
    {
      throw new InvalidKeyException("Supplied key is not a RSAPrivateKey instance");
    }

        CipherParameters    param = RSAUtil.generatePrivateKeyParameter((RSAPrivateKey)privateKey);

        digest.reset();
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.