Skip to content

SNOW-186113: Intermittent KeyError: "No field numbered 1 is present in this asn1crypto.keys.PublicKeyInfo" #370

@Samira-El

Description

@Samira-El

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using (python --version)?
    Python 3.6.9

  2. What operating system and processor architecture are you using (python -c 'import platform; print(platform.platform())')?
    Linux-4.15.0-1060-aws-x86_64-with-Ubuntu-18.04-bionic

  3. What are the component versions in the environment (pip list)?

Package                       Version
----------------------------- ---------
asn1crypto                    1.3.0
attrs                         19.3.0
azure-common                  1.1.25
azure-storage-blob            2.1.0
azure-storage-common          2.1.0
backoff                       1.8.0
boto3                         1.10.8
botocore                      1.13.8
certifi                       2020.6.20
cffi                          1.14.0
chardet                       3.0.4
ciso8601                      2.1.3
cryptography                  2.9.2
docutils                      0.15.2
future                        0.18.2
idna                          2.7
ijson                         3.1.post0
importlib-metadata            1.7.0
inflection                    0.3.1
jmespath                      0.10.0
joblib                        0.13.2
jsonschema                    3.2.0
oscrypto                      1.2.0
pip                           20.2.2
pip-licenses                  2.2.1
pkg-resources                 0.0.0
PTable                        0.9.2
pycparser                     2.20
pycryptodomex                 3.9.8
PyJWT                         1.7.1
pyOpenSSL                     19.1.0
pyrsistent                    0.16.0
python-dateutil               2.8.1
pytz                          2020.1
requests                      2.22.0
s3transfer                    0.2.1
setuptools                    49.6.0
simplejson                    3.11.1
six                           1.15.0
snowflake-connector-python    2.0.3
urllib3                       1.24.3
zipp                          3.1.0
  1. What did you do?
    Can't reproduce it, because it happens only from time to time
    I can provide the code, the error happens somewhere in this block

  2. What did you expect to see?
    I expect to see no errors.

  3. What did you see instead?
    Getting KeyError: 'No field numbered 1 is present in this asn1crypto.keys.PublicKeyInfo' from time to time, like 0-5 times a day.

  4. Can you set logging to DEBUG and collect the logs?
    It's not easy to do for now, but here is the current logs I get

Traceback (most recent call last):
  File "/home/.../.virtualenvs/target-snowflake/lib/python3.6/site-packages/botocore/httpsession.py", line 263, in send
    chunked=self._chunked(request.headers),
  File "/home/.../.virtualenvs/target-snowflake/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/.../.virtualenvs/target-snowflake/lib/python3.6/site-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/home/.../.virtualenvs/target-snowflake/lib/python3.6/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
    conn.connect()
  File "/home/.../.virtualenvs/target-snowflake/lib/python3.6/site-packages/urllib3/connection.py", line 344, in connect
    ssl_context=context)
  File "/home/.../.virtualenvs/target-snowflake/lib/python3.6/site-packages/snowflake/connector/ssl_wrap_socket.py", line 396, in ssl_wrap_socket_with_ocsp
    ).validate(server_hostname, ret.connection)
  File "/home/.../.virtualenvs/target-snowflake/lib/python3.6/site-packages/snowflake/connector/ocsp_snowflake.py", line 996, in validate
    return self._validate(hostname, cert_data, telemetry_data, do_retry, no_exception)
  File "/home/.../.virtualenvs/target-snowflake/lib/python3.6/site-packages/snowflake/connector/ocsp_snowflake.py", line 1002, in _validate
    cert_data, telemetry_data, hostname, do_retry=do_retry)
  File "/home/.../.virtualenvs/target-snowflake/lib/python3.6/site-packages/snowflake/connector/ocsp_snowflake.py", line 1184, in _validate_certificates_sequential
    issuer, subject, telemetry_data, hostname, do_retry=do_retry)
  File "/home/.../.virtualenvs/target-snowflake/lib/python3.6/site-packages/snowflake/connector/ocsp_snowflake.py", line 1066, in validate_by_direct_connection
    cert_id, req = self.create_ocsp_request(issuer, subject)
  File "/home/.../.virtualenvs/target-snowflake/lib/python3.6/site-packages/snowflake/connector/ocsp_asn1crypto.py", line 104, in create_ocsp_request
    'issuer_key_hash': OctetString(issuer.public_key.sha1),
  File "/home/.../.virtualenvs/target-snowflake/lib/python3.6/site-packages/asn1crypto/keys.py", line 1249, in sha1
    self._sha1 = hashlib.sha1(byte_cls(self['public_key'])).digest()
  File "/home/.../.virtualenvs/target-snowflake/lib/python3.6/site-packages/asn1crypto/core.py", line 3505, in __getitem__
    type_name(self)
KeyError: 'No field numbered 1 is present in this asn1crypto.keys.PublicKeyInfo'

I would really appreciate some guidance on what's going wrong.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions