Я пытаюсь реализовать Cognito MFA с помощью электронной почты. Следуя документации здесь: https://docs.aws.amazon.com/cognito/lat ... ender.html
Я используя лямбда-выражение Python, которое запускается Cognito, когда пользователь вводит свой пароль пользователя+пароль. Однако при работе с библиотекой aws-encryption-sdk-python я получаю следующую ошибку:
Traceback (most recent call last):
File "/var/task/aws_encryption_sdk/internal/formatting/deserialize.py", line 87, in _verified_version_from_id
return SerializationVersion(version_id)
File "/var/lang/lib/python3.9/enum.py", line 384, in __call__
return cls.__new__(cls, value)
File "/var/lang/lib/python3.9/enum.py", line 702, in __new__
raise ve_exc
ValueError: 65 is not a valid SerializationVersion
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/var/task/aws_encryption_sdk/__init__.py", line 186, in decrypt
plaintext = decryptor.read()
File "/var/task/aws_encryption_sdk/streaming_client.py", line 250, in read
self._prep_message()
File "/var/task/aws_encryption_sdk/streaming_client.py", line 782, in _prep_message
self._header, self.header_auth = self._read_header()
File "/var/task/aws_encryption_sdk/streaming_client.py", line 797, in _read_header
header, raw_header = deserialize_header(self.source_stream, self.config.max_encrypted_data_keys)
File "/var/task/aws_encryption_sdk/internal/formatting/deserialize.py", line 336, in deserialize_header
version = _verified_version_from_id(version_id)
File "/var/task/aws_encryption_sdk/internal/formatting/deserialize.py", line 89, in _verified_version_from_id
raise NotSupportedError("Unsupported version
{}
".format(version_id), error)
aws_encryption_sdk.exceptions.NotSupportedError: ('Unsupported version 65', ValueError('65 is not a valid SerializationVersion'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/var/task/aws_encryption_sdk/streaming_client.py", line 218, in __exit__
self.close()
File "/var/task/aws_encryption_sdk/streaming_client.py", line 985, in close
raise SerializationError("Footer not read")
aws_encryption_sdk.exceptions.SerializationError: Footer not read
Я нигде не устанавливаю версию 65. Это мой код, и я уже проверил, что переменные env передаются правильно:
Я пытаюсь реализовать Cognito MFA с помощью электронной почты. Следуя документации здесь: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-sms-sender.html Я используя лямбда-выражение Python, которое запускается Cognito, когда пользователь вводит свой пароль пользователя+пароль. Однако при работе с библиотекой aws-encryption-sdk-python я получаю следующую ошибку: [code]Traceback (most recent call last): File "/var/task/aws_encryption_sdk/internal/formatting/deserialize.py", line 87, in _verified_version_from_id return SerializationVersion(version_id) File "/var/lang/lib/python3.9/enum.py", line 384, in __call__ return cls.__new__(cls, value) File "/var/lang/lib/python3.9/enum.py", line 702, in __new__ raise ve_exc ValueError: 65 is not a valid SerializationVersion
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/var/task/aws_encryption_sdk/__init__.py", line 186, in decrypt plaintext = decryptor.read() File "/var/task/aws_encryption_sdk/streaming_client.py", line 250, in read self._prep_message() File "/var/task/aws_encryption_sdk/streaming_client.py", line 782, in _prep_message self._header, self.header_auth = self._read_header() File "/var/task/aws_encryption_sdk/streaming_client.py", line 797, in _read_header header, raw_header = deserialize_header(self.source_stream, self.config.max_encrypted_data_keys) File "/var/task/aws_encryption_sdk/internal/formatting/deserialize.py", line 336, in deserialize_header version = _verified_version_from_id(version_id) File "/var/task/aws_encryption_sdk/internal/formatting/deserialize.py", line 89, in _verified_version_from_id raise NotSupportedError("Unsupported version {} ".format(version_id), error) aws_encryption_sdk.exceptions.NotSupportedError: ('Unsupported version 65', ValueError('65 is not a valid SerializationVersion'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/var/task/aws_encryption_sdk/streaming_client.py", line 218, in __exit__ self.close() File "/var/task/aws_encryption_sdk/streaming_client.py", line 985, in close raise SerializationError("Footer not read") aws_encryption_sdk.exceptions.SerializationError: Footer not read [/code] Я нигде не устанавливаю версию 65. Это мой код, и я уже проверил, что переменные env передаются правильно: [code]import os import json import boto3 from botocore.exceptions import ClientError from common.utils import * from common.sqlUtils import * from common.authentication import * from common.authorization import * from common.exceptions import GeneralException from sendgrid import SendGridAPIClient from sendgrid.helpers.mail import Mail import aws_encryption_sdk from aws_encryption_sdk.identifiers import CommitmentPolicy
# Configure the encryption SDK client with the KMS key from the environment variables. awsEncryptionSdkClient = aws_encryption_sdk.EncryptionSDKClient( commitment_policy=CommitmentPolicy.REQUIRE_ENCRYPT_REQUIRE_DECRYPT ) decryptionKeyArn = os.environ["cognitoCodeEncryptionKeyArn"] kms_key_provider = aws_encryption_sdk.StrictAwsKmsMasterKeyProvider( key_ids=[decryptionKeyArn] )
def sendEmail(event, context): try: #TODO check if email is verified, user is confirmed, etc
plaintextCode = None if "request" in event and "code" in event["request"]: print("Line 35: ", event) encryptedCode = event["request"]["code"] print("encryptedCode: ", encryptedCode) print("decryptionKeyArn ", decryptionKeyArn) plaintextCode, plaintextHeader = awsEncryptionSdkClient.decrypt( source=encryptedCode, key_provider=kms_key_provider ) print("plaintextCode:", plaintextCode)
subject = None html_content = None if plaintextCode is not None: subject = 'Code' html_content = f'[b]Your code is: {plaintextCode}[/b]'
Я пытаюсь реализовать Cognito MFA с помощью электронной почты. Следуя документации здесь:
Я используя лямбда-выражение Python, которое запускается Cognito, когда пользователь вводит свой пароль пользователя+пароль. Однако при работе с библиотекой...
Попытка переместить приложение от JDK 8 в JDK 21 и получить проблему с AWS.
Я использую Eclipse и подталкивает меня, чтобы добавить их в модуль info.java
в моем pom.xml, я тяну в следующем:
xml.
com.amazonaws
aws-java-sdk-s3
1.12.642
Попытка переместить приложение от JDK 8 в JDK 21 и получить проблему с AWS.
Я использую Eclipse и подталкивает меня, чтобы добавить их в модуль info.java
в моем pom.xml, я тяну в следующем:
xml.
com.amazonaws
aws-java-sdk-s3
1.12.642
Мои модули используют роль группы узлов вместо роли, определенной учетной записью службы. Конфигурация учетной записи службы кажется правильной, потому что когда я запускаю kubectl exec pod_name --env | grep AWS Переменные env AWS_ROLE_ARN и...
Я знаю, что в Python есть встроенный оператор XOR, который может быть импортирован.
Я пытаюсь выполнить шифрование /дешифрование XOR. Пока что у меня есть:
def xor_attmpt():
message = raw_input( Enter message to be ciphered: )
cipher = []
for i...