/var/opt/nydus/ops/oscrypto/_win/__pycache__
Edit: /var/opt/nydus/ops/oscrypto/_win/__pycache__/symmetric.cpython-312.pyc (31697B)
Njx R d dl mZmZmZmZ ddlmZ ddlmZm Z m
Z
mZmZm
Z
mZmZmZmZ ddlmZ ddlmZ ddlmZmZ e Zed k( rdd
lmZmZmZmZmZ nddl m!Z!m"Z"mZm#Z#m$Z$ g dZ%d
Z&d Z'd Z(d Z)d Z*d Z+d Z,d Z-d Z.d Z/d Z0d Z1d Z2d Z3d Z4d Z5d Z6d Z7d Z8d Z9y!)" )unicode_literalsdivisionabsolute_importprint_function )pretty_message)
buffer_from_bytesbytes_from_bufferderefnewnullpointer_setstructstruct_bytesunwrapwrite_to_buffer )
rand_bytes)backend) type_namebyte_cls winlegacy)advapi32
Advapi32Consthandle_erroropen_context_handleclose_context_handle)bcryptBcryptConstr open_alg_handleclose_alg_handle)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 L t | dvrt t dt | |st d }n,t | dk7 rt t dt | t | dz dk7 rt t dt | |t d| ||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 the OS crypto library
:return:
A tuple of two byte strings (iv, ciphertext)
o
key must be either 16, 24 or 32 bytes (128, 192 or 256 bits)
long - is %s
r0 :
iv must be 16 bytes long - is %s
r zJ
data must be a multiple of 16 bytes long - is %s
aesFlen
ValueErrorr r _encryptkeydataivs H/opt/nydus/tmp/pip-target-a90h98xg/lib/python/oscrypto/_win/symmetric.pyr# r# - s 2 3x|#
H
^ RB
G
4y2~
I
T2u566 c t | dvrt t dt | t | dk7 rt t dt | t d| ||d S )a[
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 the OS crypto library
:return:
A byte string of the plaintext
r/ r3 r0 r4 r5 Fr7 r8 r _decryptr: s r> r" r" d sv . 3x|#
H
2w"}
G
E3b%00r? c t | dvrt t dt | |st d }n,t | dk7 rt t dt | |t d| ||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 the OS crypto library
:return:
A tuple of two byte strings (iv, ciphertext)
r/ r3 r0 r4 r5 Tr6 r: s r> r% r% s 0 3x|#
H
^ RB
G
T2t455r? c t | dvrt t dt | t | dk7 rt t dt | t d| ||d S )aG
Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key
: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 the OS crypto library
:return:
A byte string of the plaintext
r/ r3 r0 r4 r5 TrA r: s r> r$ r$ sv , 3x|#
H
2w"}
G
E3b$//r? c t | dk st | dkD rt t dt | t d| |dd S )a
Encrypts plaintext using RC4 with a 40-128 bit key
:param key:
The encryption key - a byte string 5-16 bytes long
:param data:
The plaintext - a byte string
: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 the OS crypto library
:return:
A byte string of the ciphertext
r0 Q
key must be 5 to 16 bytes (40 to 128 bits) long - is %s
rc4N)r7 r8 r r9 r; r<