/var/opt/nydus/ops/oscrypto/_openssl/__pycache__
Edit: /var/opt/nydus/ops/oscrypto/_openssl/__pycache__/symmetric.cpython-312.pyc (24519B)
Nj[ d dl mZmZmZmZ d dlZddlmZ ddlm Z m
Z
mZmZm
Z
mZ ddlmZmZmZmZ ddlmZ dd lmZmZ g d
Zd Zd Zd
Zd Zd Zd Zd Z d Z!d Z"d Z#d Z$d Z%d Z&d Z'd Z(d Z)y) )unicode_literalsdivisionabsolute_importprint_functionN )pretty_message)newnullis_nullbuffer_from_bytesbytes_from_bufferderef ) libcryptolibcrypto_legacy_supportLibcryptoConsthandle_openssl_error)
rand_bytes) type_namebyte_cls)aes_cbc_no_padding_decryptaes_cbc_no_padding_encryptaes_cbc_pkcs7_decryptaes_cbc_pkcs7_encryptdes_cbc_pkcs5_decryptdes_cbc_pkcs5_encryptrc2_cbc_pkcs5_decryptrc2_cbc_pkcs5_encryptrc4_decryptrc4_encrypttripledes_cbc_pkcs5_decrypttripledes_cbc_pkcs5_encryptc t | }|st d }n,t | dk7 rt t dt | t | dz dk7 rt t dt | |t || ||d fS )a
Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and
no padding. This means the ciphertext must be an exact multiple of 16 bytes
long.
:param key:
The encryption key - a byte string either 16, 24 or 32 bytes long
:param data:
The plaintext - a byte string
:param iv:
The initialization vector - either a byte string 16-bytes long or None
to generate an IV
:raises:
ValueError - when any of the parameters contain an invalid value
TypeError - when any of the parameters are of the wrong type
OSError - when an error is returned by OpenSSL
:return:
A tuple of two byte strings (iv, ciphertext)
:
iv must be 16 bytes long - is %s
r zJ
data must be a multiple of 16 bytes long - is %s
F_calculate_aes_cipherr len
ValueErrorr _encryptkeydataivciphers L/opt/nydus/tmp/pip-target-a90h98xg/lib/python/oscrypto/_openssl/symmetric.pyr r s 2 #3
'F
^ RB
G
4y2~
I
dB677 c t | }t | dk7 rt t dt | t || ||d S )aM
Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key and no
padding.
:param key:
The encryption key - a byte string either 16, 24 or 32 bytes long
:param data:
The ciphertext - a byte string
:param iv:
The initialization vector - a byte string 16-bytes long
:raises:
ValueError - when any of the parameters contain an invalid value
TypeError - when any of the parameters are of the wrong type
OSError - when an error is returned by OpenSSL
:return:
A byte string of the plaintext
r$ r% Fr' r( r) r _decryptr+ s r0 r r M sP . #3
'F
2w"}
G
FCr511r1 c t | }|st d }n,t | dk7 rt t dt | |t || ||d fS )a
Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and
PKCS#7 padding.
:param key:
The encryption key - a byte string either 16, 24 or 32 bytes long
:param data:
The plaintext - a byte string
:param iv:
The initialization vector - either a byte string 16-bytes long or None
to generate an IV
:raises:
ValueError - when any of the parameters contain an invalid value
TypeError - when any of the parameters are of the wrong type
OSError - when an error is returned by OpenSSL
:return:
A tuple of two byte strings (iv, ciphertext)
r$ r% Tr&