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

certificate.get_subject_ASN1() #23

Closed
pquerner opened this issue Aug 20, 2023 · 1 comment
Closed

certificate.get_subject_ASN1() #23

pquerner opened this issue Aug 20, 2023 · 1 comment

Comments

@pquerner
Copy link

Hello,

I've posted some of this on the currently open PR #22 , but it got deleted since it doesnt belong there.
Maybe it belongs here and somebody can offer some help.

As I checked out the Pull Request I wanted to use the script like this:

python3 iosCertTrustManager.py -a ~/.mitmproxy/mitmproxy-ca-cert.pem -y

But it fails with:

subject=CN = mitmproxy, O = mitmproxy

Importing to /Users/p.querner/Library/Developer/CoreSimulator/Devices/A7985F82-4E84-495E-A6CB-E044927B1F02/data/private/var/protected/trustd/private/TrustStore.sqlite3
Traceback (most recent call last):
  File "/Users/p.querner/projects/apps/ios/ADVTrustStore/iosCertTrustManager.py", line 796, in <module>
    program.run()
  File "/Users/p.querner/projects/apps/ios/ADVTrustStore/iosCertTrustManager.py", line 785, in run
    self.import_to_simulator(args.certificate_file, args.truststore)
  File "/Users/p.querner/projects/apps/ios/ADVTrustStore/iosCertTrustManager.py", line 691, in import_to_simulator
    tstore.add_certificate(cert)
  File "/Users/p.querner/projects/apps/ios/ADVTrustStore/iosCertTrustManager.py", line 507, in add_certificate
    self._add_record(certificate.get_fingerprint(self._hash), certificate.get_subject_ASN1(),
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/p.querner/projects/apps/ios/ADVTrustStore/iosCertTrustManager.py", line 404, in get_subject_ASN1
    decoder.start(self._data)
  File "/Users/p.querner/projects/apps/ios/ADVTrustStore/iosCertTrustManager.py", line 220, in start
    raise Error('Expecting string instance.')
Error: Expecting string instance.

Cert:

cat ~/.mitmproxy/mitmproxy-ca-cert.pem
-----BEGIN CERTIFICATE-----
MIIDNTCCAh2gAwIBAgIU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Z5DPq6v
BjUcHj5ohyWE
-----END CERTIFICATE-----

The cert was issued with mitmproxy.

mitmdump --version
Mitmproxy: 10.0.0
Python:    3.11.4
OpenSSL:   OpenSSL 3.1.2 1 Aug 2023
Platform:  macOS-13.5-arm64-arm-64bit

Not sure what it means of if its related to the tool. If it isnt related, please close this issue.

@andrivet
Copy link
Contributor

This PR has not been merged because it has issues. Please report to the author of the PR, not here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants