diff options
author | Dominik <dominik@dominikschuermann.de> | 2012-10-31 00:39:32 +0100 |
---|---|---|
committer | Dominik <dominik@dominikschuermann.de> | 2012-10-31 00:39:32 +0100 |
commit | 825ec676d0d6c7c1307de2465cc5dac28a8e0531 (patch) | |
tree | 2cb830d04555eabb0be5e30718c0b930992192d0 /org_apg/src/org/thialfihar/android/apg/helper | |
parent | 691d888e924f63b4d306c48ad5eacd1befd03af5 (diff) | |
download | open-keychain-825ec676d0d6c7c1307de2465cc5dac28a8e0531.tar.gz open-keychain-825ec676d0d6c7c1307de2465cc5dac28a8e0531.tar.bz2 open-keychain-825ec676d0d6c7c1307de2465cc5dac28a8e0531.zip |
fixing public and secret key activities
Diffstat (limited to 'org_apg/src/org/thialfihar/android/apg/helper')
-rw-r--r-- | org_apg/src/org/thialfihar/android/apg/helper/PGPConversionHelper.java | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/org_apg/src/org/thialfihar/android/apg/helper/PGPConversionHelper.java b/org_apg/src/org/thialfihar/android/apg/helper/PGPConversionHelper.java index c7ec26628..e83170fbe 100644 --- a/org_apg/src/org/thialfihar/android/apg/helper/PGPConversionHelper.java +++ b/org_apg/src/org/thialfihar/android/apg/helper/PGPConversionHelper.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; +import org.spongycastle.openpgp.PGPKeyRing; import org.spongycastle.openpgp.PGPObjectFactory; import org.spongycastle.openpgp.PGPPublicKeyRing; import org.spongycastle.openpgp.PGPSecretKey; @@ -57,19 +58,19 @@ public class PGPConversionHelper { * @param keysBytes * @return */ - public static PGPSecretKeyRing BytesToPGPSecretKeyRing(byte[] keysBytes) { - PGPObjectFactory factory = new PGPObjectFactory(keysBytes); - PGPSecretKeyRing keyRing = null; - try { - if ((keyRing = (PGPSecretKeyRing) factory.nextObject()) == null) { - Log.e(Constants.TAG, "No keys given!"); - } - } catch (IOException e) { - Log.e(Constants.TAG, "Error while converting to PGPSecretKeyRing!", e); - } - - return keyRing; - } + // public static PGPSecretKeyRing BytesToPGPSecretKeyRing(byte[] keysBytes) { + // PGPObjectFactory factory = new PGPObjectFactory(keysBytes); + // PGPSecretKeyRing keyRing = null; + // try { + // if ((keyRing = (PGPSecretKeyRing) factory.nextObject()) == null) { + // Log.e(Constants.TAG, "No keys given!"); + // } + // } catch (IOException e) { + // Log.e(Constants.TAG, "Error while converting to PGPSecretKeyRing!", e); + // } + // + // return keyRing; + // } /** * Convert from byte[] to PGPPublicKeyRing @@ -77,11 +78,11 @@ public class PGPConversionHelper { * @param keysBytes * @return */ - public static PGPPublicKeyRing BytesToPGPPublicKeyRing(byte[] keysBytes) { + public static PGPKeyRing BytesToPGPKeyRing(byte[] keysBytes) { PGPObjectFactory factory = new PGPObjectFactory(keysBytes); - PGPPublicKeyRing keyRing = null; + PGPKeyRing keyRing = null; try { - if ((keyRing = (PGPPublicKeyRing) factory.nextObject()) == null) { + if ((keyRing = (PGPKeyRing) factory.nextObject()) == null) { Log.e(Constants.TAG, "No keys given!"); } } catch (IOException e) { @@ -98,7 +99,7 @@ public class PGPConversionHelper { * @return */ public static ArrayList<PGPSecretKey> BytesToPGPSecretKeyList(byte[] keysBytes) { - PGPSecretKeyRing keyRing = BytesToPGPSecretKeyRing(keysBytes); + PGPSecretKeyRing keyRing = (PGPSecretKeyRing) BytesToPGPKeyRing(keysBytes); ArrayList<PGPSecretKey> keys = new ArrayList<PGPSecretKey>(); @SuppressWarnings("unchecked") |