zoukankan      html  css  js  c++  java
  • Simple cryptography in Dynamics AX 2009

    There are methods in AX which allow to encrypt and decrypt data easily. Those methods are WinAPIServer::cryptProtectData() for encryption and WinAPIServer::cryptUnProtectData() for decryption. As input and output parameters these methods use CryptoBlob extended data type, which is a container. However, this is not an arbitrary container. It should contain only bytes (integers in the range 0-255). There are methods on the Global class which allow to convert from and to CryptoBlob type, for example, Global::binary2cryptoblob() and Global::cryptoblob2binary().

    Sample usage:

    public static void Jimmy_cryptoTest()
    {
        str             text = "xieyufan";
        str             decryptedText;
        CryptoBlob      CryptoBlobed;
    ;
        //字符串加密后变成数字类型
        CryptoBlobed = WinAPIServer::cryptProtectData(str2cryptoblob(text));
        global::conview(CryptoBlobed);
        
        //数字类型解密后变成字符串类型
        decryptedText = global::cryptoblob2str(WinAPIServer::cryptUnProtectData(CryptoBlobed));
        info("" + decryptedText);
    }
    
  • 相关阅读:
    第04组 Beta冲刺 (3/5)
    第04组 Beta冲刺 (2/5)
    第04组 Beta冲刺 (1/5)
    软工实践个人总结
    第09组 每周小结(3/3)
    第09组 每周小结(2/3)
    第09组 每周小结(1/3)
    第09组 Beta冲刺 总结
    第09组 Beta冲刺 (5/5)
    第09组 Beta冲刺 (4/5)
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1887614.html
Copyright © 2011-2022 走看看