当前位置: 首页>>代码示例>>Java>>正文


Java Cipher类代码示例

本文整理汇总了Java中org.apache.sshd.common.cipher.Cipher的典型用法代码示例。如果您正苦于以下问题:Java Cipher类的具体用法?Java Cipher怎么用?Java Cipher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Cipher类属于org.apache.sshd.common.cipher包,在下文中一共展示了Cipher类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runClient

import org.apache.sshd.common.cipher.Cipher; //导入依赖的package包/类
@SuppressWarnings("checkstyle:nestedtrydepth")
protected void runClient(String msg) throws Exception {
    try (SshClient client = setupTestClient()) {
        PropertyResolverUtils.updateProperty(client, FactoryManager.MAX_PACKET_SIZE, 1024 * 16);
        PropertyResolverUtils.updateProperty(client, FactoryManager.WINDOW_SIZE, 1024 * 8);
        client.setKeyExchangeFactories(Arrays.asList(
                ClientBuilder.DH2KEX.transform(BuiltinDHFactories.dhg1)));
        client.setCipherFactories(Arrays.<NamedFactory<Cipher>>asList(BuiltinCiphers.blowfishcbc));
        client.start();
        try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
            session.addPasswordIdentity(getCurrentTestName());
            session.auth().verify(5L, TimeUnit.SECONDS);

            try (ByteArrayOutputStream out = new ByteArrayOutputStream();
                 ByteArrayOutputStream err = new ByteArrayOutputStream();
                 ClientChannel channel = session.createChannel(Channel.CHANNEL_SHELL)) {
                channel.setOut(out);
                channel.setErr(err);

                try {
                    channel.open().verify(9L, TimeUnit.SECONDS);
                    try (OutputStream pipedIn = channel.getInvertedIn()) {
                        msg += "\nexit\n";
                        pipedIn.write(msg.getBytes(StandardCharsets.UTF_8));
                        pipedIn.flush();
                    }

                    Collection<ClientChannelEvent> result =
                            channel.waitFor(EnumSet.of(ClientChannelEvent.CLOSED), TimeUnit.SECONDS.toMillis(15L));
                    assertFalse("Timeout while waiting for channel closure", result.contains(ClientChannelEvent.TIMEOUT));
                } finally {
                    channel.close(false);
                }

                assertArrayEquals("Mismatched message data", msg.getBytes(StandardCharsets.UTF_8), out.toByteArray());
            }
        } finally {
            client.stop();
        }
    }
}
 
开发者ID:termd,项目名称:termd,代码行数:42,代码来源:LoadTest.java

示例2: getCipherFactories

import org.apache.sshd.common.cipher.Cipher; //导入依赖的package包/类
@Override
public List<NamedFactory<Cipher>> getCipherFactories() {
    throw new RuntimeException("Not implemented");
}
 
开发者ID:NLeSC,项目名称:Xenon,代码行数:5,代码来源:MockClientSession.java

示例3: setCipherFactories

import org.apache.sshd.common.cipher.Cipher; //导入依赖的package包/类
@Override
public void setCipherFactories(List<NamedFactory<Cipher>> cipherFactories) {
    throw new RuntimeException("Not implemented");

}
 
开发者ID:NLeSC,项目名称:Xenon,代码行数:6,代码来源:MockClientSession.java


注:本文中的org.apache.sshd.common.cipher.Cipher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。