mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-24 07:58:50 -05:00
recognize RSA_SIGN and RSA_ENCRYPT keys correctly, which fixes the hushmail problems
This commit is contained in:
parent
a6fe3364d1
commit
b20419fbf3
@ -647,7 +647,7 @@ public class Apg {
|
||||
ProgressDialogUpdater progress)
|
||||
throws GeneralException, FileNotFoundException, PGPException, IOException {
|
||||
Bundle returnData = new Bundle();
|
||||
PGPObjectFactory objectFactors = null;
|
||||
PGPObjectFactory objectFactory = null;
|
||||
|
||||
if (type == Id.type.secret_key) {
|
||||
progress.setProgress("importing secret keys...", 0, 100);
|
||||
@ -661,13 +661,13 @@ public class Apg {
|
||||
|
||||
FileInputStream fileIn = new FileInputStream(filename);
|
||||
InputStream in = PGPUtil.getDecoderStream(fileIn);
|
||||
objectFactors = new PGPObjectFactory(in);
|
||||
objectFactory = new PGPObjectFactory(in);
|
||||
|
||||
Vector<Object> objects = new Vector<Object>();
|
||||
Object obj = objectFactors.nextObject();
|
||||
Object obj = objectFactory.nextObject();
|
||||
while (obj != null) {
|
||||
objects.add(obj);
|
||||
obj = objectFactors.nextObject();
|
||||
obj = objectFactory.nextObject();
|
||||
}
|
||||
|
||||
int newKeys = 0;
|
||||
@ -1009,11 +1009,15 @@ public class Apg {
|
||||
return key.isEncryptionKey();
|
||||
}
|
||||
|
||||
// special case, this algorithm, no need to look further
|
||||
// special cases
|
||||
if (key.getAlgorithm() == PGPPublicKey.ELGAMAL_ENCRYPT) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key.getAlgorithm() == PGPPublicKey.RSA_ENCRYPT) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (PGPSignature sig : new IterableIterator<PGPSignature>(key.getSignatures())) {
|
||||
if (!key.isMasterKey() || sig.getKeyID() == key.getKeyID()) {
|
||||
PGPSignatureSubpacketVector hashed = sig.getHashedSubPackets();
|
||||
@ -1036,6 +1040,11 @@ public class Apg {
|
||||
return true;
|
||||
}
|
||||
|
||||
// special case
|
||||
if (key.getAlgorithm() == PGPPublicKey.RSA_SIGN) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (PGPSignature sig : new IterableIterator<PGPSignature>(key.getSignatures())) {
|
||||
if (!key.isMasterKey() || sig.getKeyID() == key.getKeyID()) {
|
||||
PGPSignatureSubpacketVector hashed = sig.getHashedSubPackets();
|
||||
|
Loading…
Reference in New Issue
Block a user