### 简要描述：
- AES/加密模式 ECB / 填充 PKCS7Padding / 数据块 128 位。加密密钥使用开放平台分配的 AppSecret。

**假设cards为：** 
```
[{"cardNo":"10001","cardPwd":"123456","expireTime":"2023-06-19 17:16:01"}]
```

**假设开放平台的 appSecret 为：** `00000000000000000000000000000000`

### .NET加密示例：

```csharp

var encryptCards = AES.EncryptAes(cards, appSecret);

//加密后的数据
encryptCards = "34APdvSJhWfr5wnzE4YzxAsI0gfI6pI/Njrj1UQMHJrZ8Dq9EWsDnln0pp08gn4KES4iQu9/f0Y8UMN4dGdSK67oi0Bc12/V8hrNxqoC3Lk=";

public class AES
{
    /// <summary>
    /// 获取Aes32位密钥
    /// </summary>
    /// <param name="key">Aes密钥字符串</param>
    /// <returns>Aes32位密钥</returns>
    static byte[] GetAesKey(string key)
    {
        if (string.IsNullOrEmpty(key))
        {
            throw new ArgumentNullException("key", "Aes密钥不能为空");
        }
        if (key.Length != 32)
        {
            throw new ArgumentNullException("key", "Aes密钥长度必须是32个字符");
        }
        return Encoding.UTF8.GetBytes(key);
    }
    
    
    /// <summary>
    /// Aes加密
    /// </summary>
    /// <param name="source">源字符串</param>
    /// <param name="key">aes密钥</param>
    /// <returns>加密后的字符串</returns>
    public static string EncryptAes(string source, string key)
    {
        try
        {
            using (AesCryptoServiceProvider aesProvider = new AesCryptoServiceProvider())
            {
                aesProvider.Key = GetAesKey(key);
                aesProvider.Mode = CipherMode.ECB;
                aesProvider.Padding = PaddingMode.PKCS7;
                using (ICryptoTransform cryptoTransform = aesProvider.CreateEncryptor())
                {
                    byte[] inputBuffers = Encoding.UTF8.GetBytes(source);
                    byte[] results = cryptoTransform.TransformFinalBlock(inputBuffers, 0, inputBuffers.Length);
                    return Convert.ToBase64String(results, 0, results.Length);
                }
            }
        }
        catch (Exception e)
        {
            return string.Empty;
        }
    }
}
```

### Java示例

```java
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.security.Security;
import java.util.Base64;

public class Main {
    static {
        Security.addProvider(new BouncyCastleProvider());
    }
    /**
     * AES/ECB/PKCS7Padding 加密
     *
     * @param plainText 明文字符串
     * @param secretKey 密钥（32 字符）
     * @return 加密后的 Base64 字符串
     * @throws Exception 加密过程中可能抛出的异常
     */
    public static String encrypt(String plainText, String secretKey) throws Exception {
        if (secretKey.length() != 32) {
            throw new IllegalArgumentException("密钥长度必须为 32 个字符");
        }
        byte[]  keyBytes = secretKey.getBytes("UTF-8");
        SecretKeySpec keySpec = new SecretKeySpec(keyBytes, "AES");

        // 打印密钥信息
        System.out.println("使用的密钥 (Base64): " + Base64.getEncoder().encodeToString(keyBytes));
        System.out.println("密钥长度 (字节): " + keyBytes.length);

        // 创建加密实例，使用 AES/ECB/PKCS7Padding 模式
        Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding");
        System.out.println("使用的加密提供者: " + cipher.getProvider());

        // 初始化加密模式
        cipher.init(Cipher.ENCRYPT_MODE, keySpec);

        // 执行加密并返回 Base64 编码结果
        byte[] encryptedBytes = cipher.doFinal(plainText.getBytes("UTF-8"));
        return Base64.getEncoder().encodeToString(encryptedBytes);

    }

    public static void main(String[] args) throws Exception {
        String plainText = "[{\"cardNo\":\"10001\",\"cardPwd\":\"123456\",\"expireTime\":\"2023-06-19 17:16:01\"}]";
        String secretKey = "0a091b3aa4324435aab703142518a8f7";
        String encrypted = encrypt(plainText, secretKey);
        System.out.println("最终加密结果: " + encrypted);
    }
}
```
