forked from mwiede/jsch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement authentication with OpenSSH user certificate from file
- Loading branch information
1 parent
e402511
commit 2ae8ed7
Showing
5 changed files
with
117 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.jcraft.jsch; | ||
|
||
public interface OpenSSHCertifiedKey { | ||
int SSH_CERT_TYPE_USER = 1; | ||
int SSH_CERT_TYPE_HOST = 2; | ||
int getCertificateType(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.jcraft.jsch; | ||
|
||
public class OpenSSHUserCertDSA extends KeyPairDSA implements OpenSSHCertifiedKey { | ||
private static final String keyType = "[email protected]"; | ||
private static final byte[] sshdsacert = Util.str2byte(keyType); | ||
|
||
public OpenSSHUserCertDSA(JSch jsch){ | ||
super(jsch); | ||
} | ||
|
||
public int getCertificateType() { | ||
return SSH_CERT_TYPE_USER; | ||
} | ||
|
||
@Override | ||
public int getKeyType(){ | ||
return DSA_CERT; | ||
} | ||
|
||
@Override | ||
byte[] getKeyTypeName(){ | ||
return sshdsacert; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.jcraft.jsch; | ||
|
||
public class OpenSSHUserCertECDSA extends KeyPairECDSA implements OpenSSHCertifiedKey { | ||
private static final String keyType = "[email protected]"; | ||
private static final byte[] sshrsacert = Util.str2byte(keyType); | ||
|
||
public OpenSSHUserCertECDSA(JSch jsch){ | ||
super(jsch); | ||
} | ||
|
||
public int getCertificateType() { | ||
return SSH_CERT_TYPE_USER; | ||
} | ||
|
||
@Override | ||
public int getKeyType(){ | ||
return RSA_CERT; | ||
} | ||
|
||
@Override | ||
byte[] getKeyTypeName(){ | ||
return sshrsacert; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.jcraft.jsch; | ||
|
||
/** | ||
* | ||
*/ | ||
public class OpenSSHUserCertRSA extends KeyPairRSA implements OpenSSHCertifiedKey { | ||
private static final String keyType = "[email protected]"; | ||
private static final byte[] sshrsacert = Util.str2byte(keyType); | ||
|
||
public OpenSSHUserCertRSA(JSch jsch){ | ||
super(jsch); | ||
} | ||
|
||
public int getCertificateType() { | ||
return SSH_CERT_TYPE_USER; | ||
} | ||
|
||
@Override | ||
public int getKeyType(){ | ||
return RSA_CERT; | ||
} | ||
|
||
@Override | ||
byte[] getKeyTypeName(){ | ||
return sshrsacert; | ||
} | ||
|
||
} |