Package com.openshift.client

Examples of com.openshift.client.SSHKeyPair


    IOpenShiftSSHKey key = null;
    try {
      // pre-conditions
      String publicKeyPath = createRandomTempFile().getAbsolutePath();
      String privateKeyPath = createRandomTempFile().getAbsolutePath();
      SSHKeyPair keyPair = SSHKeyPair.create(
          SSHKeyType.SSH_RSA,
          SSHKeyTestUtils.DEFAULT_PASSPHRASE,
          privateKeyPath,
          publicKeyPath);
      String keyName = SSHKeyTestUtils.createRandomKeyName();
View Full Code Here


      SSHKeyTestUtils.createDsaKeyPair(publicKeyPath, privateKeyPath);
      ISSHPublicKey publicKey = new SSHPublicKey(publicKeyPath);
      assertThat(publicKey.getKeyType()).isEqualTo(SSHKeyType.SSH_DSA);
      String keyName = SSHKeyTestUtils.createRandomKeyName();
      key = user.addSSHKey(keyName, publicKey);
      SSHKeyPair keyPair = SSHKeyPair.create(
          SSHKeyType.SSH_RSA, SSHKeyTestUtils.DEFAULT_PASSPHRASE, privateKeyPath, publicKeyPath);

      // operation
      key.setKeyType(SSHKeyType.SSH_RSA, keyPair.getPublicKey());

      // verification
      assertThat(key.getKeyType()).isEqualTo(SSHKeyType.SSH_RSA);
      assertThat(key.getPublicKey()).isEqualTo(keyPair.getPublicKey());
    } finally {
      SSHKeyTestUtils.silentlyDestroyKey(key);
    }
  }
View Full Code Here

  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

    // 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

    // 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

        // 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

        .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

TOP

Related Classes of com.openshift.client.SSHKeyPair

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.