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

Bugfix: Remove assert from Certificate.from_p12 #274

Merged
merged 2 commits into from
Oct 19, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 0.34.2
-------------

**Bugfix**:
- Do not throw `AssertionError` from `Certificate.from_p12` in case the given PKCS#12 container does not contain a certificate. Raise a `ValueError` with appropriate error message instead. [PR #274](https://github.com/codemagic-ci-cd/cli-tools/pull/274).

Version 0.34.1
-------------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "codemagic-cli-tools"
version = "0.34.1"
version = "0.34.2"
description = "CLI tools used in Codemagic builds"
readme = "README.md"
authors = [
Expand Down
2 changes: 1 addition & 1 deletion src/codemagic/__version__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = 'codemagic-cli-tools'
__description__ = 'CLI tools used in Codemagic builds'
__version__ = '0.34.1.dev'
__version__ = '0.34.2.dev'
__url__ = 'https://github.com/codemagic-ci-cd/cli-tools'
__licence__ = 'GNU General Public License v3.0'
3 changes: 2 additions & 1 deletion src/codemagic/models/certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def from_ans1(cls, asn1: AnyStr) -> Certificate:
def from_p12(cls, p12: bytes, password: Optional[AnyStr] = None) -> Certificate:
password_encoded = None if password is None else cls._bytes(password)
_, x509_certificate, _ = pkcs12.load_key_and_certificates(p12, password_encoded)
assert x509_certificate is not None # make mypy happy
if x509_certificate is None:
raise ValueError('Certificate was not found from PKCS#12 container')
return Certificate(x509_certificate)

@property
Expand Down