Topic Thread

Expand all | Collapse all

How do i encrypt & decrypt input parameter

  • 1.  How do i encrypt & decrypt input parameter

    Posted 06-04-2020 10:00
    Hi,

    I want to encrypt & decrypt input parameter by using AES-256 AesCryptoService scheme, can some one please help me out how do i achieve encryption & decryption in my object or process.

    Thanks
    Amit

    ------------------------------
    Amit Chauhan
    ------------------------------


  • 2.  RE: How do i encrypt & decrypt input parameter

    Posted 06-04-2020 13:25
    You can extend the Utility Encryption VBO to do AES256 encryption.

    ------------------------------
    Gopal Bhaire
    Analyst
    Accenture
    ------------------------------



  • 3.  RE: How do i encrypt & decrypt input parameter

    Posted 06-04-2020 18:35
    Thanks!!
    I have used Utility Encryption, But utility support DESCryptoService and i have to use AES, 
    It would be great help if you can do let me know how do i extend Encryption VBO for AES256 

    ------------------------------
    Amit Chauhan
    ------------------------------



  • 4.  RE: How do i encrypt & decrypt input parameter

    Posted 06-05-2020 14:26
    Refer https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.aes?view=netcore-3.1  you can write something like this. Here I am creating key and then passing it to encrypt 
    Action: Generate Key
    Output: key, IV and store in Credential Management
    
    Using myAes As Aes = Aes.Create()
    	key = Convert.ToBase64String(myAes.Key)
    	IV = Convert.ToBase64String(myAes.IV)
    End Using
    ++++++++++++++++++++++++++++++++++++++++++++++++
    Action: Encrypt
    Input: Key, IV,(from, Credential Management) plaintext 
    Output: encrypted
    
    Using aesAlg As Aes = Aes.Create()
            aesAlg.Key = Key
            aesAlg.IV = IV
            Dim encryptor As ICryptoTransform = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV)
    
            Using msEncrypt As MemoryStream = New MemoryStream()
    
                Using csEncrypt As CryptoStream = New CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write)
    
                    Using swEncrypt As StreamWriter = New StreamWriter(csEncrypt)
                        swEncrypt.Write(plainText)
                    End Using
    
                    encrypted = msEncrypt.ToArray()
                End Using
            End Using
        End Using
    
    encrypted = Convert.ToBase64String(encrypted)​


    ------------------------------
    Gopal Bhaire
    Analyst
    Accenture
    ------------------------------



  • 5.  RE: How do i encrypt & decrypt input parameter

    Posted 06-05-2020 20:19
    Thanks a lot , 
    You made my day !!!!

    ------------------------------
    Amit Chauhan
    ------------------------------



  • 6.  RE: How do i encrypt & decrypt input parameter

    Posted 06-15-2020 18:27
    Thanks Gopal  for your help!!

    As suggested by you, I have used [(encStream As New CryptoStream(ms, _encStream As New CryptoStream(ms, _ aes.CreateEncryptor(keyb, aes.IV), CryptoStreamMode.Write) Dim sw As New StreamWriter(encStream))] code and AES256 encryption algo  and it is working fine for me. 

    Thanks a lot.




    ------------------------------
    Amit Chauhan
    ------------------------------