diff options
author | Ashley Hughes <spirit.returned@gmail.com> | 2014-01-31 15:19:07 +0000 |
---|---|---|
committer | Ashley Hughes <spirit.returned@gmail.com> | 2014-01-31 15:19:07 +0000 |
commit | 7897c6fadd2a285f8b2b52f56b71741a44f13f03 (patch) | |
tree | cf9f7f8fb6b9219ef450f21f5e7ab8b373e56489 /libraries | |
parent | f7afa0c8200db25feb8415de35ea83585e7cd7ce (diff) | |
download | open-keychain-7897c6fadd2a285f8b2b52f56b71741a44f13f03.tar.gz open-keychain-7897c6fadd2a285f8b2b52f56b71741a44f13f03.tar.bz2 open-keychain-7897c6fadd2a285f8b2b52f56b71741a44f13f03.zip |
more probable changes for spongycastle2
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPObjectFactory.java | 9 | ||||
-rw-r--r-- | libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java | 19 |
2 files changed, 28 insertions, 0 deletions
diff --git a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPObjectFactory.java b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPObjectFactory.java index 11fb3a53c..73b11b9a1 100644 --- a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPObjectFactory.java +++ b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPObjectFactory.java @@ -103,6 +103,15 @@ public class PGPObjectFactory { throw new IOException("can't create secret key object: " + e); } + case PacketTags.SECRET_SUBKEY: + try + { + return PGPSecretKeyRing.readSubkey(in, fingerPrintCalculator); + } + catch (PGPException e) + { + throw new IOException("processing error: " + e.getMessage()); + } case PacketTags.PUBLIC_KEY: return new PGPPublicKeyRing(in, fingerPrintCalculator); case PacketTags.PUBLIC_SUBKEY: diff --git a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java index c182a1f1e..4805721a8 100644 --- a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java +++ b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSecretKeyRing.java @@ -477,4 +477,23 @@ public class PGPSecretKeyRing return new PGPSecretKeyRing(keys, secRing.extraPubKeys); } + + static PGPSecretKey readSubkey(BCPGInputStream in, KeyFingerPrintCalculator fingerPrintCalculator) + throws IOException, PGPException + { + SecretSubkeyPacket sub = (SecretSubkeyPacket)in.readPacket(); + + // + // ignore GPG comment packets if found. + // + while (in.nextPacketTag() == PacketTags.EXPERIMENTAL_2) + { + in.readPacket(); + } + + TrustPacket subTrust = readOptionalTrustPacket(in); + List sigList = readSignaturesAndTrust(in); + + return new PGPSecretKey(sub, new PGPPublicKey(sub.getPublicKeyPacket(), subTrust, sigList, fingerPrintCalculator)); + } } |