Package com.sshtools.j2ssh.transport

Examples of com.sshtools.j2ssh.transport.AlgorithmOperationException


            key = SecretKeyFactory.getInstance("DESede").generateSecret(keyspec);
            cipher.init(((mode == ENCRYPT_MODE) ? Cipher.ENCRYPT_MODE
                                                : Cipher.DECRYPT_MODE), key,
                new IvParameterSpec(iv, 0, cipher.getBlockSize()));
        } catch (NoSuchPaddingException nspe) {
            throw new AlgorithmOperationException("Padding not supported");
        } catch (NoSuchAlgorithmException nsae) {
            throw new AlgorithmOperationException("Algorithm not supported");
        } catch (InvalidKeyException ike) {
            throw new AlgorithmOperationException("Invalid encryption key");
        } catch (InvalidKeySpecException ispe) {
            throw new AlgorithmOperationException(
                "Invalid encryption key specification");
        } catch (InvalidAlgorithmParameterException ape) {
            throw new AlgorithmOperationException("Invalid algorithm parameter");
        }
    }
View Full Code Here


            cipher.init(((mode == ENCRYPT_MODE) ? Cipher.ENCRYPT_MODE
                                                : Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv, 0, cipher.getBlockSize()));
        } catch (NoSuchPaddingException nspe) {
            log.error("Blowfish initialization failed", nspe);
            throw new AlgorithmOperationException("No Padding not supported");
        } catch (NoSuchAlgorithmException nsae) {
            log.error("Blowfish initialization failed", nsae);
            throw new AlgorithmOperationException("Algorithm not supported");
        } catch (InvalidKeyException ike) {
            log.error("Blowfish initialization failed", ike);
            throw new AlgorithmOperationException("Invalid encryption key");

            /*} catch (InvalidKeySpecException ispe) {
                 throw new AlgorithmOperationException("Invalid encryption key specification");*/
        } catch (InvalidAlgorithmParameterException ape) {
            log.error("Blowfish initialization failed", ape);
            throw new AlgorithmOperationException("Invalid algorithm parameter");
        }
    }
View Full Code Here

            KeyPair dhKeyPair = dhKeyPairGen.generateKeyPair();
            dhKeyAgreement.init(dhKeyPair.getPrivate());
            x = ((DHPrivateKey) dhKeyPair.getPrivate()).getX();
            e = ((DHPublicKey) dhKeyPair.getPublic()).getY();
        } catch (InvalidKeyException ex) {
            throw new AlgorithmOperationException("Failed to generate DH value");
        } catch (InvalidAlgorithmParameterException ex) {
            throw new AlgorithmOperationException("Failed to generate DH value");
        }

        // Prepare the message
        SshMsgKexDhInit msg = new SshMsgKexDhInit(e);
View Full Code Here

                KeyPair dhKeyPair = dhKeyPairGen.generateKeyPair();
                dhKeyAgreement.init(dhKeyPair.getPrivate());
                y = ((DHPrivateKey) dhKeyPair.getPrivate()).getX();
                f = ((DHPublicKey) dhKeyPair.getPublic()).getY();
            } catch (InvalidKeyException ex) {
                throw new AlgorithmOperationException(
                    "Failed to generate DH y value");
            } catch (InvalidAlgorithmParameterException ex) {
                throw new AlgorithmOperationException(
                    "Failed to generate DH y value");
            }

            // Calculate f
            //f = g.modPow(y, p);
View Full Code Here

            KeyPair dhKeyPair = dhKeyPairGen.generateKeyPair();
            dhKeyAgreement.init(dhKeyPair.getPrivate());
            x = ((DHPrivateKey) dhKeyPair.getPrivate()).getX();
            e = ((DHPublicKey) dhKeyPair.getPublic()).getY();
        } catch (InvalidKeyException ex) {
            throw new AlgorithmOperationException("Failed to generate DH value");
        } catch (InvalidAlgorithmParameterException ex) {
            throw new AlgorithmOperationException("Failed to generate DH value");
        }

        // Prepare the message
        SshMsgKexDhInit msg = new SshMsgKexDhInit(e);
View Full Code Here

                KeyPair dhKeyPair = dhKeyPairGen.generateKeyPair();
                dhKeyAgreement.init(dhKeyPair.getPrivate());
                y = ((DHPrivateKey) dhKeyPair.getPrivate()).getX();
                f = ((DHPublicKey) dhKeyPair.getPublic()).getY();
            } catch (InvalidKeyException ex) {
                throw new AlgorithmOperationException(
                    "Failed to generate DH y value");
            } catch (InvalidAlgorithmParameterException ex) {
                throw new AlgorithmOperationException(
                    "Failed to generate DH y value");
            }

            // Calculate f
            //f = g.modPow(y, p);
View Full Code Here

            cipher.init(((mode == ENCRYPT_MODE) ? Cipher.ENCRYPT_MODE
                                                : Cipher.DECRYPT_MODE),
                keyspec, new IvParameterSpec(iv, 0, cipher.getBlockSize()));
        } catch (NoSuchPaddingException nspe) {
            log.error("Blowfish initialization failed", nspe);
            throw new AlgorithmOperationException("No Padding not supported");
        } catch (NoSuchAlgorithmException nsae) {
            log.error("Blowfish initialization failed", nsae);
            throw new AlgorithmOperationException("Algorithm not supported");
        } catch (InvalidKeyException ike) {
            log.error("Blowfish initialization failed", ike);
            throw new AlgorithmOperationException("Invalid encryption key");

            /*} catch (InvalidKeySpecException ispe) {
                 throw new AlgorithmOperationException("Invalid encryption key specification");*/
        } catch (InvalidAlgorithmParameterException ape) {
            log.error("Blowfish initialization failed", ape);
            throw new AlgorithmOperationException("Invalid algorithm parameter");
        }
    }
View Full Code Here

            key = SecretKeyFactory.getInstance("DESede").generateSecret(keyspec);
            cipher.init(((mode == ENCRYPT_MODE) ? Cipher.ENCRYPT_MODE
                                                : Cipher.DECRYPT_MODE), key,
                new IvParameterSpec(iv, 0, cipher.getBlockSize()));
        } catch (NoSuchPaddingException nspe) {
            throw new AlgorithmOperationException("Padding not supported");
        } catch (NoSuchAlgorithmException nsae) {
            throw new AlgorithmOperationException("Algorithm not supported");
        } catch (InvalidKeyException ike) {
            throw new AlgorithmOperationException("Invalid encryption key");
        } catch (InvalidKeySpecException ispe) {
            throw new AlgorithmOperationException(
                "Invalid encryption key specification");
        } catch (InvalidAlgorithmParameterException ape) {
            throw new AlgorithmOperationException("Invalid algorithm parameter");
        }
    }
View Full Code Here

TOP

Related Classes of com.sshtools.j2ssh.transport.AlgorithmOperationException

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.