Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

androsign: Fix #1031 & #764 - use oscrypto to load public_key instead… #1040

Merged
merged 2 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions androguard/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters.terminal import TerminalFormatter
from oscrypto import asymmetric

# internal modules
from androguard.core import androconf
Expand Down Expand Up @@ -360,14 +361,14 @@ def androsign_main(args_apk, args_hash, args_all, show):

for public_key in pkeys:
if show:
x509_public_key = keys.PublicKeyInfo.load(public_key)
x509_public_key = asymmetric.load_public_key(public_key)
print("PublicKey Algorithm:", x509_public_key.algorithm)
print("Bit Size:", x509_public_key.bit_size)
print("Fingerprint:", binascii.hexlify(x509_public_key.fingerprint))
try:
print("Hash Algorithm:", x509_public_key.hash_algo)
print("Hash Algorithm:", x509_public_key.asn1.hash_algo)
except ValueError as ve:
# RSA pkey does not have an hash algorithm
# RSA pkey does not have a hash algorithm
pass
print()

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ PyQt5-Qt5 = [
{version = "5.15.2", markers = "sys_platform != 'darwin'"}
]
pyyaml = "*"
oscrypto = ">=1.3.0"

[tool.setuptools.package_data]
"androguard.core.api_specific_resources" = ["aosp_permissions/*.json", "api_permission_mappings/*.json"]
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ matplotlib
networkx
PyQt5
pyyaml
oscrypto>=1.3.0