mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-10 23:32:27 -05:00
fix imports
This commit is contained in:
@@ -2,15 +2,16 @@ import base64
|
|||||||
import re
|
import re
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
#import oscrypto.asymmetric
|
|
||||||
#import oscrypto.errors
|
|
||||||
from cryptography import x509
|
|
||||||
from cryptography.hazmat.primitives import hashes
|
|
||||||
from cryptography.hazmat.primitives.asymmetric import padding
|
|
||||||
from cryptography.exceptions import InvalidSignature
|
|
||||||
import requests
|
import requests
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
# import oscrypto.asymmetric
|
||||||
|
# import oscrypto.errors
|
||||||
|
from cryptography import x509
|
||||||
|
from cryptography.exceptions import InvalidSignature
|
||||||
|
from cryptography.hazmat.primitives import hashes
|
||||||
|
from cryptography.hazmat.primitives.asymmetric import padding
|
||||||
|
|
||||||
from app import redis_store
|
from app import redis_store
|
||||||
from app.config import Config
|
from app.config import Config
|
||||||
|
|
||||||
@@ -122,18 +123,15 @@ def validate_sns_cert(sns_payload):
|
|||||||
try:
|
try:
|
||||||
public_key = certificate.public_key()
|
public_key = certificate.public_key()
|
||||||
public_key.verify(
|
public_key.verify(
|
||||||
signature,
|
signature, string_to_sign, padding.PKCS1v15(), hashes.SHA256() # or SHA1?
|
||||||
string_to_sign,
|
|
||||||
padding.PKCS1v15(),
|
|
||||||
hashes.SHA256() # or SHA1?
|
|
||||||
)
|
)
|
||||||
#oscrypto.asymmetric.rsa_pkcs1v15_verify(
|
# oscrypto.asymmetric.rsa_pkcs1v15_verify(
|
||||||
# oscrypto.asymmetric.load_certificate(certificate),
|
# oscrypto.asymmetric.load_certificate(certificate),
|
||||||
# signature,
|
# signature,
|
||||||
# string_to_sign,
|
# string_to_sign,
|
||||||
# "sha1",
|
# "sha1",
|
||||||
#)
|
# )
|
||||||
return True
|
return True
|
||||||
#except oscrypto.errors.SignatureError:
|
# except oscrypto.errors.SignatureError:
|
||||||
except InvalidSignature:
|
except InvalidSignature:
|
||||||
raise ValidationError("Invalid signature")
|
raise ValidationError("Invalid signature")
|
||||||
|
|||||||
Reference in New Issue
Block a user