Examples of SSHKeyPair


Examples of com.openshift.client.SSHKeyPair

  public void shouldCreatePublicKey() throws Exception {
    // pre-conditions
    String publicKeyPath = createRandomTempFile().getAbsolutePath();
    String privateKeyPath = createRandomTempFile().getAbsolutePath();
    // operation
    SSHKeyPair sshKey = SSHKeyPair.create(SSHKeyTestUtils.DEFAULT_PASSPHRASE, privateKeyPath, publicKeyPath);
    // verification
    String publicKey = sshKey.getPublicKey();
    assertNotNull(sshKey.getKeyType());
    String keyType = sshKey.getKeyType().getTypeId();
    assertNotNull(publicKey);
    assertThat(publicKey)
        // no identifier
        .doesNotContain(SSHKeyTestUtils.SSH_RSA)
        // no comment
View Full Code Here

Examples of com.openshift.client.SSHKeyPair

    // pre-condition
    String publicKeyPath = createRandomTempFile().getAbsolutePath();
    String privateKeyPath = createRandomTempFile().getAbsolutePath();
    SSHKeyPair.create(SSHKeyTestUtils.DEFAULT_PASSPHRASE, privateKeyPath, publicKeyPath);
    // operation
    SSHKeyPair sshKey = SSHKeyPair.load(privateKeyPath, publicKeyPath);
    // verification
    String publicKey = sshKey.getPublicKey();
    assertNotNull(sshKey.getKeyType());
    String keyType = sshKey.getKeyType().getTypeId();
    assertNotNull(publicKey);
    assertThat(publicKey)
        // no identifier
        .doesNotContain(SSHKeyTestUtils.SSH_RSA)
        // no comment
View Full Code Here

Examples of com.openshift.client.SSHKeyPair

    // pre-conditions
    String publicKeyPath = createRandomTempFile().getAbsolutePath();
    String privateKeyPath = createRandomTempFile().getAbsolutePath();
    SSHKeyTestUtils.createDsaKeyPair(publicKeyPath, privateKeyPath);
    // operation
    SSHKeyPair sshKey = SSHKeyPair.load(privateKeyPath, publicKeyPath);
    // verification
    String publicKey = sshKey.getPublicKey();
    assertNotNull(sshKey.getKeyType());
    String keyType = sshKey.getKeyType().getTypeId();
    assertNotNull(publicKey);
    assertThat(publicKey)
        // no identifier
        .doesNotContain(SSHKeyTestUtils.SSH_DSA)
        // no comment
View Full Code Here

Examples of com.openshift.client.SSHKeyPair

        // no identifier
        .doesNotContain(SSHKeyTestUtils.SSH_RSA)
        // no comment
        .doesNotContain(" ");
    // operation
    SSHKeyPair keyPair = SSHKeyPair.load(privateKeyPath, publicKeyPath);
    assertEquals(publicKey, keyPair.getPublicKey());
    assertEquals(SSHKeyType.SSH_RSA.getTypeId(), keyType);
  }
View Full Code Here

Examples of com.openshift.client.SSHKeyPair

        .doesNotContain(SSHKeyTestUtils.SSH_DSA)
        // no comment
        .doesNotContain(" ");

    // operation
    SSHKeyPair keyPair = SSHKeyPair.load(privateKeyPath, publicKeyPath);
    assertEquals(publicKey, keyPair.getPublicKey());
    assertEquals(SSHKeyType.SSH_DSA.getTypeId(), keyType);
  }
