Examples of KeyGenException


Examples of org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.security.KeyGenException

                                                      String keyName)
            throws DisabledException, KeyGenException {
        try {
            return this.newKey(this.container.getOwnerID(caller), keyName);
        } catch (IOException e) {
            throw new KeyGenException(e.getMessage(), e);
        } catch (CannotTranslateException e) {
            throw new KeyGenException(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.security.KeyGenException

        final JSch jsch=new JSch();
        final KeyPair kpair;
        try {
            kpair = KeyPair.genKeyPair(jsch, this.keyType, this.keySize);
        } catch (JSchException e) {
            throw new KeyGenException(e.getMessage(), e);
        }

        final String generatedFingerprint = kpair.getFingerPrint();
        if (generatedFingerprint == null) {
            throw new KeyGenException("fingerprint is missing");
        }
        final String[] parts = generatedFingerprint.split(" ");
        if (parts.length != 2) {
            throw new KeyGenException("fingerprint not in expected " +
                    "format: '" + generatedFingerprint + "'");
        }

        final String fingerprint = parts[1];
        if (fingerprint == null || fingerprint.trim().length() == 0) {
            throw new KeyGenException("fingerprint not in expected " +
                    "format: '" + generatedFingerprint + "'");
        }
       
        final StringOutputStream pubsos = new StringOutputStream();
        final StringOutputStream privsos = new StringOutputStream();

        kpair.writePublicKey(pubsos, "clouduser-" + ownerID);
        kpair.writePrivateKey(privsos);

        final String pubKeyString = pubsos.toString();
        if (pubKeyString == null || pubKeyString.trim().length() == 0) {
            throw new KeyGenException("generated pubkey is missing");
        }

        final String privKeyString = privsos.toString();
        if (privKeyString == null || privKeyString.trim().length() == 0) {
            throw new KeyGenException("generated privkey is missing");
        }

        // register it before returning
        this.sshKeys.newKey(ownerID, keyName, pubKeyString, fingerprint);
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.