【调度系统】广东民航医疗快线调度系统源代码
克樊道人
2024-12-02 61ce8cc6883e5f94e6470141df3484167caf31ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php declare(strict_types=1);
 
namespace WeChatPay\Crypto;
 
/**
 * Advanced Encryption Standard Interface
 */
interface AesInterface
{
    /**
     * Bytes Length of the AES block
     */
    public const BLOCK_SIZE = 16;
 
    /**
     * Bytes length of the AES secret key.
     */
    public const KEY_LENGTH_BYTE = 32;
 
    /**
     * Bytes Length of the authentication tag in AEAD cipher mode
     * @deprecated 1.0 - As of the OpenSSL described, the `auth_tag` length may be one of 16, 15, 14, 13, 12, 8 or 4.
     *                   Keep it only compatible for the samples on the official documentation.
     */
    public const AUTH_TAG_LENGTH_BYTE = 16;
 
    /**
     * The `aes-256-gcm` algorithm string
     */
    public const ALGO_AES_256_GCM = 'aes-256-gcm';
 
    /**
     * The `aes-256-ecb` algorithm string
     */
    public const ALGO_AES_256_ECB = 'aes-256-ecb';
 
    /**
     * Encrypts given data with given key and iv, returns a base64 encoded string.
     *
     * @param string $plaintext - Text to encode.
     * @param string $key - The secret key, 32 bytes string.
     * @param string $iv - The initialization vector, 16 bytes string.
     *
     * @return string - The base64-encoded ciphertext.
     */
    public static function encrypt(string $plaintext, string $key, string $iv = ''): string;
 
    /**
     * Takes a base64 encoded string and decrypts it using a given key and iv.
     *
     * @param string $ciphertext - The base64-encoded ciphertext.
     * @param string $key - The secret key, 32 bytes string.
     * @param string $iv - The initialization vector, 16 bytes string.
     *
     * @return string - The utf-8 plaintext.
     */
    public static function decrypt(string $ciphertext, string $key, string $iv = ''): string;
}