public String getFingerprint() throws SshException { return keyPair.getFingerPrint(); }
currentSSHUsername + "@forIsisFish"); if (log.isInfoEnabled()) { log.info("Finger print: " + kpair.getFingerPrint());
kpair.writePublicKey(publicKeyFile.getAbsolutePath(), vcsLogin + "@forIsisFish"); if (log.isInfoEnabled()) { log.info("Finger print: "+kpair.getFingerPrint());
/** * This could take a while. */ public DeployKey create() { log.debug("creating keypair ..."); try { ByteArrayOutputStream privBaos = new ByteArrayOutputStream(); ByteArrayOutputStream pubBaos = new ByteArrayOutputStream(); KeyPair keypair = KeyPair.genKeyPair(new JSch(), type, size); keypair.writePrivateKey(privBaos, null); keypair.writePublicKey(pubBaos, comment); return DeployKey.builder().id(UUID.randomUUID().toString()).publicKey(new String(pubBaos.toByteArray())) .privateKey(new String(privBaos.toByteArray())).fingerprint(keypair.getFingerPrint()).build(); } catch (Exception e) { throw new RuntimeException("Unable to create DeployKey", e); } finally { log.debug("keypair created"); } }
public static void generateKeyPair(com.att.cdp.zones.model.KeyPair kp) throws IOException, JSchException, ZoneException { KeyPair kpair; kpair = KeyPair.genKeyPair(new JSch(), KeyPair.RSA); // String publicKeyFilename = PUBLIC_KEY; // String privateKeyFilename = PRIVATE_KEY; OutputStream os = new ByteArrayOutputStream(); kpair.writePrivateKey(os); String str=""; try { str = reformatSSHKey(os.toString()); } catch (Exception e) { LOG.error(e.getMessage()); } kp.setPrivateKey(str); os = new ByteArrayOutputStream(); kpair.writePublicKey(os, ""); kp.setPublicKey(os.toString()); kpair.getFingerPrint(); kpair.dispose(); }
System.out.println("Finger print: " + kpair.getFingerPrint()); kpair.dispose(); sshKey = new KeyPairFiles(priv, pub);
@Override public KeyPair generateKeyPair(GenerateKeyPairContext context) { checkNotNull(context, "context"); int algorithm = (Algorithm.DSA.equals(context.getAlgorithm())) ? DSA : RSA; JSch jsch = new JSch(); com.jcraft.jsch.KeyPair keyPair = getKeyPair(jsch, algorithm, context.getSize()); String publicKey = getPublicKey(keyPair, context.getName()).trim(); String privateKey = getPrivateKey(keyPair); String fingerprint = keyPair.getFingerPrint(); return KeyPair.builder(context.getName()).withPublicKey(publicKey).withPrivateKey(privateKey).withFingerprint(fingerprint).build(); }