rename SecurityTokenHelper to SecurityTokenConnection

This commit is contained in:
Vincent Breitmoser
2017-10-09 01:53:57 +02:00
parent 07b7936d0b
commit e8f72718e9
8 changed files with 55 additions and 55 deletions

View File

@@ -275,7 +275,7 @@ class SCP11bSecureMessaging implements SecureMessaging {
}
public static void establish(final SecurityTokenHelper t, final Context ctx)
public static void establish(final SecurityTokenConnection t, final Context ctx)
throws SecureMessagingException, IOException {
CommandAPDU cmd;
@@ -286,9 +286,9 @@ class SCP11bSecureMessaging implements SecureMessaging {
// retrieving key algorithm
cmd = new CommandAPDU(0, (byte)0xCA, (byte)0x00,
OPENPGP_SECURE_MESSAGING_KEY_ATTRIBUTES_TAG, SecurityTokenHelper.MAX_APDU_NE_EXT);
OPENPGP_SECURE_MESSAGING_KEY_ATTRIBUTES_TAG, SecurityTokenConnection.MAX_APDU_NE_EXT);
resp = t.communicate(cmd);
if (resp.getSW() != SecurityTokenHelper.APDU_SW_SUCCESS) {
if (resp.getSW() != SecurityTokenConnection.APDU_SW_SUCCESS) {
throw new SecureMessagingException("failed to retrieve secure messaging key attributes");
}
tlvs = Iso7816TLV.readList(resp.getData(), true);
@@ -320,12 +320,12 @@ class SCP11bSecureMessaging implements SecureMessaging {
cmd = new CommandAPDU(0, (byte) 0xA5, (byte) 0x03, (byte) 0x04,
new byte[]{(byte) 0x60, (byte) 0x04, (byte) 0x5C, (byte) 0x02, (byte) 0x7F, (byte) 0x21});
resp = t.communicate(cmd);
if (resp.getSW() != SecurityTokenHelper.APDU_SW_SUCCESS) {
if (resp.getSW() != SecurityTokenConnection.APDU_SW_SUCCESS) {
throw new SecureMessagingException("failed to select secure messaging certificate");
}
cmd = new CommandAPDU(0, (byte) 0xCA, (byte) 0x7F, (byte) 0x21, SecurityTokenHelper.MAX_APDU_NE_EXT);
cmd = new CommandAPDU(0, (byte) 0xCA, (byte) 0x7F, (byte) 0x21, SecurityTokenConnection.MAX_APDU_NE_EXT);
resp = t.communicate(cmd);
if (resp.getSW() != SecurityTokenHelper.APDU_SW_SUCCESS) {
if (resp.getSW() != SecurityTokenConnection.APDU_SW_SUCCESS) {
throw new SecureMessagingException("failed to retrieve secure messaging certificate");
}
@@ -334,9 +334,9 @@ class SCP11bSecureMessaging implements SecureMessaging {
} else {
// retrieving public key
cmd = new CommandAPDU(0, (byte) 0x47, (byte) 0x81, (byte) 0x00,
OPENPGP_SECURE_MESSAGING_KEY_CRT, SecurityTokenHelper.MAX_APDU_NE_EXT);
OPENPGP_SECURE_MESSAGING_KEY_CRT, SecurityTokenConnection.MAX_APDU_NE_EXT);
resp = t.communicate(cmd);
if (resp.getSW() != SecurityTokenHelper.APDU_SW_SUCCESS) {
if (resp.getSW() != SecurityTokenConnection.APDU_SW_SUCCESS) {
throw new SecureMessagingException("failed to retrieve secure messaging public key");
}
tlvs = Iso7816TLV.readList(resp.getData(), true);
@@ -396,9 +396,9 @@ class SCP11bSecureMessaging implements SecureMessaging {
// internal authenticate
cmd = new CommandAPDU(0, (byte)0x88, (byte)0x01, (byte)0x0, pkout.toByteArray(),
SecurityTokenHelper.MAX_APDU_NE_EXT);
SecurityTokenConnection.MAX_APDU_NE_EXT);
resp = t.communicate(cmd);
if (resp.getSW() != SecurityTokenHelper.APDU_SW_SUCCESS) {
if (resp.getSW() != SecurityTokenConnection.APDU_SW_SUCCESS) {
throw new SecureMessagingException("failed to initiate internal authenticate");
}

View File

@@ -70,7 +70,7 @@ import java.security.interfaces.RSAPrivateCrtKey;
* devices.
* For the full specs, see http://g10code.com/docs/openpgp-card-2.0.pdf
*/
public class SecurityTokenHelper {
public class SecurityTokenConnection {
private static final int MAX_APDU_NC = 255;
private static final int MAX_APDU_NC_EXT = 65535;
@@ -100,7 +100,7 @@ public class SecurityTokenHelper {
private boolean mPw1ValidatedForDecrypt; // Mode 82 does other things; consider renaming?
private boolean mPw3Validated;
private SecurityTokenHelper() {
private SecurityTokenConnection() {
}
public static double parseOpenPgpVersion(final byte[] aid) {
@@ -109,7 +109,7 @@ public class SecurityTokenHelper {
return aid[6] + minv;
}
public static SecurityTokenHelper getInstance() {
public static SecurityTokenConnection getInstance() {
return LazyHolder.SECURITY_TOKEN_HELPER;
}
@@ -1007,6 +1007,6 @@ public class SecurityTokenHelper {
}
private static class LazyHolder {
private static final SecurityTokenHelper SECURITY_TOKEN_HELPER = new SecurityTokenHelper();
private static final SecurityTokenConnection SECURITY_TOKEN_HELPER = new SecurityTokenConnection();
}
}