Skip to content

Commit

Permalink
Merge pull request #75 from tumpaproject/detech_card_type
Browse files Browse the repository at this point in the history
Fixes #74 detects key and Yubikey type
  • Loading branch information
SaptakS authored Apr 19, 2023
2 parents 3136360 + 8991a1d commit b512a09
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 20 deletions.
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

## Unreleased

## [0.10.0] - 2023-04-19

### Fixed

- Fixed #74 detect key and Yubikey type before upload.
- Removes extra print statements.

## [0.9.0] - 2023-04-18

### Fixed

- Fixes key generation window color.
- Cv25519 is the default key type.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.briefcase]
project_name = "tumpa"
bundle = "in.kushaldas"
version = "0.9.0"
version = "0.10.0"
url = "https://tumpa.rocks"
license = "GNU General Public License v3 or later (GPLv3+)"
author = 'Kushal Das'
Expand Down
32 changes: 16 additions & 16 deletions src/tumpa/CardDetailsView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ Rectangle {
}
}

ModalDangerButton {
id: formatKeyBtn
anchors {
bottom: root.bottom
right: root.right
rightMargin: 24
bottomMargin: 24
}

labelString: qsTr("Reset smartcard")

onClicked: {
// TODO: reset the smartcard
console.log("Reset smartcard button clicked")
}
}
// ModalDangerButton {
// id: formatKeyBtn
// anchors {
// bottom: root.bottom
// right: root.right
// rightMargin: 24
// bottomMargin: 24
// }

// labelString: qsTr("Reset smartcard")

// onClicked: {
// // TODO: reset the smartcard
// console.log("Reset smartcard button clicked")
// }
// }
}
17 changes: 14 additions & 3 deletions src/tumpa/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ def generateKey(
whichsubkeys += 2
if authentication:
whichsubkeys += 4
print(f"{whichsubkeys=}")
# Now feed in the data to the other thread
self.kt.setup(uids, password, whichsubkeys, key_algo, expiry, canexpire)
# Start the thread
Expand All @@ -311,7 +310,6 @@ def removeKey(self, fingerprint):
def get_subkey_types(self, fingerprint: str):
key = self.ks.get_key(fingerprint)
data = available_subkeys(key)
print(f"{data=}")
e, s, a = data
# TODO: the stupid hack to pass data to QML
subkeytypes.e = e
Expand Down Expand Up @@ -377,6 +375,20 @@ def uploadKey(
):
# First get the key
key = self.ks.get_key(fingerprint)

# First check for the card to be accessable
if not rjce.is_smartcard_connected():
return "Failed to find/access Yubikey. Plug it again if possible."
# Now check the version
version = rjce.get_card_version()
key_algos = rjce.get_key_cipher_details(key.keyvalue)
keytype = "RSA"
for key_details in key_algos:
if key_details[1] in ["EdDSA", "ECDH"]:
keytype = "Cv25519"
# Yubikey4 does not support Cv25519 keys
if keytype == "Cv25519" and version[0] < 5:
return "Please use Yubikey5 or above for Cv25519 Keys."
try:
# reset the yubikey
result = rjce.reset_yubikey()
Expand Down Expand Up @@ -449,7 +461,6 @@ def available_subkeys(key: Key) -> Tuple[bool, bool, bool]:
got_auth = False
# Loop over on the subkeys
for subkey in subkeys_sorted:
print(subkey)
if subkey["revoked"]:
continue
if not subkey["expiration"]:
Expand Down

0 comments on commit b512a09

Please sign in to comment.