Examples of SshPublicKey


Examples of com.adito.security.pki.SshPublicKey

     
     
      byte[] plainText = text.getBytes();
     
      for(int i=0;i<plainText.length;i+=117) {
        SshPublicKey pk = getPublicKey(username);
       
        Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
       
        cipher.init(Cipher.ENCRYPT_MODE, pk.getPublicKey());
       
        byte[] ctext = cipher.doFinal(plainText, i, (plainText.length - i > 117 ? 117 : plainText.length - i));
     
        String section = new String(Base64.encode(ctext), "US-ASCII");
        cipherText += section + "\n";
View Full Code Here

Examples of com.adito.security.pki.SshPublicKey

   
    String filename = username + ".pub";
   
    if(store.hasEntry(filename)) {
         SshPublicKeyFile f = SshPublicKeyFile.parse(store.getEntryInputStream(filename));
         SshPublicKey pk = f.toPublicKey();
       loadedPublicKeys.put(username, pk);
       return pk;
    }
    else
      throw new IOException("User does not have a key in the repository!");
View Full Code Here

Examples of com.openshift.client.SSHPublicKey

  public void shouldAddKey() throws Exception {
    IOpenShiftSSHKey key = null;
    try {
      // pre-conditions
      String publicKeyPath = SSHKeyTestUtils.createDsaKeyPair();
      ISSHPublicKey publicKey = new SSHPublicKey(publicKeyPath);
      int numOfKeys = user.getSSHKeys().size();

      // operation
      String keyName = SSHKeyTestUtils.createRandomKeyName();
      key = user.addSSHKey(keyName, publicKey);

      // verifications
      assertThat(
          new SSHPublicKeyAssertion(key))
          .hasName(keyName)
          .hasPublicKey(publicKey.getPublicKey())
          .isType(publicKey.getKeyType());
      List<IOpenShiftSSHKey> keys = user.getSSHKeys();
      assertThat(keys.size()).isEqualTo(numOfKeys + 1);
      IOpenShiftSSHKey keyInList = SSHKeyTestUtils.getKey(keyName, keys);
      assertThat(key).isEqualTo(keyInList);
    } finally {
View Full Code Here

Examples of com.openshift.client.SSHPublicKey

  public void shouldNotAddKeyTwice() throws Exception {
    IOpenShiftSSHKey key = null;
    try {
      // pre-conditions
      String keyName = SSHKeyTestUtils.createRandomKeyName();
      ISSHPublicKey publicKey = new SSHPublicKey(SSHKeyTestUtils.createDsaKeyPair());
      key = user.addSSHKey(keyName, publicKey);
     
      // operation
      key = user.addSSHKey(keyName, publicKey);
View Full Code Here

Examples of com.openshift.client.SSHPublicKey

  public void shouldNotPutKeyTwice() throws Exception {
    IOpenShiftSSHKey key = null;
    try {
      // pre-conditions
      String keyName = SSHKeyTestUtils.createRandomKeyName();
      ISSHPublicKey publicKey = new SSHPublicKey(SSHKeyTestUtils.createDsaKeyPair());
      key = user.putSSHKey(keyName, publicKey);
     
      // operation
      key = user.putSSHKey(keyName, publicKey);
View Full Code Here

Examples of com.openshift.client.SSHPublicKey

  public void shouldReturnKeyForName() throws Exception {
    IOpenShiftSSHKey key = null;
    try {
      // pre-conditions
      String publicKeyPath = SSHKeyTestUtils.createDsaKeyPair();
      ISSHPublicKey publicKey = new SSHPublicKey(publicKeyPath);

      // operation
      String keyName = SSHKeyTestUtils.createRandomKeyName();
      key = user.addSSHKey(keyName, publicKey);
      IOpenShiftSSHKey keyByName = user.getSSHKeyByName(keyName);
View Full Code Here

Examples of com.openshift.client.SSHPublicKey

  public void shouldReturnKeyForPublicKey() throws Exception {
    IOpenShiftSSHKey key = null;
    try {
      // pre-conditions
      String publicKeyPath = SSHKeyTestUtils.createDsaKeyPair();
      ISSHPublicKey publicKey = new SSHPublicKey(publicKeyPath);

      // operation
      String keyName = SSHKeyTestUtils.createRandomKeyName();
      key = user.addSSHKey(keyName, publicKey);
      IOpenShiftSSHKey keyByPublicKey = user.getSSHKeyByPublicKey(publicKey.getPublicKey());

      // verifications
      assertThat(key).isEqualTo(keyByPublicKey);
    } finally {
      SSHKeyTestUtils.silentlyDestroyKey(key);
View Full Code Here

Examples of com.openshift.client.SSHPublicKey

    try {
      // pre-conditions
      String publicKeyPath = createRandomTempFile().getAbsolutePath();
      String privateKeyPath = createRandomTempFile().getAbsolutePath();
      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);
View Full Code Here

Examples of com.openshift.client.SSHPublicKey

    IOpenShiftSSHKey key = null;
    try {
      // pre-conditions
      String publicKeyPath = SSHKeyTestUtils.createDsaKeyPair();
      String keyName = SSHKeyTestUtils.createRandomKeyName();
      key = user.addSSHKey(keyName, new SSHPublicKey(publicKeyPath));
     
      // operation
      key.destroy();
      key = null;
     
View Full Code Here

Examples of com.openshift.client.SSHPublicKey

    IOpenShiftSSHKey key = null;
    try {
      // pre-conditions
      String publicKeyPath = SSHKeyTestUtils.createDsaKeyPair();
      String keyName = SSHKeyTestUtils.createRandomKeyName();
      key = user.addSSHKey(keyName, new SSHPublicKey(publicKeyPath));
      int numOfKeys = user.getSSHKeys().size();
     
      // operation
      user.deleteKey(keyName);
     
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.