├── j2ssh-maverick
├── .gitignore
├── .project
├── templates
│ └── GPL-3.txt
├── README
├── src
│ └── main
│ │ └── java
│ │ ├── com
│ │ └── sshtools
│ │ │ ├── logging
│ │ │ ├── LoggerLevel.java
│ │ │ ├── Logger.java
│ │ │ ├── NoLogger.java
│ │ │ ├── LoggerFactory.java
│ │ │ └── SimpleLogger.java
│ │ │ ├── ssh
│ │ │ ├── message
│ │ │ │ ├── Message.java
│ │ │ │ ├── MessageObserver.java
│ │ │ │ ├── MessageStore.java
│ │ │ │ ├── MessageHolder.java
│ │ │ │ ├── SshMessageReader.java
│ │ │ │ ├── SshMessage.java
│ │ │ │ ├── SshChannelMessage.java
│ │ │ │ └── SshAbstractChannel.java
│ │ │ ├── components
│ │ │ │ ├── jce
│ │ │ │ │ ├── AbstractKeyExchange.java
│ │ │ │ │ ├── AbstractPublicKey.java
│ │ │ │ │ ├── DiffieHellmanEcdhNistp256.java
│ │ │ │ │ ├── DiffieHellmanEcdhNistp384.java
│ │ │ │ │ ├── DiffieHellmanEcdhNistp521.java
│ │ │ │ │ ├── AES128Ctr.java
│ │ │ │ │ ├── AES192Ctr.java
│ │ │ │ │ ├── AES256Ctr.java
│ │ │ │ │ ├── Ssh2EcdsaSha2Nist256PublicKey.java
│ │ │ │ │ ├── Ssh2EcdsaSha2Nist384PublicKey.java
│ │ │ │ │ ├── Ssh2EcdsaSha2Nist521PublicKey.java
│ │ │ │ │ ├── MD5Digest.java
│ │ │ │ │ ├── HmacMD5.java
│ │ │ │ │ ├── SHA1Digest.java
│ │ │ │ │ ├── SHA384Digest.java
│ │ │ │ │ ├── SHA512Digest.java
│ │ │ │ │ ├── HmacMD596.java
│ │ │ │ │ ├── SHA256Digest.java
│ │ │ │ │ ├── package.html
│ │ │ │ │ ├── AES128Cbc.java
│ │ │ │ │ ├── AES192Cbc.java
│ │ │ │ │ ├── AES256Cbc.java
│ │ │ │ │ ├── TripleDesCbc.java
│ │ │ │ │ ├── TripleDesCtr.java
│ │ │ │ │ ├── DiffieHellmanGroupExchangeSha256.java
│ │ │ │ │ ├── BlowfishCbc.java
│ │ │ │ │ ├── HmacSha512.java
│ │ │ │ │ ├── SecureRND.java
│ │ │ │ │ ├── HmacSha1.java
│ │ │ │ │ ├── HmacSha196.java
│ │ │ │ │ ├── HmacSha256.java
│ │ │ │ │ ├── ArcFour.java
│ │ │ │ │ ├── ArcFour128.java
│ │ │ │ │ ├── ArcFour256.java
│ │ │ │ │ └── AbstractDigest.java
│ │ │ │ ├── SshKeyExchange.java
│ │ │ │ ├── SshDsaPublicKey.java
│ │ │ │ ├── SshSecureRandomGenerator.java
│ │ │ │ ├── SshRsaPrivateKey.java
│ │ │ │ ├── SshRsaPublicKey.java
│ │ │ │ ├── SshPrivateKey.java
│ │ │ │ ├── package.html
│ │ │ │ ├── SshDsaPrivateKey.java
│ │ │ │ ├── SshRsaPrivateCrtKey.java
│ │ │ │ ├── SshHmac.java
│ │ │ │ ├── NoneHmac.java
│ │ │ │ ├── SshKeyPair.java
│ │ │ │ ├── Digest.java
│ │ │ │ └── SshPublicKey.java
│ │ │ ├── Client.java
│ │ │ ├── compression
│ │ │ │ ├── package.html
│ │ │ │ └── SshCompression.java
│ │ │ ├── package.html
│ │ │ ├── SocketTimeoutSupport.java
│ │ │ ├── SshIOException.java
│ │ │ ├── SshIO.java
│ │ │ ├── ChannelOpenException.java
│ │ │ ├── Packet.java
│ │ │ ├── SshAuthentication.java
│ │ │ ├── SshChannel.java
│ │ │ ├── CommandExecutor.java
│ │ │ └── SshTransport.java
│ │ │ ├── ssh2
│ │ │ ├── MaverickCallbackHandler.java
│ │ │ ├── TransportProtocolListener.java
│ │ │ ├── package.html
│ │ │ ├── KBIRequestHandler.java
│ │ │ ├── SignatureGenerator.java
│ │ │ ├── GlobalRequestHandler.java
│ │ │ ├── GlobalRequest.java
│ │ │ ├── KBIPrompt.java
│ │ │ ├── AuthenticationResult.java
│ │ │ ├── ChannelFactory.java
│ │ │ ├── BannerDisplay.java
│ │ │ └── AuthenticationClient.java
│ │ │ ├── zlib
│ │ │ └── OpenSSHZLibCompression.java
│ │ │ ├── util
│ │ │ ├── package.html
│ │ │ ├── EOLProcessorOutputStream.java
│ │ │ ├── SimpleASNWriter.java
│ │ │ ├── EOLProcessorInputStream.java
│ │ │ └── SimpleASNReader.java
│ │ │ ├── sftp
│ │ │ ├── package.html
│ │ │ ├── TransferCancelledException.java
│ │ │ ├── SftpMessage.java
│ │ │ ├── ACL.java
│ │ │ ├── RegularExpressionMatching.java
│ │ │ ├── NoRegExpMatching.java
│ │ │ └── FileTransferProgress.java
│ │ │ ├── net
│ │ │ ├── package.html
│ │ │ ├── HttpRequest.java
│ │ │ ├── SocketWrapper.java
│ │ │ └── SocketTransport.java
│ │ │ ├── publickey
│ │ │ ├── package.html
│ │ │ ├── InvalidPassphraseException.java
│ │ │ ├── PublicKeySubsystemException.java
│ │ │ ├── SshPublicKeyFile.java
│ │ │ └── SECSHPublicKeyFile.java
│ │ │ ├── events
│ │ │ ├── EventListener.java
│ │ │ ├── EventService.java
│ │ │ ├── J2SSHEventMessages.java
│ │ │ └── EventObject.java
│ │ │ └── scp
│ │ │ └── package.html
│ │ └── socks
│ │ ├── AuthenticationNone.java
│ │ ├── SocketWrappedChannel.java
│ │ ├── server
│ │ └── UserValidation.java
│ │ ├── UDPEncapsulation.java
│ │ └── Authentication.java
└── .classpath
└── README.md
/j2ssh-maverick/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /.settings/
3 | /.metadata/
4 | /RemoteSystemsTempFiles/
5 |
--------------------------------------------------------------------------------
/j2ssh-maverick/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | j2ssh-maverick
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.m2e.core.maven2Nature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/j2ssh-maverick/templates/GPL-3.txt:
--------------------------------------------------------------------------------
1 | Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
2 |
3 | For product documentation visit https://www.sshtools.com/
4 |
5 | This file is part of ${project.name}.
6 |
7 | ${project.name} is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU Lesser General Public License as published by
9 | the Free Software Foundation, either version 3 of the License, or
10 | (at your option) any later version.
11 |
12 | ${project.name} is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with ${project.name}. If not, see .
--------------------------------------------------------------------------------
/j2ssh-maverick/README:
--------------------------------------------------------------------------------
1 | Introduction
2 | ------------
3 |
4 | J2SSH Maverick is the successor to the original J2SSH API and includes a complete and stable implementation of an SSH2 client. Originally built from the ground up by the original author back in 2003, this product has, until now, only been available under a commercial license. With the development and pending release of a third generation SSH API, this legacy API has now been released under the GPLv3 and will continue to be maintained by the core author as a contribution to the open source community.
5 |
6 | Getting Started
7 | ---------------
8 |
9 | You need to include the core j2ssh-maverick-${version}.jar from this archives dist folder, along with any dependency jar files found in the lib folder.
10 |
11 | Check out the examples folder for a number of useful working examples.
12 |
13 | Support
14 | -------
15 |
16 | The author does not guarantee to provide timely support for this project. Please post your question on stack overflow with 'j2ssh' tag.
17 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/logging/LoggerLevel.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.logging;
22 |
23 | public enum LoggerLevel {
24 | ERROR, INFO, DEBUG
25 | }
26 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/message/Message.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.message;
22 |
23 | public interface Message {
24 |
25 | public int getMessageId();
26 | }
27 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/AbstractKeyExchange.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | public interface AbstractKeyExchange {
24 | public String getProvider();
25 | }
26 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/AbstractPublicKey.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | public interface AbstractPublicKey {
24 | public String getProvider();
25 | }
26 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/message/MessageObserver.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.message;
22 |
23 | public interface MessageObserver {
24 |
25 | public boolean wantsNotification(Message msg);
26 | }
27 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/message/MessageStore.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.message;
22 |
23 | public interface MessageStore {
24 |
25 | public Message hasMessage(MessageObserver observer);
26 | }
27 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/Client.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh;
22 |
23 | import java.io.IOException;
24 |
25 | public interface Client {
26 |
27 | public void exit() throws SshException, IOException;
28 | }
29 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/message/MessageHolder.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.message;
22 |
23 | public class MessageHolder {
24 |
25 | public Message msg = null;
26 |
27 | public MessageHolder() {
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh2/MaverickCallbackHandler.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh2;
22 |
23 | public interface MaverickCallbackHandler {
24 | public void setUser(String uname);
25 |
26 | public void setPassword(String pword);
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/j2ssh-maverick/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/zlib/OpenSSHZLibCompression.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.zlib;
22 |
23 | public class OpenSSHZLibCompression extends ZLibCompression {
24 |
25 | public String getAlgorithm() {
26 | return "zlib@openssh.com";
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh2/TransportProtocolListener.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh2;
22 |
23 | public interface TransportProtocolListener {
24 |
25 | public void onDisconnect(String msg, int reason);
26 |
27 | public void onIdle(long lastActivity);
28 | }
29 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/SshKeyExchange.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components;
22 |
23 | /**
24 | * Base interface for SSH2 key exchange implementations.
25 | *
26 | * @author Lee David Painter
27 | *
28 | */
29 | public interface SshKeyExchange {
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/DiffieHellmanEcdhNistp256.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | public class DiffieHellmanEcdhNistp256 extends DiffieHellmanEcdh {
24 |
25 | public DiffieHellmanEcdhNistp256() {
26 | super("ecdh-sha2-nistp256", "secp256r1", "SHA-256");
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/DiffieHellmanEcdhNistp384.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | public class DiffieHellmanEcdhNistp384 extends DiffieHellmanEcdh {
24 |
25 | public DiffieHellmanEcdhNistp384() {
26 | super("ecdh-sha2-nistp384", "secp384r1", "SHA-384");
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/DiffieHellmanEcdhNistp521.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | public class DiffieHellmanEcdhNistp521 extends DiffieHellmanEcdh {
24 |
25 | public DiffieHellmanEcdhNistp521() {
26 | super("ecdh-sha2-nistp521", "secp521r1", "SHA-512");
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/logging/Logger.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.logging;
22 |
23 | public interface Logger {
24 |
25 | boolean isLevelEnabled(LoggerLevel level);
26 |
27 | void log(LoggerLevel level, Object source, String msg);
28 |
29 | void log(LoggerLevel level, Object source, String msg, Throwable t);
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/AES128Ctr.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.io.IOException;
24 |
25 | public class AES128Ctr extends AbstractJCECipher {
26 |
27 | public AES128Ctr() throws IOException {
28 | super(JCEAlgorithms.JCE_AESCTRNOPADDING, "AES", 16, "aes128-ctr");
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/message/SshMessageReader.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.message;
22 |
23 | import com.sshtools.ssh.SshException;
24 |
25 | /**
26 | * @author Lee David Painter
27 | */
28 | public interface SshMessageReader {
29 | public byte[] nextMessage() throws SshException;
30 |
31 | public boolean isConnected();
32 | }
33 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/AES192Ctr.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.io.IOException;
24 |
25 | public class AES192Ctr extends AbstractJCECipher {
26 |
27 | public AES192Ctr() throws IOException {
28 | super(JCEAlgorithms.JCE_AESCTRNOPADDING, "AES", 24, "aes192-ctr");
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/AES256Ctr.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.io.IOException;
24 |
25 | public class AES256Ctr extends AbstractJCECipher {
26 |
27 | public AES256Ctr() throws IOException {
28 | super(JCEAlgorithms.JCE_AESCTRNOPADDING, "AES", 32, "aes256-ctr");
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/util/package.html:
--------------------------------------------------------------------------------
1 |
23 |
24 |
25 |
26 |
30 |
31 |
32 |
A set of SSHTools utility classes.
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/Ssh2EcdsaSha2Nist256PublicKey.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 |
24 | public class Ssh2EcdsaSha2Nist256PublicKey extends Ssh2EcdsaSha2NistPublicKey {
25 |
26 | public Ssh2EcdsaSha2Nist256PublicKey() {
27 | super("ecdsa-sha2-nistp256", "SHA256withECDSA", "secp256r1");
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/Ssh2EcdsaSha2Nist384PublicKey.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 |
24 | public class Ssh2EcdsaSha2Nist384PublicKey extends Ssh2EcdsaSha2NistPublicKey {
25 |
26 | public Ssh2EcdsaSha2Nist384PublicKey() {
27 | super("ecdsa-sha2-nistp384", "SHA384withECDSA", "secp384r1");
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/Ssh2EcdsaSha2Nist521PublicKey.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 |
24 | public class Ssh2EcdsaSha2Nist521PublicKey extends Ssh2EcdsaSha2NistPublicKey {
25 |
26 | public Ssh2EcdsaSha2Nist521PublicKey() {
27 | super("ecdsa-sha2-nistp521", "SHA512withECDSA", "secp521r1");
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/sftp/package.html:
--------------------------------------------------------------------------------
1 |
23 |
24 |
25 |
26 |
30 |
31 |
32 |
The base implementation of the SFTP protocol.
33 |
Compression interface for the SSH Transport Protocol.
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/logging/NoLogger.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.logging;
22 |
23 | public class NoLogger implements Logger {
24 |
25 | public boolean isLevelEnabled(LoggerLevel level) {
26 | return false;
27 | }
28 |
29 | public void log(LoggerLevel level, Object source, String msg) {
30 |
31 | }
32 |
33 | public void log(LoggerLevel level, Object source, String msg, Throwable t) {
34 |
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/MD5Digest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.security.NoSuchAlgorithmException;
24 |
25 | /**
26 | * MD5 digest implementation.
27 | *
28 | * @author Lee David Painter
29 | *
30 | */
31 | public class MD5Digest extends AbstractDigest {
32 |
33 | public MD5Digest() throws NoSuchAlgorithmException {
34 | super(JCEAlgorithms.JCE_MD5);
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/HmacMD5.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | /**
24 | * MD5 message authentication implementation.
25 | *
26 | * @author Lee David Painter
27 | *
28 | */
29 | public class HmacMD5 extends AbstractHmac {
30 |
31 | public HmacMD5() {
32 | super(JCEAlgorithms.JCE_HMACMD5, 16);
33 | }
34 |
35 | public String getAlgorithm() {
36 | return "hmac-md5";
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/SHA1Digest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.security.NoSuchAlgorithmException;
24 |
25 | /**
26 | * SHA-1 digest implementation.
27 | *
28 | * @author Lee David Painter
29 | *
30 | */
31 | public class SHA1Digest extends AbstractDigest {
32 |
33 | public SHA1Digest() throws NoSuchAlgorithmException {
34 | super(JCEAlgorithms.JCE_SHA1);
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/SHA384Digest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.security.NoSuchAlgorithmException;
24 |
25 | /**
26 | * SHA-1 digest implementation.
27 | * @author Lee David Painter
28 | *
29 | */
30 | public class SHA384Digest extends AbstractDigest {
31 |
32 | public SHA384Digest() throws NoSuchAlgorithmException {
33 | super(JCEAlgorithms.JCE_SHA384);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/SHA512Digest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.security.NoSuchAlgorithmException;
24 |
25 | /**
26 | * SHA-1 digest implementation.
27 | * @author Lee David Painter
28 | *
29 | */
30 | public class SHA512Digest extends AbstractDigest {
31 |
32 | public SHA512Digest() throws NoSuchAlgorithmException {
33 | super(JCEAlgorithms.JCE_SHA512);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/HmacMD596.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | /**
24 | * MD5 message authentication implementation.
25 | *
26 | * @author Lee David Painter
27 | *
28 | */
29 | public class HmacMD596 extends AbstractHmac {
30 |
31 | public HmacMD596() {
32 | super(JCEAlgorithms.JCE_HMACMD5, 16, 12);
33 | }
34 |
35 | public String getAlgorithm() {
36 | return "hmac-md5";
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/SHA256Digest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.security.NoSuchAlgorithmException;
24 |
25 | /**
26 | * SHA-1 digest implementation.
27 | *
28 | * @author Lee David Painter
29 | *
30 | */
31 | public class SHA256Digest extends AbstractDigest {
32 |
33 | public SHA256Digest() throws NoSuchAlgorithmException {
34 | super(JCEAlgorithms.JCE_SHA256);
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/package.html:
--------------------------------------------------------------------------------
1 |
23 |
24 |
25 |
26 |
30 |
31 |
32 |
This package contains a set of algoritm implementations that enable the Maverick API
33 | to use a Java Cryptography Extension provider.
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/AES128Cbc.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.io.IOException;
24 |
25 | /**
26 | * An implementation of the AES 128 bit cipher using a JCE provider.
27 | *
28 | * @author Lee David Painter
29 | */
30 | public class AES128Cbc extends AbstractJCECipher {
31 |
32 | public AES128Cbc() throws IOException {
33 | super(JCEAlgorithms.JCE_AESCBCNOPADDING, "AES", 16, "aes128-cbc");
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/AES192Cbc.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.io.IOException;
24 |
25 | /**
26 | * An implementation of the AES 128 bit cipher using a JCE provider.
27 | *
28 | * @author Lee David Painter
29 | */
30 | public class AES192Cbc extends AbstractJCECipher {
31 |
32 | public AES192Cbc() throws IOException {
33 | super(JCEAlgorithms.JCE_AESCBCNOPADDING, "AES", 24, "aes192-cbc");
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/AES256Cbc.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.io.IOException;
24 |
25 | /**
26 | * An implementation of the AES 128 bit cipher using a JCE provider.
27 | *
28 | * @author Lee David Painter
29 | */
30 | public class AES256Cbc extends AbstractJCECipher {
31 |
32 | public AES256Cbc() throws IOException {
33 | super(JCEAlgorithms.JCE_AESCBCNOPADDING, "AES", 32, "aes256-cbc");
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/TripleDesCbc.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.io.IOException;
24 |
25 | /**
26 | * An implementation of the 3DES cipher using a JCE provider.
27 | *
28 | * @author Lee David Painter
29 | */
30 | public class TripleDesCbc extends AbstractJCECipher {
31 |
32 | public TripleDesCbc() throws IOException {
33 | super(JCEAlgorithms.JCE_3DESCBCNOPADDING, "DESede", 24, "3des-cbc");
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/TripleDesCtr.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.io.IOException;
24 |
25 | /**
26 | * An implementation of the 3DES cipher using a JCE provider.
27 | *
28 | * @author Lee David Painter
29 | */
30 | public class TripleDesCtr extends AbstractJCECipher {
31 |
32 | public TripleDesCtr() throws IOException {
33 | super(JCEAlgorithms.JCE_3DESCTRNOPADDING, "DESede", 24, "3des-ctr");
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh2/package.html:
--------------------------------------------------------------------------------
1 |
23 |
24 |
25 |
26 |
30 |
31 |
32 |
This package contains an SSH2 implementation of the
33 | com.sshtools.ssh interfaces.
34 |
This package contains utility classes for loading/storing public/private keys
33 | and is based on the SSHTools key format architecture.
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/events/EventListener.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.events;
22 |
23 | /**
24 | * Interface to be implemented by classes interested in receiving events.
25 | *
26 | * Listeners should be registered by using
27 | * EventService#addListener(EventListener).
28 | */
29 | public interface EventListener {
30 |
31 | /**
32 | * Invoked when an event occurs.
33 | *
34 | * @param evt
35 | * event
36 | */
37 | public void processEvent(Event evt);
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/SshDsaPublicKey.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components;
22 |
23 | import java.math.BigInteger;
24 |
25 | /**
26 | * This interface should be implemented by all DSA public key implementations.
27 | *
28 | * @author Lee David Painter
29 | *
30 | */
31 | public interface SshDsaPublicKey extends SshPublicKey {
32 | public BigInteger getP();
33 |
34 | public BigInteger getQ();
35 |
36 | public BigInteger getG();
37 |
38 | public BigInteger getY();
39 | }
40 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/sftp/TransferCancelledException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.sftp;
22 |
23 | /**
24 | *
25 | * Exception thrown when a file transfer is cancelled.
26 | *
27 | *
28 | * @author Lee David Painter
29 | */
30 | public class TransferCancelledException extends Exception {
31 |
32 | private static final long serialVersionUID = 1L;
33 |
34 | /**
35 | * Creates a new TransferCancelledException object.
36 | */
37 | public TransferCancelledException() {
38 | super();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/scp/package.html:
--------------------------------------------------------------------------------
1 |
23 |
24 |
25 |
26 |
30 |
31 |
32 |
33 | This package contains a Secure Copy (SCP) engine suitable for the
34 | lightweight J2SSH Maverick API. This implementation has no
35 | dependencies on files making it suitable for all JAVA platforms.
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/SshSecureRandomGenerator.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components;
22 |
23 | import com.sshtools.ssh.SshException;
24 |
25 | /**
26 | * This interface should be implemented by all secure random number generator
27 | * implementations.
28 | *
29 | * @author Lee David Painter
30 | *
31 | */
32 | public interface SshSecureRandomGenerator {
33 |
34 | void nextBytes(byte[] bytes);
35 |
36 | void nextBytes(byte[] bytes, int off, int len) throws SshException;
37 |
38 | int nextInt();
39 | }
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/DiffieHellmanGroupExchangeSha256.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | public class DiffieHellmanGroupExchangeSha256 extends
24 | DiffieHellmanGroupExchangeSha1 {
25 |
26 | public static final String DIFFIE_HELLMAN_GROUP_EXCHANGE_SHA256 = "diffie-hellman-group-exchange-sha256";
27 |
28 | public DiffieHellmanGroupExchangeSha256() {
29 | super("SHA-256");
30 | }
31 |
32 | public String getAlgorithm() {
33 | return DIFFIE_HELLMAN_GROUP_EXCHANGE_SHA256;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/SshRsaPrivateKey.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components;
22 |
23 | import java.io.IOException;
24 | import java.math.BigInteger;
25 |
26 | /**
27 | * This interface should be implemented by all RSA private key implementations.
28 | *
29 | * @author Lee David Painter
30 | */
31 | public interface SshRsaPrivateKey extends SshPrivateKey {
32 |
33 | public abstract BigInteger getModulus();
34 |
35 | public abstract BigInteger getPrivateExponent();
36 |
37 | public abstract byte[] sign(byte[] msg) throws IOException;
38 |
39 | }
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/SshRsaPublicKey.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components;
22 |
23 | import java.math.BigInteger;
24 |
25 | import com.sshtools.ssh.SshException;
26 |
27 | /**
28 | * This interface should be implemented by all RSA public key implementations.
29 | *
30 | * @author Lee David Painter
31 | */
32 | public interface SshRsaPublicKey extends SshPublicKey {
33 | BigInteger getModulus();
34 |
35 | BigInteger getPublicExponent();
36 |
37 | int getVersion();
38 |
39 | public BigInteger doPublic(BigInteger input) throws SshException;
40 | }
41 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/BlowfishCbc.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.io.IOException;
24 |
25 | /**
26 | * An implementation of the Blowfish cipher using a JCE provider. If you have
27 | * enabled JCE usage there is no need to configure this separately.
28 | *
29 | * @author Lee David Painter
30 | */
31 | public class BlowfishCbc extends AbstractJCECipher {
32 |
33 | public BlowfishCbc() throws IOException {
34 | super(JCEAlgorithms.JCE_BLOWFISHCBCNOPADDING, "Blowfish", 16,
35 | "blowfish-cbc");
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/SshPrivateKey.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components;
22 |
23 | import java.io.IOException;
24 |
25 | import com.sshtools.ssh.SshException;
26 |
27 | /**
28 | * Interface for SSH supported private keys.
29 | *
30 | * @author Lee David Painter
31 | */
32 | public interface SshPrivateKey {
33 |
34 | /**
35 | * Create a signature from the data.
36 | *
37 | * @param data
38 | * @return byte[]
39 | * @throws SshException
40 | */
41 | public byte[] sign(byte[] data) throws IOException;
42 |
43 | public String getAlgorithm();
44 | }
45 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/package.html:
--------------------------------------------------------------------------------
1 |
23 |
24 |
25 |
26 |
30 |
31 |
32 |
This package contains an abstract cryptographic provider for the SSH protocol. No actual
33 | provider is implemented here, this is simply a set of interfaces that require a concrete
34 | implementation to perform the actual cryptographic functions.
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpMessage.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.sftp;
22 |
23 | import java.io.IOException;
24 |
25 | import com.sshtools.ssh.message.Message;
26 | import com.sshtools.util.ByteArrayReader;
27 |
28 | public class SftpMessage extends ByteArrayReader implements Message {
29 |
30 | int type;
31 | int requestId;
32 |
33 | SftpMessage(byte[] msg) throws IOException {
34 | super(msg);
35 | type = read();
36 | requestId = (int) readInt();
37 | }
38 |
39 | public int getType() {
40 | return type;
41 | }
42 |
43 | public int getMessageId() {
44 | return requestId;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/logging/LoggerFactory.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.logging;
22 |
23 | public class LoggerFactory {
24 |
25 | static Logger logger = new NoLogger();
26 |
27 | static boolean enabled = false;
28 |
29 | public static void setInstance(Logger logger) {
30 | LoggerFactory.logger = logger;
31 | enabled = true;
32 | }
33 |
34 | public static Logger getInstance() {
35 | return logger;
36 | }
37 |
38 | public static boolean isEnabled() {
39 | return enabled;
40 | }
41 |
42 | public static void enable() {
43 | enabled = true;
44 | }
45 |
46 | public static void disable() {
47 | enabled = false;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/publickey/InvalidPassphraseException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.publickey;
22 |
23 | /**
24 | *
25 | *
26 | * Thrown by an {@link SshPrivateKeyFile} when it detects that the passphrase
27 | * supplied was invalid.
28 | *
29 | *
30 | * @author Lee David Painter
31 | */
32 | public class InvalidPassphraseException extends Exception {
33 |
34 | private static final long serialVersionUID = 1L;
35 |
36 | public InvalidPassphraseException() {
37 | super("The passphrase supplied was invalid!");
38 | }
39 |
40 | public InvalidPassphraseException(Exception ex) {
41 | super(ex.getMessage());
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/package.html:
--------------------------------------------------------------------------------
1 |
23 |
24 |
25 |
26 |
30 |
31 |
32 |
This package contains a set of general interface contracts for SSH communication.
33 | To connect to an SSH server you need to use SshConnector to get a reference to an
34 | SshClient. Once a client instance is obtained you can proceed to authenticate
35 | the user and start a session.
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/SshDsaPrivateKey.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components;
22 |
23 | import java.io.IOException;
24 | import java.math.BigInteger;
25 |
26 | /**
27 | * This interface should be implemented by all DSA private key implementations.
28 | *
29 | * @author Lee David Painter
30 | *
31 | */
32 | public interface SshDsaPrivateKey extends SshPrivateKey {
33 |
34 | public abstract BigInteger getX();
35 |
36 | /*
37 | * (non-Javadoc)
38 | *
39 | * @see com.sshtools.ssh.SshPrivateKey#sign(byte[])
40 | */
41 | public abstract byte[] sign(byte[] msg) throws IOException;
42 |
43 | public SshDsaPublicKey getPublicKey();
44 |
45 | }
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/net/HttpRequest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.net;
22 |
23 | import com.sshtools.util.Base64;
24 |
25 | /**
26 | * Utility class to process HTTP requests.
27 | *
28 | * @author Lee David Painter
29 | *
30 | */
31 | public class HttpRequest extends HttpHeader {
32 |
33 | public HttpRequest() {
34 | super();
35 | }
36 |
37 | public void setHeaderBegin(String begin) {
38 | this.begin = begin;
39 | }
40 |
41 | public void setBasicAuthentication(String username, String password) {
42 | String str = username + ":" + password;
43 | setHeaderField("Proxy-Authorization",
44 | "Basic " + Base64.encodeBytes(str.getBytes(), true));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/logging/SimpleLogger.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.logging;
22 |
23 | public class SimpleLogger implements Logger {
24 |
25 | LoggerLevel level;
26 |
27 | public SimpleLogger(LoggerLevel level) {
28 | this.level = level;
29 | }
30 |
31 | public boolean isLevelEnabled(LoggerLevel level) {
32 | return this.level.ordinal() >= level.ordinal();
33 | }
34 |
35 | public void log(LoggerLevel level, Object source, String msg) {
36 | System.out.println(level.toString() + ": " + msg);
37 | }
38 |
39 | public void log(LoggerLevel level, Object source, String msg, Throwable t) {
40 | System.out.println(level.toString() + ": " + msg);
41 | t.printStackTrace();
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/socks/AuthenticationNone.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | /**
22 | * This file is originally from the http://sourceforge.net/projects/jsocks/
23 | * released under the LGPL.
24 | */
25 | package socks;
26 |
27 | /**
28 | SOCKS5 none authentication. Dummy class does almost nothing.
29 | */
30 | public class AuthenticationNone implements Authentication{
31 |
32 | public Object[] doSocksAuthentication(int methodId,
33 | java.net.Socket proxySocket)
34 | throws java.io.IOException{
35 |
36 | if(methodId!=0) return null;
37 |
38 | return new Object[] { proxySocket.getInputStream(),
39 | proxySocket.getOutputStream()};
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/SocketTimeoutSupport.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh;
22 |
23 | import java.io.IOException;
24 |
25 | /**
26 | *
27 | * This interface adds timeout support to the {@see SocketTransport} interface.
28 | *
29 | *
30 | * @author Lee David Painter
31 | */
32 | public interface SocketTimeoutSupport {
33 |
34 | /**
35 | * Set the socket timeout in milliseconds.
36 | *
37 | * @param timeout
38 | * int
39 | * @throws IOException
40 | */
41 | public void setSoTimeout(int timeout) throws IOException;
42 |
43 | /**
44 | * Get the current socket timeout in milliseconds.
45 | *
46 | * @return int
47 | * @throws IOException
48 | */
49 | public int getSoTimeout() throws IOException;
50 | }
51 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/message/SshMessage.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.message;
22 |
23 | import com.sshtools.util.ByteArrayReader;
24 |
25 | /**
26 | *
27 | * @author Lee David Painter
28 | */
29 | public class SshMessage extends ByteArrayReader implements Message {
30 |
31 | int messageid;
32 | byte[] msg;
33 | SshMessage next;
34 | SshMessage previous;
35 |
36 | // Private constrcutor for Linked List
37 | SshMessage() {
38 | super(new byte[] {});
39 | }
40 |
41 | public SshMessage(byte[] msg, int off, int len) {
42 | super(msg, off, len);
43 | }
44 |
45 | public SshMessage(byte[] msg) {
46 | super(msg);
47 | this.messageid = read();
48 | }
49 |
50 | public int getMessageId() {
51 | return messageid;
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/SshRsaPrivateCrtKey.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components;
22 |
23 | import java.math.BigInteger;
24 |
25 | import com.sshtools.ssh.SshException;
26 |
27 | /**
28 | * This interface should be implemented by all RSA private co-efficient private
29 | * key implementations.
30 | *
31 | * @author Lee David Painter
32 | */
33 | public interface SshRsaPrivateCrtKey extends SshRsaPrivateKey {
34 |
35 | public BigInteger getPublicExponent();
36 |
37 | public BigInteger getPrimeP();
38 |
39 | public BigInteger getPrimeQ();
40 |
41 | public BigInteger getPrimeExponentP();
42 |
43 | public BigInteger getPrimeExponentQ();
44 |
45 | public BigInteger getCrtCoefficient();
46 |
47 | BigInteger doPrivate(BigInteger input) throws SshException;
48 | }
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/SshHmac.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components;
22 |
23 | import com.sshtools.ssh.SshException;
24 |
25 | /**
26 | * This interface should be implemented by all message authentication
27 | * implementations.
28 | *
29 | * @author Lee David Painter
30 | *
31 | */
32 | public interface SshHmac {
33 |
34 | public int getMacLength();
35 |
36 | public void generate(long sequenceNo, byte[] data, int offset, int len,
37 | byte[] output, int start);
38 |
39 | public void init(byte[] keydata) throws SshException;
40 |
41 | public boolean verify(long sequenceNo, byte[] data, int start, int len,
42 | byte[] mac, int offset);
43 |
44 | public void update(byte[] b);
45 |
46 | public byte[] doFinal();
47 |
48 | public String getAlgorithm();
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/NoneHmac.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components;
22 |
23 | import com.sshtools.ssh.SshException;
24 |
25 | public class NoneHmac implements SshHmac {
26 |
27 | public int getMacLength() {
28 | return 0;
29 | }
30 |
31 | public void generate(long sequenceNo, byte[] data, int offset, int len,
32 | byte[] output, int start) {
33 | }
34 |
35 | public void init(byte[] keydata) throws SshException {
36 | }
37 |
38 | public boolean verify(long sequenceNo, byte[] data, int start, int len,
39 | byte[] mac, int offset) {
40 | return true;
41 | }
42 |
43 | public void update(byte[] b) {
44 | }
45 |
46 | public byte[] doFinal() {
47 |
48 | return new byte[0];
49 | }
50 |
51 | public String getAlgorithm() {
52 | return "none";
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/util/EOLProcessorOutputStream.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.util;
22 |
23 | import java.io.IOException;
24 | import java.io.OutputStream;
25 |
26 | class EOLProcessorOutputStream extends OutputStream {
27 |
28 | EOLProcessor processor;
29 |
30 | public EOLProcessorOutputStream(int inputStyle, int outputStyle,
31 | OutputStream out) throws IOException {
32 | processor = new EOLProcessor(inputStyle, outputStyle, out);
33 | }
34 |
35 | public void write(byte[] buf, int off, int len) throws IOException {
36 | processor.processBytes(buf, off, len);
37 | }
38 |
39 | public void write(int b) throws IOException {
40 | processor.processBytes(new byte[] { (byte) b }, 0, 1);
41 | }
42 |
43 | public void close() throws IOException {
44 | processor.close();
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/message/SshChannelMessage.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.message;
22 |
23 | import java.io.IOException;
24 |
25 | import com.sshtools.ssh.SshException;
26 |
27 | /**
28 | * @author Lee David Painter
29 | */
30 | public class SshChannelMessage extends SshMessage {
31 |
32 | int channelid;
33 |
34 | public SshChannelMessage(int channelid, byte[] msg, int off, int len)
35 | throws SshException {
36 | super(msg, off, len);
37 | this.channelid = channelid;
38 | }
39 |
40 | public SshChannelMessage(byte[] msg) throws SshException {
41 | super(msg);
42 | try {
43 | this.channelid = (int) readInt();
44 | } catch (IOException ex) {
45 | throw new SshException(SshException.INTERNAL_ERROR, ex);
46 | }
47 | }
48 |
49 | int getChannelId() {
50 | return channelid;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/socks/SocketWrappedChannel.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | /**
22 | * This file is originally from the http://sourceforge.net/projects/jsocks/
23 | * released under the LGPL.
24 | */
25 | package socks;
26 |
27 | import java.io.IOException;
28 | import java.io.InputStream;
29 | import java.io.OutputStream;
30 | import java.net.Socket;
31 |
32 | import com.sshtools.ssh.SshChannel;
33 |
34 | public class SocketWrappedChannel extends Socket {
35 |
36 | SshChannel channel;
37 | SocketWrappedChannel(SshChannel channel) {
38 | this.channel = channel;
39 | }
40 |
41 | public InputStream getInputStream() throws IOException {
42 | return channel.getInputStream();
43 | }
44 |
45 | public OutputStream getOutputStream() throws IOException {
46 | return channel.getOutputStream();
47 | }
48 |
49 | public void close() throws IOException {
50 | channel.close();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/SshIOException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh;
22 |
23 | import java.io.IOException;
24 |
25 | /**
26 | * This class is provided so that when a channel InputStream/OutputStream
27 | * interface has to throw an IOException; the real SshException cause can be
28 | * retrieved.
29 | *
30 | * @author Lee David Painter
31 | */
32 | public class SshIOException extends IOException {
33 |
34 | private static final long serialVersionUID = 1L;
35 | SshException realEx;
36 |
37 | /**
38 | * Construct the exception with the real exception.
39 | *
40 | * @param realEx
41 | */
42 | public SshIOException(SshException realEx) {
43 | this.realEx = realEx;
44 | }
45 |
46 | /**
47 | * Get the real exception
48 | *
49 | * @return SshException
50 | */
51 | public SshException getRealException() {
52 | return realEx;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/sftp/ACL.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.sftp;
22 |
23 | /**
24 | * Version 4 of the SFTP protocol introduces an ACL field in the
25 | * {@link SftpFileAttributes} structure.
26 | *
27 | * @author Lee David Painter
28 | */
29 | public class ACL {
30 |
31 | public static final int ACL_ALLOWED_TYPE = 1;
32 | public static final int ACL_DENIED_TYPE = 1;
33 | public static final int ACL_AUDIT_TYPE = 1;
34 | public static final int ACL_ALARM_TYPE = 1;
35 |
36 | int type;
37 | int flags;
38 | int mask;
39 | String who;
40 |
41 | public ACL(int type, int flags, int mask, String who) {
42 | }
43 |
44 | public int getType() {
45 | return type;
46 | }
47 |
48 | public int getFlags() {
49 | return flags;
50 | }
51 |
52 | public int getMask() {
53 | return mask;
54 | }
55 |
56 | public String getWho() {
57 | return who;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh2/KBIRequestHandler.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh2;
22 |
23 | /**
24 | *
25 | * Callback interface used by the KBIAuthentication authentication mechanism.
27 | *
28 | * @author $author$
29 | */
30 | public interface KBIRequestHandler {
31 | /**
32 | * Called by the keyboard-interactive authentication mechanism when
33 | * the server requests information from the user. Each prompt should be
34 | * displayed to the user with their response recorded within the prompt
35 | * object.
36 | *
37 | * @param name
38 | * @param instruction
39 | * @param prompts
40 | * @return true if the user entered the prompts, or false
41 | * if the user cancelled the authentication attempt.
42 | */
43 | public boolean showPrompts(String name, String instruction,
44 | KBIPrompt[] prompts);
45 | }
46 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh2/SignatureGenerator.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh2;
22 |
23 | import java.io.IOException;
24 |
25 | import com.sshtools.ssh.SshException;
26 | import com.sshtools.ssh.components.SshPublicKey;
27 |
28 | /**
29 | * Provides a callback when a private key signature is required. This is
30 | * suitable for use when you do not have direct access to the private key, but
31 | * know its public key and have access to some mechanism that enables you to
32 | * request a signature from the corresponding private key (such as an ssh
33 | * agent).
34 | *
35 | * @author $Author: david $
36 | */
37 | public interface SignatureGenerator {
38 |
39 | /**
40 | * Sign the data using the private key of the public key provided.
41 | *
42 | * @param key
43 | * @param data
44 | * @return byte[]
45 | * @throws IOException
46 | */
47 | public byte[] sign(SshPublicKey key, byte[] data) throws SshException;
48 | }
49 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/SshIO.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh;
22 |
23 | import java.io.IOException;
24 | import java.io.InputStream;
25 | import java.io.OutputStream;
26 |
27 | /**
28 | *
29 | * Base interface for all SSH related IO interfaces.
30 | *
31 | *
32 | * @author Lee David Painter
33 | */
34 | public interface SshIO {
35 |
36 | /**
37 | * Get an InputStream to read incoming channel data.
38 | *
39 | * @return the channels InputStream
40 | * @throws IOException
41 | */
42 | public InputStream getInputStream() throws IOException;
43 |
44 | /**
45 | * Get an OutputStream to write outgoing channel data.
46 | *
47 | * @return the channels OutputStream
48 | * @throws IOException
49 | */
50 | public OutputStream getOutputStream() throws IOException;
51 |
52 | /**
53 | * Close the channel.
54 | *
55 | * @throws SshIOException
56 | */
57 | public void close() throws IOException;
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/publickey/PublicKeySubsystemException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.publickey;
22 |
23 | /**
24 | * Exception thrown by the {@link PublicKeySubsystem} when errors occur in
25 | * listing, adding or removing keys.
26 | *
27 | * @author Lee David Painter
28 | */
29 | public class PublicKeySubsystemException extends Exception {
30 |
31 | private static final long serialVersionUID = 1L;
32 | static final int SUCCESS = 0;
33 | public static final int ACCESS_DENIED = 1;
34 | public static final int STORAGE_EXCEEDED = 2;
35 | public static final int REQUEST_NOT_SUPPPORTED = 3;
36 | public static final int KEY_NOT_FOUND = 4;
37 | public static final int KEY_NOT_SUPPORTED = 5;
38 | public static final int GENERAL_FAILURE = 6;
39 |
40 | int status;
41 |
42 | public PublicKeySubsystemException(int status, String desc) {
43 | super(desc);
44 | this.status = status;
45 | }
46 |
47 | public int getStatus() {
48 | return status;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/publickey/SshPublicKeyFile.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.publickey;
22 |
23 | import java.io.IOException;
24 |
25 | import com.sshtools.ssh.components.SshPublicKey;
26 |
27 | /**
28 | * Interface which all public key formats must implement to provide decoding of
29 | * the public key into a suitable format for the API.
30 | *
31 | * @author Lee David Painter
32 | */
33 | public interface SshPublicKeyFile {
34 |
35 | /**
36 | * Convert the key file into a usable SshPublicKey.
38 | *
39 | * @return SshPublicKey
40 | * @throws IOException
41 | */
42 | public SshPublicKey toPublicKey() throws IOException;
43 |
44 | /**
45 | * Get the comment applied to the key file.
46 | *
47 | * @return String
48 | */
49 | public String getComment();
50 |
51 | /**
52 | * Get the formatted key.
53 | *
54 | * @return byte[]
55 | * @throws IOException
56 | */
57 | public byte[] getFormattedKey() throws IOException;
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh2/GlobalRequestHandler.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh2;
22 |
23 | import java.io.IOException;
24 |
25 | import com.sshtools.ssh.SshException;
26 |
27 | /**
28 | *
29 | * There are several kinds of requests that affect the state of the remote end
30 | * "globally", independent of any channels, this interface defines the contract
31 | * for handling such global requests.
32 | *
33 | *
34 | * @author Lee David Painter
35 | */
36 | public interface GlobalRequestHandler {
37 |
38 | /**
39 | * Return the supported request types.
40 | *
41 | * @return an array of Strings containing the supported request types.
42 | */
43 | public String[] supportedRequests();
44 |
45 | /**
46 | * Called when a supported global request has been recieved.
47 | *
48 | * @param request
49 | * @return true if the request succeeded, otherwise
50 | * false
51 | * @throws IOException
52 | */
53 | public boolean processGlobalRequest(GlobalRequest request)
54 | throws SshException;
55 | }
56 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/socks/server/UserValidation.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | /**
22 | * This file is originally from the http://sourceforge.net/projects/jsocks/
23 | * released under the LGPL.
24 | */
25 | package socks.server;
26 |
27 | /**
28 | Interface which provides for user validation, based on user name
29 | password and where it connects from.
30 | */
31 | public interface UserValidation{
32 | /**
33 | Implementations of this interface are expected to use some or all
34 | of the information provided plus any information they can extract
35 | from other sources to decide wether given user should be allowed
36 | access to SOCKS server, or whatever you use it for.
37 |
38 | @return true to indicate user is valid, false otherwise.
39 | @param username User whom implementation should validate.
40 | @param password Password this user provided.
41 | @param connection Socket which user used to connect to the server.
42 | */
43 | boolean isUserValid(String username,String password,
44 | java.net.Socket connection);
45 | }
46 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/ChannelOpenException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh;
22 |
23 | /**
24 | * Exception thrown when a channel cannot be opened, the reason for which should
25 | * be specified in with any of the constants defined here.
26 | *
27 | * @author Lee David Painter
28 | */
29 | public class ChannelOpenException extends Exception {
30 |
31 | private static final long serialVersionUID = 1L;
32 |
33 | /** The administrator does not permit this channel to be opened **/
34 | public static final int ADMINISTRATIVIVELY_PROHIBITED = 1;
35 |
36 | /** The connection could not be established **/
37 | public static final int CONNECT_FAILED = 2;
38 |
39 | /** The channel type is unknown **/
40 | public static final int UNKNOWN_CHANNEL_TYPE = 3;
41 |
42 | /** There are no more resources available to open the channel **/
43 | public static final int RESOURCE_SHORTAGE = 4;
44 |
45 | int reason;
46 |
47 | public ChannelOpenException(String msg, int reason) {
48 | super(msg);
49 | this.reason = reason;
50 | }
51 |
52 | public int getReason() {
53 | return reason;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/sftp/RegularExpressionMatching.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.sftp;
22 |
23 | import java.io.File;
24 |
25 | import com.sshtools.ssh.SshException;
26 |
27 | /**
28 | * Interface for treating a filename as a regular expression and returning the
29 | * list of files that match.
30 | *
31 | * @author David Hodgins
32 | */
33 | public interface RegularExpressionMatching {
34 |
35 | /**
36 | * returns each of the SftpFiles that match the pattern fileNameRegExp
37 | *
38 | * @param files
39 | * @param fileNameRegExp
40 | * @return SftpFile[]
41 | * @throws SftpStatusException
42 | * @throws SshException
43 | */
44 | public SftpFile[] matchFilesWithPattern(SftpFile[] files,
45 | String fileNameRegExp) throws SftpStatusException, SshException;
46 |
47 | /**
48 | * returns each of the files that match the pattern fileNameRegExp
49 | *
50 | * @param files
51 | * @param fileNameRegExp
52 | * @return String[]
53 | * @throws SftpStatusException
54 | * @throws SshException
55 | */
56 | public String[] matchFileNamesWithPattern(File[] files,
57 | String fileNameRegExp) throws SftpStatusException, SshException;
58 |
59 | }
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/Packet.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh;
22 |
23 | import java.io.IOException;
24 |
25 | import com.sshtools.util.ByteArrayWriter;
26 |
27 | /**
28 | * A utility class that provides the SSH layers with the ability to dynamically
29 | * write an SSH packet.
30 | *
31 | * @author Lee David Painter
32 | */
33 | public class Packet extends ByteArrayWriter {
34 |
35 | int markedPosition = -1;
36 |
37 | public Packet() throws IOException {
38 | this(35000);
39 | }
40 |
41 | public Packet(int size) throws IOException {
42 | super(size + 4);
43 |
44 | // Save some space for the length field
45 | writeInt(0);
46 | }
47 |
48 | public int setPosition(int pos) {
49 | int count = this.count;
50 | this.count = pos;
51 | return count;
52 | }
53 |
54 | public int position() {
55 | return count;
56 | }
57 |
58 | public void finish() {
59 |
60 | buf[0] = (byte) (count - 4 >> 24);
61 | buf[1] = (byte) (count - 4 >> 16);
62 | buf[2] = (byte) (count - 4 >> 8);
63 | buf[3] = (byte) (count - 4);
64 |
65 | }
66 |
67 | public void reset() {
68 |
69 | super.reset();
70 | try {
71 | writeInt(0);
72 | } catch (IOException ex) {
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/sftp/NoRegExpMatching.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.sftp;
22 |
23 | import java.io.File;
24 |
25 | import com.sshtools.ssh.SshException;
26 |
27 | /**
28 | * Implements the RegularExpressionMatching Interface.
29 | * Performs no regular expression matching so:
30 | * matchFilesWithPattern() simply returns the files parameter it is passed as an
31 | * argument
32 | * matchFileNamesWithPattern() simply returns a 1 element array containing the
33 | * filename on the first element of the file[] argument passed to it.
34 | */
35 | public class NoRegExpMatching implements RegularExpressionMatching {
36 |
37 | /**
38 | * opens and returns the requested filename string
39 | *
40 | * @throws SftpStatusException
41 | */
42 | public String[] matchFileNamesWithPattern(File[] files,
43 | String fileNameRegExp) throws SshException, SftpStatusException {
44 | String[] thefile = new String[1];
45 | thefile[0] = files[0].getName();
46 | return thefile;
47 | }
48 |
49 | /**
50 | * returns files
51 | */
52 | public SftpFile[] matchFilesWithPattern(SftpFile[] files,
53 | String fileNameRegExp) throws SftpStatusException, SshException {
54 | return files;
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/events/EventService.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.events;
22 |
23 | /**
24 | * Interface to be implemented by an event service implementation.
25 | */
26 | public interface EventService {
27 |
28 | /**
29 | * Add a MaverickListener to the list of objects that will be sent
30 | * MaverickEvents.
31 | *
32 | * @param listener
33 | * listener to add
34 | */
35 | public void addListener(EventListener listener);
36 |
37 | /**
38 | * Add a MaverickListener to the list of objects that will be sent
39 | * MaverickEvents.
40 | *
41 | * @param listener
42 | * listener to add
43 | */
44 | public void addListener(String threadPrefix, EventListener listener);
45 |
46 | /**
47 | * Remove a MaverickListener from the list of objects that will be sent
48 | * MaverickEventss.
49 | *
50 | * @param listener
51 | * listener to remove
52 | */
53 | public void removeListener(String threadPrefix);
54 |
55 | /**
56 | * Fire a MaverickEvent at all MaverickListeners that have registered an
57 | * interest in events.
58 | *
59 | * @param evt
60 | * event to fire to all listener
61 | */
62 | public void fireEvent(Event evt);
63 | }
64 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/HmacSha512.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import javax.crypto.Mac;
24 | import javax.crypto.spec.SecretKeySpec;
25 |
26 | import com.sshtools.ssh.SshException;
27 |
28 | /**
29 | * SHA-1 message authentication implementation.
30 | *
31 | * @author Lee David Painter
32 | *
33 | */
34 | public class HmacSha512 extends AbstractHmac {
35 |
36 | public HmacSha512() {
37 | super(JCEAlgorithms.JCE_HMACSHA512, 64);
38 | }
39 |
40 | public String getAlgorithm() {
41 | return "hmac-sha2-512";
42 | }
43 |
44 | public void init(byte[] keydata) throws SshException {
45 | try {
46 | mac = JCEProvider.getProviderForAlgorithm(jceAlgorithm)==null ? Mac.getInstance(jceAlgorithm) : Mac.getInstance(jceAlgorithm, JCEProvider.getProviderForAlgorithm(jceAlgorithm));
47 |
48 | // Create a key of 16 bytes
49 | byte[] key = new byte[64];
50 | System.arraycopy(keydata, 0, key, 0, key.length);
51 |
52 | SecretKeySpec keyspec = new SecretKeySpec(key, jceAlgorithm);
53 | mac.init(keyspec);
54 | } catch (Throwable t) {
55 | throw new SshException(t);
56 | }
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/SecureRND.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import java.security.NoSuchAlgorithmException;
24 | import java.security.SecureRandom;
25 |
26 | import com.sshtools.ssh.SshException;
27 | import com.sshtools.ssh.components.SshSecureRandomGenerator;
28 |
29 | /**
30 | * Secure random number generator implementation for JCE provider.
31 | */
32 | public class SecureRND implements SshSecureRandomGenerator {
33 |
34 | SecureRandom rnd;
35 |
36 | public SecureRND() throws NoSuchAlgorithmException {
37 | rnd = JCEProvider.getSecureRandom();
38 | }
39 |
40 | public void nextBytes(byte[] bytes) {
41 | rnd.nextBytes(bytes);
42 | }
43 |
44 | public void nextBytes(byte[] bytes, int off, int len) throws SshException {
45 |
46 | try {
47 | byte[] tmp = new byte[len];
48 | rnd.nextBytes(tmp);
49 | System.arraycopy(tmp, 0, bytes, off, len);
50 | } catch (ArrayIndexOutOfBoundsException ex) {
51 | throw new SshException("ArrayIndexOutOfBoundsException: Index "
52 | + off + " on actual array length " + bytes.length
53 | + " with len=" + len, SshException.INTERNAL_ERROR);
54 | }
55 | }
56 |
57 | public int nextInt() {
58 | return rnd.nextInt();
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/HmacSha1.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import javax.crypto.Mac;
24 | import javax.crypto.spec.SecretKeySpec;
25 |
26 | import com.sshtools.ssh.SshException;
27 |
28 | /**
29 | * SHA-1 message authentication implementation.
30 | *
31 | * @author Lee David Painter
32 | *
33 | */
34 | public class HmacSha1 extends AbstractHmac {
35 |
36 | public HmacSha1() {
37 | super(JCEAlgorithms.JCE_HMACSHA1, 20);
38 | }
39 |
40 | public String getAlgorithm() {
41 | return "hmac-sha1";
42 | }
43 |
44 | public void init(byte[] keydata) throws SshException {
45 | try {
46 | mac = JCEProvider.getProviderForAlgorithm(jceAlgorithm) == null ? Mac
47 | .getInstance(jceAlgorithm) : Mac.getInstance(jceAlgorithm,
48 | JCEProvider.getProviderForAlgorithm(jceAlgorithm));
49 |
50 | // Create a key of 16 bytes
51 | byte[] key = new byte[System.getProperty(
52 | "miscomputes.ssh2.hmac.keys", "false").equalsIgnoreCase(
53 | "true") ? 16 : 20];
54 | System.arraycopy(keydata, 0, key, 0, key.length);
55 |
56 | SecretKeySpec keyspec = new SecretKeySpec(key, jceAlgorithm);
57 | mac.init(keyspec);
58 | } catch (Throwable t) {
59 | throw new SshException(t);
60 | }
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/HmacSha196.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import javax.crypto.Mac;
24 | import javax.crypto.spec.SecretKeySpec;
25 |
26 | import com.sshtools.ssh.SshException;
27 |
28 | /**
29 | * SHA-1 message authentication implementation.
30 | *
31 | * @author Lee David Painter
32 | *
33 | */
34 | public class HmacSha196 extends AbstractHmac {
35 |
36 | public HmacSha196() {
37 | super(JCEAlgorithms.JCE_HMACSHA1, 20, 12);
38 | }
39 |
40 | public String getAlgorithm() {
41 | return "hmac-sha1";
42 | }
43 |
44 | public void init(byte[] keydata) throws SshException {
45 | try {
46 | mac = JCEProvider.getProviderForAlgorithm(jceAlgorithm) == null ? Mac
47 | .getInstance(jceAlgorithm) : Mac.getInstance(jceAlgorithm,
48 | JCEProvider.getProviderForAlgorithm(jceAlgorithm));
49 |
50 | // Create a key of 16 bytes
51 | byte[] key = new byte[System.getProperty(
52 | "miscomputes.ssh2.hmac.keys", "false").equalsIgnoreCase(
53 | "true") ? 16 : 20];
54 | System.arraycopy(keydata, 0, key, 0, key.length);
55 |
56 | SecretKeySpec keyspec = new SecretKeySpec(key, jceAlgorithm);
57 | mac.init(keyspec);
58 | } catch (Throwable t) {
59 | throw new SshException(t);
60 | }
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/HmacSha256.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh.components.jce;
22 |
23 | import javax.crypto.Mac;
24 | import javax.crypto.spec.SecretKeySpec;
25 |
26 | import com.sshtools.ssh.SshException;
27 |
28 | /**
29 | * SHA-1 message authentication implementation.
30 | *
31 | * @author Lee David Painter
32 | *
33 | */
34 | public class HmacSha256 extends AbstractHmac {
35 |
36 | public HmacSha256() {
37 | super(JCEAlgorithms.JCE_HMACSHA256, 32);
38 | }
39 |
40 | public String getAlgorithm() {
41 | return "hmac-sha256@ssh.com";
42 | }
43 |
44 | public void init(byte[] keydata) throws SshException {
45 | try {
46 | mac = JCEProvider.getProviderForAlgorithm(jceAlgorithm) == null ? Mac
47 | .getInstance(jceAlgorithm) : Mac.getInstance(jceAlgorithm,
48 | JCEProvider.getProviderForAlgorithm(jceAlgorithm));
49 |
50 | // Create a key of 16 bytes
51 | byte[] key = new byte[System.getProperty(
52 | "miscomputes.ssh2.hmac.keys", "false").equalsIgnoreCase(
53 | "true") ? 16 : 32];
54 | System.arraycopy(keydata, 0, key, 0, key.length);
55 |
56 | SecretKeySpec keyspec = new SecretKeySpec(key, jceAlgorithm);
57 | mac.init(keyspec);
58 | } catch (Throwable t) {
59 | throw new SshException(t);
60 | }
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh2/GlobalRequest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh2;
22 |
23 | /**
24 | *
25 | *
26 | * This class represents a global request.
27 | *
28 | *
29 | * @author Lee David Painter
30 | */
31 | public class GlobalRequest {
32 |
33 | String name;
34 | byte[] requestdata;
35 |
36 | /**
37 | * Contstruct a request.
38 | *
39 | * @param name
40 | * the name of the request
41 | * @param requestdata
42 | * the request data
43 | */
44 | public GlobalRequest(String name, byte[] requestdata) {
45 | this.name = name;
46 | this.requestdata = requestdata;
47 | }
48 |
49 | /**
50 | * Get the name of the request.
51 | *
52 | * @return String
53 | */
54 | public String getName() {
55 | return name;
56 | }
57 |
58 | /**
59 | * Get the request data, if the request has been sent and processed, this
60 | * will return the response data (which can be null).
61 | *
62 | * @return either the request data or response data according to the current
63 | * state.
64 | */
65 | public byte[] getData() {
66 | return requestdata;
67 | }
68 |
69 | /**
70 | * Set the data.
71 | *
72 | * @param requestdata
73 | */
74 | public void setData(byte[] requestdata) {
75 | this.requestdata = requestdata;
76 | }
77 |
78 | }
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh/SshAuthentication.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh;
22 |
23 | /**
24 | *
25 | * The base interface for all SSH authentication mechanisms and authentication
26 | * result constants.
27 | *
28 | *
29 | * @author Lee David Painter
30 | */
31 | public interface SshAuthentication {
32 |
33 | /** The authentication completed **/
34 | public static final int COMPLETE = 1;
35 | /** The authentication failed **/
36 | public static final int FAILED = 2;
37 | /** The authentication succeeded but further authentication is required **/
38 | public static final int FURTHER_AUTHENTICATION_REQUIRED = 3;
39 | /** The authentication was cancelled by the user */
40 | public static final int CANCELLED = 4;
41 | /** The public key provided is acceptable for authentication **/
42 | public static final int PUBLIC_KEY_ACCEPTABLE = 5;
43 |
44 | /**
45 | * Set the username for this authentication attempt.
46 | *
47 | * @param username
48 | */
49 | public void setUsername(String username);
50 |
51 | /**
52 | * Get the username for this authentication attempt.
53 | *
54 | * @return the username used.
55 | */
56 | public String getUsername();
57 |
58 | /**
59 | * The SSH authentication method name
60 | *
61 | * @return String
62 | */
63 | public String getMethod();
64 | }
65 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/ssh2/KBIPrompt.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.ssh2;
22 |
23 | /**
24 | * Represents a single prompt in the keyboard-interactive
25 | * authentication process
26 | *
27 | * @author Lee David Painter
28 | */
29 | public class KBIPrompt {
30 | private String prompt;
31 | private String response;
32 | private boolean echo;
33 |
34 | /**
35 | * Creates a new KBIPrompt object.
36 | *
37 | * @param prompt
38 | * @param echo
39 | */
40 | public KBIPrompt(String prompt, boolean echo) {
41 | this.prompt = prompt;
42 | this.echo = echo;
43 | }
44 |
45 | /**
46 | * Get the prompt message to display to the user
47 | *
48 | * @return String
49 | */
50 | public String getPrompt() {
51 | return prompt;
52 | }
53 |
54 | /**
55 | * true if the user response should be echo'd to the display,
56 | * otherwise false.
57 | *
58 | * @return boolean
59 | */
60 | public boolean echo() {
61 | return echo;
62 | }
63 |
64 | /**
65 | * Set the user's response for this prompt.
66 | *
67 | * @param response
68 | */
69 | public void setResponse(String response) {
70 | this.response = response;
71 | }
72 |
73 | /**
74 | * Get the user's response for this prompt.
75 | *
76 | * @return String
77 | */
78 | public String getResponse() {
79 | return response;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/j2ssh-maverick/src/main/java/com/sshtools/events/J2SSHEventMessages.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2003-2016 SSHTOOLS Limited. All Rights Reserved.
3 | *
4 | * For product documentation visit https://www.sshtools.com/
5 | *
6 | * This file is part of J2SSH Maverick.
7 | *
8 | * J2SSH Maverick is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * J2SSH Maverick is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with J2SSH Maverick. If not, see .
20 | */
21 | package com.sshtools.events;
22 |
23 | import java.lang.reflect.Field;
24 | import java.lang.reflect.Modifier;
25 | import java.util.Hashtable;
26 |
27 | /**
28 | * Time saving class for the LoggingMaverickListener class that sets the message
29 | * code for each event to its event code field name.
30 | *
31 | * @author david
32 | *
33 | */
34 | public final class J2SSHEventMessages {
35 | public static Hashtable