Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3217028
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:21:48+00:00 2026-05-17T15:21:48+00:00

Can anyone give me an example for encrypt and decrypt an image using .net

  • 0

Can anyone give me an example for encrypt and decrypt an image using .net with asp.net

I want this encryption to the image when I save it into sql server as binary data.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:21:49+00:00Added an answer on May 17, 2026 at 3:21 pm

    Finally I found the solution for this problem.
    I will add the code for helping who need that.

    Encryption method:

        Public Function EncryptStream(ByVal input As Byte()) As Byte()
        Dim rijn As New RijndaelManaged()
        Dim encrypted As Byte()
        Dim key As Byte() = New Byte() {&H22, &HC0, &H6D, &HCB, &H23, &HA6, _
         &H3, &H1B, &H5A, &H1D, &HD3, &H9F, _
         &H85, &HD, &HC1, &H72, &HED, &HF4, _
         &H54, &HE6, &HBA, &H65, &HC, &H22, _
         &H62, &HBE, &HF3, &HEC, &H14, &H81, _
         &HA8, &HA}
        '32
        Dim IV As Byte() = New Byte() {&H43, &HB1, &H93, &HB, &H1A, &H87, _
         &H52, &H62, &HFB, &H8, &HD, &HC0, _
         &HCA, &H40, &HC2, &HDB}
        '16
        'Get an encryptor.
        Dim encryptor As ICryptoTransform = rijn.CreateEncryptor(key, IV)
    
        'Encrypt the data.
        Dim msEncrypt As New MemoryStream()
        Dim csEncrypt As New CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write)
    
    
        'Write all data to the crypto stream and flush it.
        csEncrypt.Write(input, 0, input.Length)
        csEncrypt.FlushFinalBlock()
    
        'Get encrypted array of bytes.
        encrypted = msEncrypt.ToArray()
    
        Return encrypted
    
    End Function
    

    Decryption Method:

        Public Function DecryptStream(ByVal input As Byte()) As Byte()
        Dim rijn As New RijndaelManaged()
        Dim decrypted As Byte()
        Dim key As Byte() = New Byte() {&H22, &HC0, &H6D, &HCB, &H23, &HA6, _
         &H3, &H1B, &H5A, &H1D, &HD3, &H9F, _
         &H85, &HD, &HC1, &H72, &HED, &HF4, _
         &H54, &HE6, &HBA, &H65, &HC, &H22, _
         &H62, &HBE, &HF3, &HEC, &H14, &H81, _
         &HA8, &HA}
        '32
        Dim IV As Byte() = New Byte() {&H43, &HB1, &H93, &HB, &H1A, &H87, _
         &H52, &H62, &HFB, &H8, &HD, &HC0, _
         &HCA, &H40, &HC2, &HDB}
        '16 
    
    
        'Get a decryptor that uses the same key and IV as the encryptor.
        Dim decryptor As ICryptoTransform = rijn.CreateDecryptor(key, IV)
    
        'Now decrypt the previously encrypted message using the decryptor
        ' obtained in the above step.
        Dim msDecrypt As New MemoryStream(input)
        Dim csDecrypt As New CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read)
    
        decrypted = New Byte(input.Length - 1) {}
    
        'Read the data out of the crypto stream.
        csDecrypt.Read(decrypted, 0, decrypted.Length)
    
        Return decrypted
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to print the first 10000 prime numbers. Can anyone give me the
Can anyone give me an example (or point me in the right direction) on
Can anyone give me an example of a Java program which has two native
Can anyone give me a HTTP PUT request example code for Android?
For instance, like Font. Can anyone give a very simple example? Maybe just a
Can anyone give example about passing an object of a class as argument to
Can anyone give an example of pom.xml dependencies configuration that will make OpenEJB to
Can anyone give an example of how a string can be returned from a
Is there something like struct data type in PHP? Can anyone give me example
Can anyone give me a complete list of string manipulation function in Microsoft SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.