Return encoded signature blob instead of a raw signature in
SshAuthenticationService
This commit is contained in:
@@ -27,6 +27,7 @@ import org.sufficientlysecure.keychain.ssh.key.SshDSAPublicKey;
|
||||
import org.sufficientlysecure.keychain.ssh.key.SshECDSAPublicKey;
|
||||
import org.sufficientlysecure.keychain.ssh.key.SshEd25519PublicKey;
|
||||
import org.sufficientlysecure.keychain.ssh.key.SshRSAPublicKey;
|
||||
import org.sufficientlysecure.keychain.ssh.utils.SshUtils;
|
||||
|
||||
public class SshPublicKey {
|
||||
private final static String TAG = "SshPublicKey";
|
||||
@@ -66,48 +67,13 @@ public class SshPublicKey {
|
||||
private String encodeECKey(PGPPublicKey publicKey) {
|
||||
ECPublicBCPGKey publicBCPGKey = (ECPublicBCPGKey) publicKey.getPublicKeyPacket().getKey();
|
||||
|
||||
String curveName = getCurveName(publicBCPGKey);
|
||||
String curveName = SshUtils.getCurveName(mPublicKey.getCurveOid());
|
||||
SshECDSAPublicKey sshECDSAPublicKey = new SshECDSAPublicKey(curveName, publicBCPGKey.getEncodedPoint());
|
||||
|
||||
return sshECDSAPublicKey.getPublicKeyBlob();
|
||||
}
|
||||
|
||||
private String getCurveName(ECPublicBCPGKey publicBCPGKey) {
|
||||
String curveOid = publicBCPGKey.getCurveOID().getId();
|
||||
// see RFC5656 section 10.{1,2}
|
||||
switch (curveOid) {
|
||||
// REQUIRED curves
|
||||
case "1.2.840.10045.3.1.7":
|
||||
return "nistp256";
|
||||
case "1.3.132.0.34":
|
||||
return "nistp384";
|
||||
case "1.3.132.0.35":
|
||||
return "nistp521";
|
||||
|
||||
// RECOMMENDED curves
|
||||
case "1.3.132.0.1":
|
||||
return "1.3.132.0.1";
|
||||
case "1.2.840.10045.3.1.1":
|
||||
return "1.2.840.10045.3.1.1";
|
||||
case "1.3.132.0.33":
|
||||
return "1.3.132.0.33";
|
||||
case "1.3.132.0.26":
|
||||
return "1.3.132.0.26";
|
||||
case "1.3.132.0.27":
|
||||
return "1.3.132.0.27";
|
||||
case "1.3.132.0.16":
|
||||
return "1.3.132.0.16";
|
||||
case "1.3.132.0.36":
|
||||
return "1.3.132.0.36";
|
||||
case "1.3.132.0.37":
|
||||
return "1.3.132.0.37";
|
||||
case "1.3.132.0.38":
|
||||
return "1.3.132.0.38";
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String encodeEdDSAKey(PGPPublicKey publicKey) {
|
||||
EdDSAPublicBCPGKey publicBCPGKey = (EdDSAPublicBCPGKey) publicKey.getPublicKeyPacket().getKey();
|
||||
|
||||
Reference in New Issue
Block a user