From 0fd5b45df913d1524aa400a644c48dc91044d9bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sun, 10 Jan 2016 17:17:57 +0100 Subject: Use more generic 'Security Token' where possible, add sutitle to create key what tokens are supported --- .../keychain/pgp/PgpKeyOperationTest.java | 22 +++++++++++----------- .../keychain/util/Iso7816TLVTest.java | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'OpenKeychain/src/test') diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java index 5a8bbad21..082a4923e 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java @@ -829,7 +829,7 @@ public class PgpKeyOperationTest { } @Test - public void testKeyToCard() throws Exception { + public void testKeyToSecurityToken() throws Exception { // Special keyring for security token tests with 2048 bit RSA as a subkey SaveKeyringParcel parcelKey = new SaveKeyringParcel(); @@ -857,27 +857,27 @@ public class PgpKeyOperationTest { UncachedKeyRing modified; - { // keytocard should fail with BAD_NFC_SIZE when presented with the RSA-3072 key + { // moveKeyToSecurityToken should fail with BAD_NFC_SIZE when presented with the RSA-3072 key long keyId = KeyringTestingHelper.getSubkeyId(ringSecurityToken, 2); parcelSecurityToken.reset(); parcelSecurityToken.mChangeSubKeys.add(new SubkeyChange(keyId, false, true)); - assertModifyFailure("keytocard operation should fail on invalid key size", ringSecurityToken, - parcelSecurityToken, cryptoInput, LogType.MSG_MF_ERROR_BAD_NFC_SIZE); + assertModifyFailure("moveKeyToSecurityToken operation should fail on invalid key size", ringSecurityToken, + parcelSecurityToken, cryptoInput, LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_SIZE); } - { // keytocard should fail with BAD_NFC_ALGO when presented with the DSA-1024 key + { // moveKeyToSecurityToken should fail with BAD_NFC_ALGO when presented with the DSA-1024 key long keyId = KeyringTestingHelper.getSubkeyId(ringSecurityToken, 0); parcelSecurityToken.reset(); parcelSecurityToken.mChangeSubKeys.add(new SubkeyChange(keyId, false, true)); - assertModifyFailure("keytocard operation should fail on invalid key algorithm", ringSecurityToken, - parcelSecurityToken, cryptoInput, LogType.MSG_MF_ERROR_BAD_NFC_ALGO); + assertModifyFailure("moveKeyToSecurityToken operation should fail on invalid key algorithm", ringSecurityToken, + parcelSecurityToken, cryptoInput, LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_ALGO); } long keyId = KeyringTestingHelper.getSubkeyId(ringSecurityToken, 1); - { // keytocard should return a pending NFC_MOVE_KEY_TO_CARD result when presented with the RSA-2048 + { // moveKeyToSecurityToken should return a pending NFC_MOVE_KEY_TO_CARD result when presented with the RSA-2048 // key, and then make key divert-to-card when it gets a serial in the cryptoInputParcel. parcelSecurityToken.reset(); parcelSecurityToken.mChangeSubKeys.add(new SubkeyChange(keyId, false, true)); @@ -886,11 +886,11 @@ public class PgpKeyOperationTest { new CanonicalizedSecretKeyRing(ringSecurityToken.getEncoded(), false, 0); PgpKeyOperation op = new PgpKeyOperation(null); PgpEditKeyResult result = op.modifySecretKeyRing(secretRing, cryptoInput, parcelSecurityToken); - Assert.assertTrue("keytocard operation should be pending", result.isPending()); + Assert.assertTrue("moveKeyToSecurityToken operation should be pending", result.isPending()); Assert.assertEquals("required input should be RequiredInputType.NFC_MOVE_KEY_TO_CARD", result.getRequiredInputParcel().mType, RequiredInputType.NFC_MOVE_KEY_TO_CARD); - // Create a cryptoInputParcel that matches what the NFCOperationActivity would return. + // Create a cryptoInputParcel that matches what the SecurityTokenOperationActivity would return. byte[] keyIdBytes = new byte[8]; ByteBuffer buf = ByteBuffer.wrap(keyIdBytes); buf.putLong(keyId).rewind(); @@ -920,7 +920,7 @@ public class PgpKeyOperationTest { new CanonicalizedSecretKeyRing(modified.getEncoded(), false, 0); PgpKeyOperation op = new PgpKeyOperation(null); PgpEditKeyResult result = op.modifySecretKeyRing(secretRing, cryptoInput, parcelSecurityToken); - Assert.assertTrue("keytocard operation should be pending", result.isPending()); + Assert.assertTrue("moveKeyToSecurityToken operation should be pending", result.isPending()); Assert.assertEquals("required input should be RequiredInputType.NFC_SIGN", RequiredInputType.NFC_SIGN, result.getRequiredInputParcel().mType); } diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/Iso7816TLVTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/Iso7816TLVTest.java index f6888588e..99f79bd5b 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/Iso7816TLVTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/Iso7816TLVTest.java @@ -40,7 +40,7 @@ public class Iso7816TLVTest { @Test public void testDecode() throws Exception { - // this is an Application Related Data packet, received from my Yubikey + // this is an Application Related Data packet, received from my YubiKey NEO String input = "6e81dd4f10d27600012401020000000000000100005f520f0073000080000000000000000000007300c00af00000ff04c000ff00ffc106010800001103c206010800001103c306010800001103c407007f7f7f030303c53c1efdb4845ca242ca6977fddb1f788094fd3b430af1114c28a08d8c5afda81191cc50ca9bf51bc99fe8e6ca03a9d4d40e7b5925cd154813df381655b2c63c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cd0c5423590e5423590e5423590e9000"; byte[] data = Hex.decode(input); -- cgit v1.2.3