mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-10 07:12:20 -05:00
fix imports
This commit is contained in:
@@ -2,15 +2,16 @@ import base64
|
||||
import re
|
||||
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 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.config import Config
|
||||
|
||||
@@ -122,18 +123,15 @@ def validate_sns_cert(sns_payload):
|
||||
try:
|
||||
public_key = certificate.public_key()
|
||||
public_key.verify(
|
||||
signature,
|
||||
string_to_sign,
|
||||
padding.PKCS1v15(),
|
||||
hashes.SHA256() # or SHA1?
|
||||
signature, string_to_sign, padding.PKCS1v15(), hashes.SHA256() # or SHA1?
|
||||
)
|
||||
#oscrypto.asymmetric.rsa_pkcs1v15_verify(
|
||||
# oscrypto.asymmetric.rsa_pkcs1v15_verify(
|
||||
# oscrypto.asymmetric.load_certificate(certificate),
|
||||
# signature,
|
||||
# string_to_sign,
|
||||
# "sha1",
|
||||
#)
|
||||
# )
|
||||
return True
|
||||
#except oscrypto.errors.SignatureError:
|
||||
# except oscrypto.errors.SignatureError:
|
||||
except InvalidSignature:
|
||||
raise ValidationError("Invalid signature")
|
||||
|
||||
Reference in New Issue
Block a user