com.supermap.data

类 AESCipher

  • java.lang.Object
    • com.supermap.data.InternalHandle
      • com.supermap.data.InternalHandleDisposable
        • com.supermap.data.AESCipher
  • 所有已实现的接口:
    IDisposable


    public class AESCipher
    extends com.supermap.data.InternalHandleDisposable
    AES加解密工具, 目前支持CTR和CBC模式
    示范代码:
    示范如何使用AES加解密工具
    // 密钥key 长度必须是 32 byte即256 bit
    String key = "12345678abcdefgh12345678abcdefgh";
    // 初始向量iv 长度必须是 16 byte即128 bit
    String iv = "12345678abcdefgh";
    
    String msg = "Hello the world!";
    AESCipher cipher = AESCipher.getInstance("CTR", key.getBytes(), iv.getBytes());
    
    byte[] encrypted = cipher.encrypt(msg.getBytes());
    
    byte[] result = cipher.decrypt(encrypted);
    
    String resultString = new String(result);
    
    • 构造器详细资料

      • AESCipher

        public AESCipher()

Copyright © 2021–2024 SuperMap. All rights reserved.