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

PermissionError: [Errno 13] Permission denied: 'C:\\Users\\username\\AppData\\Local\\Temp\\tmptgi2bs37.pem' #71

Open
Amr-Es opened this issue Jul 18, 2022 · 2 comments

Comments

@Amr-Es
Copy link

Amr-Es commented Jul 18, 2022

using it with pysaml2 gives this error
PermissionError: [Errno 13] Permission denied: 'C:\Users\username\AppData\Local\Temp\tmptgi2bs37.pem'
Full Trace

Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\site-packages\saml2\response.py", line 344, in _loads
    self.response = self.signature_check(
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1757, in correctly_signed_response
    self._check_signature(decoded_xml, response,
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1614, in _check_signature
    if self.verify_signature(
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1428, in verify_signature
    return self.crypto.validate_signature(
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1003, in validate_signature
    return xmlsec.verify(xml, cert_file)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\__init__.py", line 350, in verify
    return len(_verify(t, keyspec, sig_path)) > 0
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\__init__.py", line 312, in _verify
    this_cert = xmlsec.crypto.from_keyspec(keyspec, signature_element=sig)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\crypto.py", line 76, in from_keyspec
    key = _load_keyspec(keyspec, private, signature_element)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\crypto.py", line 255, in _load_keyspec
    return XMLSecCryptoFile(keyspec, private)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\crypto.py", line 141, in __init__
    with io.open(filename, "rb") as file:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Amr\\AppData\\Local\\Temp\\tmps_abq_kj.pem'
XML parse error: [Errno 13] Permission denied: 'C:\\Users\\Amr\\AppData\\Local\\Temp\\tmps_abq_kj.pem'
SAMLResponse Error
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\site-packages\djangosaml2\views.py", line 464, in post
    response = client.parse_authn_request_response(
  File "C:\Program Files\Python310\lib\site-packages\saml2\client_base.py", line 841, in parse_authn_request_response
    resp = self._parse_response(
  File "C:\Program Files\Python310\lib\site-packages\saml2\entity.py", line 1496, in _parse_response
    response = response.loads(xmlstr, False, origxml=xmlstr)
  File "C:\Program Files\Python310\lib\site-packages\saml2\response.py", line 528, in loads
    self._loads(xmldata, decode, origxml)
  File "C:\Program Files\Python310\lib\site-packages\saml2\response.py", line 344, in _loads
    self.response = self.signature_check(
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1757, in correctly_signed_response
    self._check_signature(decoded_xml, response,
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1614, in _check_signature
    if self.verify_signature(
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1428, in verify_signature
    return self.crypto.validate_signature(
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1003, in validate_signature
    return xmlsec.verify(xml, cert_file)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\__init__.py", line 350, in verify
    return len(_verify(t, keyspec, sig_path)) > 0
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\__init__.py", line 312, in _verify
    this_cert = xmlsec.crypto.from_keyspec(keyspec, signature_element=sig)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\crypto.py", line 76, in from_keyspec
    key = _load_keyspec(keyspec, private, signature_element)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\crypto.py", line 255, in _load_keyspec
    return XMLSecCryptoFile(keyspec, private)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\crypto.py", line 141, in __init__
    with io.open(filename, "rb") as file:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Amr\\AppData\\Local\\Temp\\tmps_abq_kj.pem'
@c00kiemon5ter
Copy link
Member

@Amr-Es can you please paste the complete stacktrace? (including the command you used, if you're using this package as a script)

@Amr-Es
Copy link
Author

Amr-Es commented Jul 18, 2022

@c00kiemon5ter I'm using DjangoSaml2 which use pysaml2, below is the full trace

Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\site-packages\saml2\response.py", line 344, in _loads
    self.response = self.signature_check(
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1757, in correctly_signed_response
    self._check_signature(decoded_xml, response,
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1614, in _check_signature
    if self.verify_signature(
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1428, in verify_signature
    return self.crypto.validate_signature(
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1003, in validate_signature
    return xmlsec.verify(xml, cert_file)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\__init__.py", line 350, in verify
    return len(_verify(t, keyspec, sig_path)) > 0
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\__init__.py", line 312, in _verify
    this_cert = xmlsec.crypto.from_keyspec(keyspec, signature_element=sig)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\crypto.py", line 76, in from_keyspec
    key = _load_keyspec(keyspec, private, signature_element)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\crypto.py", line 255, in _load_keyspec
    return XMLSecCryptoFile(keyspec, private)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\crypto.py", line 141, in __init__
    with io.open(filename, "rb") as file:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Amr\\AppData\\Local\\Temp\\tmps_abq_kj.pem'
XML parse error: [Errno 13] Permission denied: 'C:\\Users\\Amr\\AppData\\Local\\Temp\\tmps_abq_kj.pem'
SAMLResponse Error
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\site-packages\djangosaml2\views.py", line 464, in post
    response = client.parse_authn_request_response(
  File "C:\Program Files\Python310\lib\site-packages\saml2\client_base.py", line 841, in parse_authn_request_response
    resp = self._parse_response(
  File "C:\Program Files\Python310\lib\site-packages\saml2\entity.py", line 1496, in _parse_response
    response = response.loads(xmlstr, False, origxml=xmlstr)
  File "C:\Program Files\Python310\lib\site-packages\saml2\response.py", line 528, in loads
    self._loads(xmldata, decode, origxml)
  File "C:\Program Files\Python310\lib\site-packages\saml2\response.py", line 344, in _loads
    self.response = self.signature_check(
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1757, in correctly_signed_response
    self._check_signature(decoded_xml, response,
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1614, in _check_signature
    if self.verify_signature(
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1428, in verify_signature
    return self.crypto.validate_signature(
  File "C:\Program Files\Python310\lib\site-packages\saml2\sigver.py", line 1003, in validate_signature
    return xmlsec.verify(xml, cert_file)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\__init__.py", line 350, in verify
    return len(_verify(t, keyspec, sig_path)) > 0
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\__init__.py", line 312, in _verify
    this_cert = xmlsec.crypto.from_keyspec(keyspec, signature_element=sig)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\crypto.py", line 76, in from_keyspec
    key = _load_keyspec(keyspec, private, signature_element)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\crypto.py", line 255, in _load_keyspec
    return XMLSecCryptoFile(keyspec, private)
  File "C:\Program Files\Python310\lib\site-packages\xmlsec\crypto.py", line 141, in __init__
    with io.open(filename, "rb") as file:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Amr\\AppData\\Local\\Temp\\tmps_abq_kj.pem'

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