Thursday, April 8, 2010

Simple cryptography in AX

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 cryptoTest()
{
    str text = "Here goes some text";
    CryptoBlob encryptedCryptoBlob;
    str decryptedText;
    ;

    encryptedCryptoBlob = WinAPIServer::cryptProtectData(str2cryptoblob(text));
    conview(encryptedCryptoBlob);
    decryptedText = cryptoblob2str(WinAPIServer::cryptUnProtectData(encryptedCryptoBlob));
    info(decryptedText);
}

12 comments:

  1. We're a group of volunteers and starting a new scheme in our community. Your site offered us with valuable information to work on. You have done a formidable job and our entire community will be thankful to you.

    Here is my page - Muscle Maximizer Review

    ReplyDelete
  2. If you want to improve your know-how only keep visiting this website and be updated with the newest information posted here.


    Feel free to visit my webpage Order Pure GCE

    ReplyDelete
  3. I do consider all of the concepts you have presented to
    your post. They're very convincing and can definitely work. Nonetheless, the posts are very brief for novices. May you please lengthen them a little from next time? Thanks for the post.

    My web blog :: Sapphire Electronic Cigarette

    ReplyDelete
  4. Great blog you have here but I was wondering if you knew of
    any message boards that cover the same topics talked about here?
    I'd really like to be a part of community where I can get advice from other knowledgeable people that share the same interest. If you have any recommendations, please let me know. Kudos!

    Also visit my page ... Buy Pur Essence

    ReplyDelete
  5. Great weblog here! Additionally your website lots up fast! What host are you using?

    Can I am getting your associate hyperlink in your host?

    I desire my website loaded up as quickly as yours lol

    Feel free to visit my webpage top anti aging products

    ReplyDelete
  6. Hi! This is my first visit to your blog! We are a collection of volunteers and starting a new project in a community in
    the same niche. Your blog provided us useful information to work on.
    You have done a marvellous job!

    Feel free to visit my site; Pure GCE REviews

    ReplyDelete
  7. Hi, after reading this awesome paragraph i am also glad to share
    my know-how here with mates.

    Look at my page ... Pay day loan lenders

    ReplyDelete
  8. Hi! Quick question that's totally off topic. Do you know how to make your site mobile friendly? My site looks weird when browsing from my apple iphone. I'm trying to find a theme or plugin that might be able
    to fix this problem. If you have any recommendations, please
    share. With thanks!

    My page ... Lift serum pro review

    ReplyDelete
  9. I'd like to find out more? I'd love to find out
    more details.

    Visit my web-site ... Vapoer e

    ReplyDelete
  10. Have you ever considered publishing an e-book or guest authoring on other websites?
    I have a blog based on the same information you discuss and would really like to have you share
    some stories/information. I know my subscribers would value your work.
    If you are even remotely interested, feel free to shoot me an e-mail.


    Feel free to visit my site muscle enhancers

    ReplyDelete
  11. I want to to thank you for this good read!! I certainly enjoyed every little bit of it.

    I have you bookmarked to check out new things you post…

    payday loan online

    ReplyDelete