Package org.xulfactory.gliese.algo

Examples of org.xulfactory.gliese.algo.SSHRSAPublicKey.encode()


        UserAuthRequestMessage msg = (UserAuthRequestMessage)arg;
        assertTrue(msg.getAuthenticationData() instanceof PublicKeyMethodData);
        assertEquals("publickey", msg.getMethod());
        PublicKeyMethodData md = (PublicKeyMethodData)msg.getAuthenticationData();
        assertEquals("ssh-rsa", md.getAlgorithm());
        assertArrayEquals(pkey.encode(), md.getPubkey());
        return true;
      }
    }));
    assertFalse("Authentication should not succeed", res.isSuccess());   
  }
View Full Code Here


    final SSHPublicKey pkey = new SSHRSAPublicKey(
        ((RSAPublicKey)kp.getPublic()).getModulus(),
        ((RSAPublicKey)kp.getPublic()).getPublicExponent());
    UserAuthPublicKeyOk uapkok = new UserAuthPublicKeyOk();
    uapkok.setAlgorithm("ssh-rsa");
    uapkok.setPubkey(pkey.encode());
    UserAuthSuccessMessage uasm = new UserAuthSuccessMessage();
    when(transport.readMessage("publickey")).thenReturn(uapkok).thenReturn(uasm);
    when(transport.getSessionId()).thenReturn(new byte[20]);
    // When
    AuthenticationResult res = authMgr.authenticate("user", pkey, signature);
View Full Code Here

        UserAuthRequestMessage msg = (UserAuthRequestMessage)arg;
        assertTrue(msg.getAuthenticationData() instanceof PublicKeyMethodData);
        assertEquals("publickey", msg.getMethod());
        PublicKeyMethodData md = (PublicKeyMethodData)msg.getAuthenticationData();
        assertEquals("ssh-rsa", md.getAlgorithm());
        assertArrayEquals(pkey.encode(), md.getPubkey());
        assertNotNull(md.getSignature());
        try {
          Signature verify = Signature.getInstance("SHA1withRSA");
          verify.initVerify(publickey);
          ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

          Utils.encodeString(out, "user");
          Utils.encodeString(out, "ssh-connection");
          Utils.encodeString(out, "publickey");
          Utils.encodeBoolean(out, true);
          Utils.encodeString(out, "ssh-rsa");
          Utils.encodeBytes(out, pkey.encode());
          verify.update(out.toByteArray());
          assertTrue("Signature should be verified", verify.verify(md.getSignature()));
        } catch (InvalidKeyException ike) {
          fail(ike.getMessage());
        } catch (NoSuchAlgorithmException nsae) {
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.