All Questions
16 questions
0
votes
0
answers
26
views
Authentication fails when using Jsch SSH client [duplicate]
I'm trying to connect to EC2 server using Jsch SSH client with RSA KeyPair, But it is giving me auth fail error. I have checked my configuration, even I'm able to connect to EC2 using terminal with ...
0
votes
1
answer
2k
views
how to generate ed25519 keypair pem file in java
I generated ed25519 keypair with my code, but when i copy the public key file and private key file to the linux machine.It looks like there is something wrong with my key pair file.
linux machine can'...
0
votes
1
answer
2k
views
Unable to use private/public keys with Jsch
On a linux system I create ssh keys through ssh-keygen and copy the public key to a remote host via ssh-copy-id [email protected]. The connection works as expected - I can ssh from my host to the ...
1
vote
1
answer
1k
views
How to Valid OpenSSH public key format by Java before importing key pair on AWS?
My task is using Java to validate OpenSSH Public key(RSA key) which will be supported on AWS.
Example, I have two RSA format, how can I validate them by Java?
---- BEGIN PUBLIC KEY ----
Comment: &...
1
vote
1
answer
179
views
Unprotected private ssh key generated by java prompts for passphrase
I'm tying to generate a ssh key pair using Java. For the private key no passphrase has been set. The key is saved as Base64 encoded string to a file.
The problem is that the private key seems to be ...
1
vote
0
answers
78
views
SSH compatible private key
Can anyone tell me how to generate SSH compatible private keys from Java's RSAPrivateKey? I looked into many posts but not working for me.
KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
...
3
votes
0
answers
359
views
How to sign and verify string using ssh key using java
I know this issue may be duplicated somewhere else, but i wasted a lot of time to fix this issue.
I need to use third party API and as per their documentation i have to generate private/public key ...
8
votes
5
answers
22k
views
Java ssh-rsa string to public key
I want to get the public key of the content of an .pub file. This is an example what the content of a .pub file looks like(generated with ssh-keygen):
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDBPL2s+...
2
votes
2
answers
3k
views
How do I convert an RSA public key to an ssh-rsa public key in Java?
I have the following public key (as an example):
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjKAmiieDC6SEYpxdI5Kn
...
0
votes
1
answer
1k
views
Connect to Unix using ssh and sftp via Java [RSA SecuerID token]
I need to connect to Unix Server using Java via SSH and SFTP protocol and execute specific commands and do File Transfers also. But there is RSA token authentication is enabled on Unix. So I need to ...
3
votes
1
answer
6k
views
convert openSSH rsa key to javax.crypto.Cipher compatible format
Is there a way to programmatically convert the Jsch generated SSH RSA-keys to a format javax.crypto.Cipher can use for encryption? I have mostly seen answers similar to this:
openssl pkcs8 -topk8 -...
5
votes
2
answers
11k
views
How to load public ssh key from a file in java?
I trying to load public ssh rsa key (id_rsa.pub) from a file:
X509EncodedKeySpec spec = new X509EncodedKeySpec(readBytes(keyFile));
return (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(...
1
vote
1
answer
698
views
How to get modulus and pubExp in java?
is it possible to retrieve the modulus and pubExp from a ssh public key such as the one below:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9t1iUplXCsaamE3QPxiB4G1BTZHH4oK4Ti2pHgfOEDLsVWrhycX+...
7
votes
2
answers
18k
views
JSch getting "invalid privatekey:" while trying to load an RSA private key by KeyPairGenerator
I'm using java.security.KeyPairGenerator to gen an RSA key pair, and then try to load the private key via the KeyPair class provided in Jsch(0.1.49). The code:
public static void main(String[] args) ...
2
votes
1
answer
675
views
How to find keylength of SSH RSA keys using java
I am using JSCH API to find length of RSA SSH keys .
I use the following code to do that:
KeyPairRSA KPR = (KeyPairRSA) KeyPairRSA.load(jsch, keypath);
System.out.println("size " +KPR.getKeySize());
...