View Full Code Here

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

     * @throws TransportProtocolException
     */
    protected boolean verifyHostKey(byte[] key, byte[] sig, byte[] sigdata)
        throws TransportProtocolException {
        // Determine the public key algorithm and obtain an instance
        SshKeyPair pair = SshKeyPairFactory.newInstance(determineAlgorithm(
                    clientKexInit.getSupportedPublicKeys(),
                    serverKexInit.getSupportedPublicKeys()));

        // Iniialize the public key instance
        pk = pair.setPublicKey(key);

        // We have a valid key so verify it against the allowed hosts
        String host;

        try {
View Full Code Here

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

     * @throws TransportProtocolException
     */
    protected boolean verifyHostKey(byte[] key, byte[] sig, byte[] sigdata)
        throws TransportProtocolException {
        // Determine the public key algorithm and obtain an instance
        SshKeyPair pair = SshKeyPairFactory.newInstance(determineAlgorithm(
                    clientKexInit.getSupportedPublicKeys(),
                    serverKexInit.getSupportedPublicKeys()));

        // Iniialize the public key instance
        pk = pair.setPublicKey(key);

        // We have a valid key so verify it against the allowed hosts
        String host;

        try {
View Full Code Here

Examples of org.jclouds.cloudstack.domain.SshKeyPair

         HttpResponse.builder()
            .statusCode(200)
            .payload(payloadFromResource("/createsshkeypairresponse.json"))
            .build());

      SshKeyPair actual = client.createSSHKeyPair("jclouds-keypair");
      SshKeyPair expected = SshKeyPair.builder().name("jclouds-keypair")
         .fingerprint("1c:06:74:52:3b:99:1c:95:5c:04:c2:f4:ba:77:6e:7b")
         .privateKey("-----BEGIN RSA PRIVATE KEY-----\n" +
            "MIICXgIBAAKBgQDZo/EF4Ew1uEW0raz7vCs28lBwy0UKV2Xr606gaEgxO7h9mSXZ\n" +
            "4x2K/KQ1NMnrbjppxGycLh9EKPWAO3ezFULAyuOZW4Fy+xRS8+3MAijxBJY/KBgl\n" +
            "x5rJm2ILumRkTNkMlLGCSBb9SOqYRN1VpOy7kn3StzU9LdJ/snKVE2JLHQIDAQAB\n" +
            "AoGBAMnL5okKRd9xcsBqYIAxIuiZmNhcwTErhEdRMOAukPGFbDSYsa3rldLvGdpz\n" +
            "jd2LoQG8rO/LHBZ429kASqZzyiV+NvcgH+tFNJSVAigjSICfhEKF9PY2TiAkrg7S\n" +
            "GyJgAjpPWQc2sQh0dE8EPEtBiq4ibXfMTDmbs1d/vnfdwtQJAkEA+AX5Y+xgWj74\n" +
            "dYETmNLyLhNZpftLizEfIYj7lCVhsbFwVb8jbM1m8n8bxwGjls1w/ico1CWcQna+\n" +
            "UnAfA8kJvwJBAOCj0YgDKpYd0OLQhvI3212J9QcQpJEkDOTYiMwXNHCNMKRpoF47\n" +
            "MPPX+GG8YzUiQAi9/OG4pDKCjzQWE/ebiiMCQQCssnQ5WICqtggIwYykr9VDseON\n" +
            "SFIMpHJ5xkjumazRrqx6eDGxc8BH/6uWwRRoT7pqrVeniFyqhsX03u8pkpU/AkBj\n" +
            "WfCcwBHArNUqy2EzlWKuvwogosq16oTNXbs60HR/5uIBhTnJE1K2NemDiGc0I77A\n" +
            "Xw6N4jS0piuhtLYGB8OTAkEA50abdbduXWcr62Z6E8G/6LNFaNg0uBuVgwSHtJMd\n" +
            "dNeUtVDHQCHSf3tvxXTAtaB9PCnGOfgm/dyYWEMf3rMoHQ==\n" +
            "-----END RSA PRIVATE KEY-----\n")
         .build();

      assertEquals(actual, expected);
      assertEquals(SshKeys.fingerprintPrivateKey(actual.getPrivateKey()), expected.getFingerprint());
   }
View Full Code Here

Examples of org.jclouds.cloudstack.domain.SshKeyPair

         HttpResponse.builder()
            .statusCode(200)
            .payload(payloadFromResource("/registersshkeypairresponse.json"))
            .build());

      SshKeyPair actual = client.registerSSHKeyPair("jclouds-keypair", publicKey);
      SshKeyPair expected = SshKeyPair.builder().name("jclouds-keypair")
         .fingerprint(expectedFingerprint).build();

      assertEquals(actual, expected);
      assertEquals(expectedFingerprint, expected.getFingerprint());
   }
View Full Code Here

Examples of org.jclouds.cloudstack.domain.SshKeyPair

   @Test
   public void testLoad() throws UnknownHostException {
      final CloudStackClient client = createMock(CloudStackClient.class);
      SSHKeyPairClient keyClient = createMock(SSHKeyPairClient.class);

      SshKeyPair pair = createMock(SshKeyPair.class);

      expect(client.getSSHKeyPairClient()).andReturn(keyClient);
      expect(keyClient.createSSHKeyPair("group-1")).andReturn(pair);

      replay(client, keyClient);
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.