Support Nitrokey Start and Storage
This commit is contained in:
parent
106dbdf4a9
commit
9c1915423a
|
@ -96,8 +96,8 @@ public abstract class SecurityTokenInfo implements Parcelable {
|
|||
}
|
||||
|
||||
public enum TokenType {
|
||||
YUBIKEY_NEO, YUBIKEY_4, FIDESMO, NITROKEY_PRO, NITROKEY_STORAGE, NITROKEY_START,
|
||||
GNUK_OLD, GNUK_UNKNOWN, GNUK_1_25_AND_NEWER, LEDGER_NANO_S, UNKNOWN
|
||||
YUBIKEY_NEO, YUBIKEY_4, FIDESMO, NITROKEY_PRO, NITROKEY_STORAGE, NITROKEY_START_OLD,
|
||||
NITROKEY_START_1_25_AND_NEWER, GNUK_OLD, GNUK_1_25_AND_NEWER, LEDGER_NANO_S, UNKNOWN
|
||||
}
|
||||
|
||||
private static final HashSet<TokenType> SUPPORTED_USB_TOKENS = new HashSet<>(Arrays.asList(
|
||||
|
@ -105,15 +105,18 @@ public abstract class SecurityTokenInfo implements Parcelable {
|
|||
TokenType.YUBIKEY_4,
|
||||
TokenType.NITROKEY_PRO,
|
||||
TokenType.NITROKEY_STORAGE,
|
||||
TokenType.NITROKEY_START_OLD,
|
||||
TokenType.NITROKEY_START_1_25_AND_NEWER,
|
||||
TokenType.GNUK_OLD,
|
||||
TokenType.GNUK_UNKNOWN,
|
||||
TokenType.GNUK_1_25_AND_NEWER
|
||||
));
|
||||
|
||||
private static final HashSet<TokenType> SUPPORTED_USB_SETUP = new HashSet<>(Arrays.asList(
|
||||
TokenType.YUBIKEY_NEO,
|
||||
TokenType.YUBIKEY_4, // Not clear, will be tested: https://github.com/open-keychain/open-keychain/issues/2069
|
||||
TokenType.YUBIKEY_4,
|
||||
TokenType.NITROKEY_PRO,
|
||||
TokenType.NITROKEY_STORAGE,
|
||||
TokenType.NITROKEY_START_1_25_AND_NEWER,
|
||||
TokenType.GNUK_1_25_AND_NEWER
|
||||
));
|
||||
|
||||
|
|
|
@ -211,7 +211,11 @@ public class UsbTransport implements Transport {
|
|||
case PRODUCT_NITROKEY_PRO:
|
||||
return TokenType.NITROKEY_PRO;
|
||||
case PRODUCT_NITROKEY_START:
|
||||
return TokenType.NITROKEY_START;
|
||||
String serialNo = usbConnection.getSerial();
|
||||
SecurityTokenInfo.Version gnukVersion = SecurityTokenInfo.parseGnukVersionString(serialNo);
|
||||
boolean versionGreaterEquals125 = gnukVersion != null
|
||||
&& SecurityTokenInfo.Version.create("1.2.5").compareTo(gnukVersion) <= 0;
|
||||
return versionGreaterEquals125 ? TokenType.NITROKEY_START_1_25_AND_NEWER : TokenType.NITROKEY_START_OLD;
|
||||
case PRODUCT_NITROKEY_STORAGE:
|
||||
return TokenType.NITROKEY_STORAGE;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ class ManageSecurityTokenContract {
|
|||
|
||||
void requestStoragePermission();
|
||||
|
||||
void showErrorCannotReset(boolean isGnuk);
|
||||
void showErrorCannotReset(boolean isGnukOrNitrokeyStart);
|
||||
void showErrorCannotUnlock();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -353,8 +353,8 @@ public class ManageSecurityTokenFragment extends Fragment implements ManageSecur
|
|||
}
|
||||
|
||||
@Override
|
||||
public void showErrorCannotReset(boolean isGnuk) {
|
||||
if (isGnuk) {
|
||||
public void showErrorCannotReset(boolean isGnukOrNitrokeyStart) {
|
||||
if (isGnukOrNitrokeyStart) {
|
||||
Notify.create(getActivity(), R.string.token_error_cannot_reset_gnuk_old, Style.ERROR).show();
|
||||
} else {
|
||||
Notify.create(getActivity(), R.string.token_error_cannot_reset, Style.ERROR).show();
|
||||
|
|
|
@ -365,9 +365,9 @@ class ManageSecurityTokenPresenter implements ManageSecurityTokenMvpPresenter {
|
|||
public void onClickResetToken() {
|
||||
if (!tokenInfo.isResetSupported()) {
|
||||
TokenType tokenType = tokenInfo.getTokenType();
|
||||
boolean isGnuk = tokenType == TokenType.GNUK_OLD || tokenType == TokenType.GNUK_UNKNOWN;
|
||||
boolean isGnukOrNitrokeyStart = tokenType == TokenType.GNUK_OLD || tokenType == TokenType.NITROKEY_START_OLD;
|
||||
|
||||
view.showErrorCannotReset(isGnuk);
|
||||
view.showErrorCannotReset(isGnukOrNitrokeyStart);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1927,7 +1927,7 @@
|
|||
<item quantity="other">"%d attempts left"</item>
|
||||
</plurals>
|
||||
<string name="token_error_locked_indefinitely">Too many reset attempts. Token cannot be unlocked!</string>
|
||||
<string name="token_error_cannot_reset_gnuk_old">"The Gnuk Token does not support reset until version 1.2.5"</string>
|
||||
<string name="token_error_cannot_reset_gnuk_old">"The Gnuk Token/Nitrokey Start does not support reset until version 1.2.5"</string>
|
||||
<string name="token_error_cannot_reset">"This Security Token does not support reset"</string>
|
||||
|
||||
<string name="token_menu_change_pin">Change PIN</string>
|
||||
|
|
Loading…
Reference in a new issue