sign key without passphrase fixed

This commit is contained in:
Dominik Schürmann 2014-01-18 20:03:40 +01:00
parent 46291d6b3e
commit 803a1e9481

View File

@ -165,7 +165,8 @@ public class PgpKeyOperation {
} }
default: { default: {
throw new PgpGeneralException(mContext.getString(R.string.error_unknown_algorithm_choice)); throw new PgpGeneralException(
mContext.getString(R.string.error_unknown_algorithm_choice));
} }
} }
@ -382,7 +383,8 @@ public class PgpKeyOperation {
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME); .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME);
PGPSignatureGenerator sGen = new PGPSignatureGenerator(signerBuilder); PGPSignatureGenerator sGen = new PGPSignatureGenerator(signerBuilder);
sGen.init(PGPSignature.PRIMARYKEY_BINDING, subPrivateKey); sGen.init(PGPSignature.PRIMARYKEY_BINDING, subPrivateKey);
PGPSignature certification = sGen.generateCertification(masterPublicKey, subPublicKey); PGPSignature certification = sGen.generateCertification(masterPublicKey,
subPublicKey);
unhashedPacketsGen.setEmbeddedSignature(false, certification); unhashedPacketsGen.setEmbeddedSignature(false, certification);
} }
if (canEncrypt) { if (canEncrypt) {
@ -420,7 +422,7 @@ public class PgpKeyOperation {
public PGPPublicKeyRing signKey(long masterKeyId, long pubKeyId, String passphrase) public PGPPublicKeyRing signKey(long masterKeyId, long pubKeyId, String passphrase)
throws PgpGeneralException, NoSuchAlgorithmException, NoSuchProviderException, throws PgpGeneralException, NoSuchAlgorithmException, NoSuchProviderException,
PGPException, SignatureException { PGPException, SignatureException {
if (passphrase == null || passphrase.length() <= 0) { if (passphrase == null) {
throw new PgpGeneralException("Unable to obtain passphrase"); throw new PgpGeneralException("Unable to obtain passphrase");
} else { } else {
PGPPublicKeyRing pubring = ProviderHelper PGPPublicKeyRing pubring = ProviderHelper