Secure Exchanges SDK Documentation
Search Results for

    Show / Hide Table of Contents

    Encryption Basic Concepts

    This guide explains the cryptographic concepts used by the SDK.

    Algorithms Used

    Algorithm Usage Key Size
    AES-256 Data encryption 256 bits
    RSA Key exchange 2048+ bits
    SHA-512 Hashing/Integrity 512 bits
    SHA-256 Fast hashing 256 bits
    MD5 Legacy verification 128 bits

    AES Key Generation

    using SecureExchangesSDK.Helpers;
    
    // Generate key/IV pair
    var keys = CryptoHelper.GenerateAESKeys();
    byte[] key = keys.Key;   // 32 bytes (256 bits)
    byte[] iv = keys.IV;     // 16 bytes (128 bits)
    
    // Or in Base64
    string base64Key = keys.Base64Key;
    string base64IV = keys.Base64IV;
    

    Data Encryption

    Text Encryption

    // Encrypt
    string plainText = "Sensitive data";
    byte[] encrypted = CryptoHelper.EncryptStringToBytes(plainText, key, iv);
    string base64Encrypted = Convert.ToBase64String(encrypted);
    
    // Decrypt
    byte[] encryptedBytes = Convert.FromBase64String(base64Encrypted);
    string decrypted = CryptoHelper.DecryptStringFromBytes(encryptedBytes, key, iv);
    

    Binary Data Encryption

    // Encrypt bytes
    byte[] data = File.ReadAllBytes("document.pdf");
    byte[] encrypted = CryptoHelper.EncryptBinary(data, key, iv);
    
    // Decrypt
    byte[] decrypted = CryptoHelper.DecryptBinary(encrypted, key, iv);
    

    Hashing

    // SHA-512 of a file
    string sha512 = CryptoHelper.GetSHA512OfFile(@"C:\document.pdf");
    
    // SHA-512 of bytes
    string sha512 = CryptoHelper.GetSHA512HashOfBytes(data);
    
    // SHA-512 of a string
    string sha512 = CryptoHelper.GetSHA512HashOfString("text");
    
    // MD5 of a file (for compatibility)
    string md5 = CryptoHelper.GetMD5HashOfFile(@"C:\document.pdf");
    

    See Also

    • File Encryption
    • Key Management
    In this article
    Back to top Secure Exchanges Inc. - Documentation