aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-03-20 02:27:05 +0100
committerVincent Breitmoser <valodim@mugenguild.com>2015-03-20 02:28:22 +0100
commit3b04636f5daf3d171449296a5d9a67440abfbf75 (patch)
tree8a3e77ddb16be28d881562fca1ff6e74d601e1b2 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java
parent25d89b5550b7fd699988954b07cad61bee9a8ba5 (diff)
downloadopen-keychain-3b04636f5daf3d171449296a5d9a67440abfbf75.tar.gz
open-keychain-3b04636f5daf3d171449296a5d9a67440abfbf75.tar.bz2
open-keychain-3b04636f5daf3d171449296a5d9a67440abfbf75.zip
support yubikeys in (some) edit key operations
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java
index c4d0d488e..36ab9dc1d 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java
@@ -149,10 +149,14 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey {
}
+ public boolean unlock(String passphrase) throws PgpGeneralException {
+ return unlock(passphrase.toCharArray());
+ }
+
/**
* Returns true on right passphrase
*/
- public boolean unlock(String passphrase) throws PgpGeneralException {
+ public boolean unlock(char[] passphrase) throws PgpGeneralException {
// handle keys on OpenPGP cards like they were unlocked
if (mSecretKey.getS2K() != null
&& mSecretKey.getS2K().getType() == S2K.GNU_DUMMY_S2K
@@ -164,7 +168,7 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey {
// try to extract keys using the passphrase
try {
PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder().setProvider(
- Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(passphrase.toCharArray());
+ Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(passphrase);
mPrivateKey = mSecretKey.extractPrivateKey(keyDecryptor);
mPrivateKeyState = PRIVATE_KEY_STATE_UNLOCKED;
} catch (PGPException e) {