|
| 1 | +""" |
| 2 | +This type stub file was generated by pyright. |
| 3 | +""" |
| 4 | + |
| 5 | +from .dependencies import Cryptodome_AES |
| 6 | + |
| 7 | +if Cryptodome_AES: |
| 8 | + def aes_cbc_decrypt_bytes(data, key, iv): # -> bytes: |
| 9 | + """ Decrypt bytes with AES-CBC using pycryptodome """ |
| 10 | + ... |
| 11 | + |
| 12 | + def aes_gcm_decrypt_and_verify_bytes(data, key, tag, nonce): # -> bytes: |
| 13 | + """ Decrypt bytes with AES-GCM using pycryptodome """ |
| 14 | + ... |
| 15 | + |
| 16 | +else: |
| 17 | + def aes_cbc_decrypt_bytes(data, key, iv): # -> bytes: |
| 18 | + """ Decrypt bytes with AES-CBC using native implementation since pycryptodome is unavailable """ |
| 19 | + ... |
| 20 | + |
| 21 | + def aes_gcm_decrypt_and_verify_bytes(data, key, tag, nonce): # -> bytes: |
| 22 | + """ Decrypt bytes with AES-GCM using native implementation since pycryptodome is unavailable """ |
| 23 | + ... |
| 24 | + |
| 25 | +def aes_cbc_encrypt_bytes(data, key, iv, **kwargs): # -> bytes: |
| 26 | + ... |
| 27 | + |
| 28 | +BLOCK_SIZE_BYTES = ... |
| 29 | +def unpad_pkcs7(data): |
| 30 | + ... |
| 31 | + |
| 32 | +def pkcs7_padding(data): |
| 33 | + """ |
| 34 | + PKCS#7 padding |
| 35 | +
|
| 36 | + @param {int[]} data cleartext |
| 37 | + @returns {int[]} padding data |
| 38 | + """ |
| 39 | + ... |
| 40 | + |
| 41 | +def pad_block(block, padding_mode): |
| 42 | + """ |
| 43 | + Pad a block with the given padding mode |
| 44 | + @param {int[]} block block to pad |
| 45 | + @param padding_mode padding mode |
| 46 | + """ |
| 47 | + ... |
| 48 | + |
| 49 | +def aes_ecb_encrypt(data, key, iv=...): # -> list[Unknown]: |
| 50 | + """ |
| 51 | + Encrypt with aes in ECB mode. Using PKCS#7 padding |
| 52 | +
|
| 53 | + @param {int[]} data cleartext |
| 54 | + @param {int[]} key 16/24/32-Byte cipher key |
| 55 | + @param {int[]} iv Unused for this mode |
| 56 | + @returns {int[]} encrypted data |
| 57 | + """ |
| 58 | + ... |
| 59 | + |
| 60 | +def aes_ecb_decrypt(data, key, iv=...): # -> list[Unknown]: |
| 61 | + """ |
| 62 | + Decrypt with aes in ECB mode |
| 63 | +
|
| 64 | + @param {int[]} data cleartext |
| 65 | + @param {int[]} key 16/24/32-Byte cipher key |
| 66 | + @param {int[]} iv Unused for this mode |
| 67 | + @returns {int[]} decrypted data |
| 68 | + """ |
| 69 | + ... |
| 70 | + |
| 71 | +def aes_ctr_decrypt(data, key, iv): # -> list[Unknown]: |
| 72 | + """ |
| 73 | + Decrypt with aes in counter mode |
| 74 | +
|
| 75 | + @param {int[]} data cipher |
| 76 | + @param {int[]} key 16/24/32-Byte cipher key |
| 77 | + @param {int[]} iv 16-Byte initialization vector |
| 78 | + @returns {int[]} decrypted data |
| 79 | + """ |
| 80 | + ... |
| 81 | + |
| 82 | +def aes_ctr_encrypt(data, key, iv): # -> list[Unknown]: |
| 83 | + """ |
| 84 | + Encrypt with aes in counter mode |
| 85 | +
|
| 86 | + @param {int[]} data cleartext |
| 87 | + @param {int[]} key 16/24/32-Byte cipher key |
| 88 | + @param {int[]} iv 16-Byte initialization vector |
| 89 | + @returns {int[]} encrypted data |
| 90 | + """ |
| 91 | + ... |
| 92 | + |
| 93 | +def aes_cbc_decrypt(data, key, iv): # -> list[Unknown]: |
| 94 | + """ |
| 95 | + Decrypt with aes in CBC mode |
| 96 | +
|
| 97 | + @param {int[]} data cipher |
| 98 | + @param {int[]} key 16/24/32-Byte cipher key |
| 99 | + @param {int[]} iv 16-Byte IV |
| 100 | + @returns {int[]} decrypted data |
| 101 | + """ |
| 102 | + ... |
| 103 | + |
| 104 | +def aes_cbc_encrypt(data, key, iv, *, padding_mode=...): # -> list[Unknown]: |
| 105 | + """ |
| 106 | + Encrypt with aes in CBC mode |
| 107 | +
|
| 108 | + @param {int[]} data cleartext |
| 109 | + @param {int[]} key 16/24/32-Byte cipher key |
| 110 | + @param {int[]} iv 16-Byte IV |
| 111 | + @param padding_mode Padding mode to use |
| 112 | + @returns {int[]} encrypted data |
| 113 | + """ |
| 114 | + ... |
| 115 | + |
| 116 | +def aes_gcm_decrypt_and_verify(data, key, tag, nonce): # -> list[Unknown]: |
| 117 | + """ |
| 118 | + Decrypt with aes in GBM mode and checks authenticity using tag |
| 119 | +
|
| 120 | + @param {int[]} data cipher |
| 121 | + @param {int[]} key 16-Byte cipher key |
| 122 | + @param {int[]} tag authentication tag |
| 123 | + @param {int[]} nonce IV (recommended 12-Byte) |
| 124 | + @returns {int[]} decrypted data |
| 125 | + """ |
| 126 | + ... |
| 127 | + |
| 128 | +def aes_encrypt(data, expanded_key): # -> list[Unknown]: |
| 129 | + """ |
| 130 | + Encrypt one block with aes |
| 131 | +
|
| 132 | + @param {int[]} data 16-Byte state |
| 133 | + @param {int[]} expanded_key 176/208/240-Byte expanded key |
| 134 | + @returns {int[]} 16-Byte cipher |
| 135 | + """ |
| 136 | + ... |
| 137 | + |
| 138 | +def aes_decrypt(data, expanded_key): # -> list[Unknown]: |
| 139 | + """ |
| 140 | + Decrypt one block with aes |
| 141 | +
|
| 142 | + @param {int[]} data 16-Byte cipher |
| 143 | + @param {int[]} expanded_key 176/208/240-Byte expanded key |
| 144 | + @returns {int[]} 16-Byte state |
| 145 | + """ |
| 146 | + ... |
| 147 | + |
| 148 | +def aes_decrypt_text(data, password, key_size_bytes): # -> bytes: |
| 149 | + """ |
| 150 | + Decrypt text |
| 151 | + - The first 8 Bytes of decoded 'data' are the 8 high Bytes of the counter |
| 152 | + - The cipher key is retrieved by encrypting the first 16 Byte of 'password' |
| 153 | + with the first 'key_size_bytes' Bytes from 'password' (if necessary filled with 0's) |
| 154 | + - Mode of operation is 'counter' |
| 155 | +
|
| 156 | + @param {str} data Base64 encoded string |
| 157 | + @param {str,unicode} password Password (will be encoded with utf-8) |
| 158 | + @param {int} key_size_bytes Possible values: 16 for 128-Bit, 24 for 192-Bit or 32 for 256-Bit |
| 159 | + @returns {str} Decrypted data |
| 160 | + """ |
| 161 | + ... |
| 162 | + |
| 163 | +RCON = ... |
| 164 | +SBOX = ... |
| 165 | +SBOX_INV = ... |
| 166 | +MIX_COLUMN_MATRIX = ... |
| 167 | +MIX_COLUMN_MATRIX_INV = ... |
| 168 | +RIJNDAEL_EXP_TABLE = ... |
| 169 | +RIJNDAEL_LOG_TABLE = ... |
| 170 | +def key_expansion(data): |
| 171 | + """ |
| 172 | + Generate key schedule |
| 173 | +
|
| 174 | + @param {int[]} data 16/24/32-Byte cipher key |
| 175 | + @returns {int[]} 176/208/240-Byte expanded key |
| 176 | + """ |
| 177 | + ... |
| 178 | + |
| 179 | +def iter_vector(iv): # -> Generator[Unknown, None, None]: |
| 180 | + ... |
| 181 | + |
| 182 | +def sub_bytes(data): # -> list[int]: |
| 183 | + ... |
| 184 | + |
| 185 | +def sub_bytes_inv(data): # -> list[int]: |
| 186 | + ... |
| 187 | + |
| 188 | +def rotate(data): |
| 189 | + ... |
| 190 | + |
| 191 | +def key_schedule_core(data, rcon_iteration): # -> list[int]: |
| 192 | + ... |
| 193 | + |
| 194 | +def xor(data1, data2): # -> list[Unknown]: |
| 195 | + ... |
| 196 | + |
| 197 | +def iter_mix_columns(data, matrix): # -> Generator[int, None, None]: |
| 198 | + ... |
| 199 | + |
| 200 | +def shift_rows(data): # -> list[Unknown]: |
| 201 | + ... |
| 202 | + |
| 203 | +def shift_rows_inv(data): # -> list[Unknown]: |
| 204 | + ... |
| 205 | + |
| 206 | +def shift_block(data): # -> list[Unknown]: |
| 207 | + ... |
| 208 | + |
| 209 | +def inc(data): |
| 210 | + ... |
| 211 | + |
| 212 | +def block_product(block_x, block_y): # -> list[int] | list[Unknown]: |
| 213 | + ... |
| 214 | + |
| 215 | +def ghash(subkey, data): # -> list[int] | list[Unknown]: |
| 216 | + ... |
| 217 | + |
| 218 | +__all__ = ['aes_cbc_decrypt', 'aes_cbc_decrypt_bytes', 'aes_ctr_decrypt', 'aes_decrypt_text', 'aes_decrypt', 'aes_ecb_decrypt', 'aes_gcm_decrypt_and_verify', 'aes_gcm_decrypt_and_verify_bytes', 'aes_cbc_encrypt', 'aes_cbc_encrypt_bytes', 'aes_ctr_encrypt', 'aes_ecb_encrypt', 'aes_encrypt', 'key_expansion', 'pad_block', 'pkcs7_padding', 'unpad_pkcs7'] |
0 commit comments