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

  • Home
  • SEARCH
  • 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 6239093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:20:03+00:00 2026-05-24T11:20:03+00:00

I am encrypting data using CryptProtectData function and I am getting encrypted data in

  • 0

I am encrypting data using CryptProtectData function and I am getting encrypted data in LPBYTE format, I want to save that data into a file and then read back for decryption.

In order to write string in file, I used following one to convert LPBYTE data to CString:

CString strEncrUName = (wchar_t *)encryptedUN;

I even tried this one How to convert from BYTE array to CString in MFC? but still it’s not working.

Character set used is unicode.

Thanks in advance

  • 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-24T11:20:05+00:00Added an answer on May 24, 2026 at 11:20 am

    The encrypted data is a buffer of raw bytes, not characters. If you want to convert it to a string, you’ll have to encode it somehow, such as by converting it to Hex chars.

    eg. byte 0xd5 becomes 2 chars: “D5”

    Looping through each byte and converting it to hex chars is an easy exercice left up to the reader.

    Of course, you’ll have to convert it back to binary after you read the file.

    Are you sure you want to save it to a text file. Your other option is to save the binary encrypted data to a binary file: no need to convert to/from string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question discusses encrypting data on the iPhone using the crypt() function. As an
I am trying to make a program that Encrypts data using AES, then encrypts
i'm having a problem while encrypting some data in the file. i'm using simple
What is the difference between encrypting some data vs signing some data (using RSA)?
When I am encrypting 23 using MD5 encryption I am getting 37693cfc748049e45d87b8c7d8b9aacd this 32-character
I'm trying to encrypt a text file using Perl and then decrypt it using
I need to have a process that compiles daily data into an PDF that
here are my methods for encrypting and decrypting data using RSA: private RSACryptoServiceProvider _RSACSP
I have been using the PHP mcrypt module for encrypting sensitive data at my
HI, I am encrypting data with following PHP function: $enc_data = mcrypt_encrypt(MCRYPT_3DES, $_key, $_data,

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.