Examples of InvalidSshKeyException


Examples of com.sshtools.j2ssh.transport.publickey.InvalidSshKeyException

                baw.writeBigInteger(keyInfo.getModulus());
                baw.writeBigInteger(keyInfo.getPrivateExponent());

                return baw.toByteArray();
            } else {
                throw new InvalidSshKeyException("Unsupported type: " +
                    pem.getType());
            }
        } catch (GeneralSecurityException e) {
            //e.printStackTrace();
            throw new InvalidSshKeyException(
                "Can't read key due to cryptography problems: " + e);
        } catch (IOException e) {
            //e.printStackTrace();
            throw new InvalidSshKeyException(
                "Can't read key due to internal IO problems: " + e);
        }
    }
View Full Code Here

Examples of com.sshtools.j2ssh.transport.publickey.InvalidSshKeyException

                SimpleASNWriter asn = new SimpleASNWriter();
                RSAKeyInfo.writeRSAKeyInfo(asn, keyInfo);
                payload = asn.toByteArray();
                pem.setType(PEM.RSA_PRIVATE_KEY);
            } else {
                throw new InvalidSshKeyException(
                    "Unsupported J2SSH algorithm: " + algorithm);
            }

            pem.setPayload(payload);
            pem.encryptPayload(payload, passphrase);

            StringWriter w = new StringWriter();
            pem.write(w);

            return w.toString().getBytes("US-ASCII");
        } catch (GeneralSecurityException e) {
            //e.printStackTrace();
            throw new InvalidSshKeyException(
                "Can't read key due to cryptography problems: " + e);
        } catch (IOException e) {
            //e.printStackTrace();
            throw new InvalidSshKeyException(
                "Can't read key due to internal IO problems: " + e);
        }
    }
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.