![]() |
Base64 encoding
I'm trying to translate some code from .net (I have it both in c# and VB.net) to Delphi Win32.
The code uses ![]() Is there a WIN32 equivalent? |
Re: Base64 encoding
Hello,
the Base64 format is well documented. ![]() |
Re: Base64 encoding
Zitat:
Delphi-Quellcode:
var
data: array of Byte; |
Re: Base64 encoding
What is the output, hex bytes or Base64 string?
|
Re: Base64 encoding
ToBase64 would be the readable form, i.e. the Base64 string.
|
Re: Base64 encoding
I'm a little confused. I should tell more about the purpose.
I want to create an .RDP file programmatically, with this file it's possible to start a Remote Desktop (Terminal) session. An RDP file contains an encrypted password which is encrypted with the ![]() However it also seems to be Base64 encoded, I found this here: ![]() ![]() and here: ![]() Edit: I forgot to mention: the resulting hashed password is a fixed size (always 1329) hex bytes like this: password 51:b:01000000D08C9DDF0115D1118C7A00C04FC297EB01000 00062BB0C5189FAB446A21158EC44C474F5 (removed the rest). |
Re: Base64 encoding
Hi Remko,
there is a function CryptStringToBinary() coming with the Crypto API (crypt32.dll, wincrypt.h), that could be of some value. Regards |
Re: Base64 encoding
Thanks, I'm going to look at. Meanwhile some progress:
I can now successfully create a .rdp file and logon with even though the hashed password I create is not the same size as the one that MS makes. The hashed password remains valid during the logon session of the logged on user (the user under who's account the password was hashed). Although this achieves the goal I had in mind, I'm curious as to how MS (mstsc.exe) does it. Debugging MSTSC.EXE while saving an RDP shows this sequence: CryptProtectData - CRYPT32.dll CryptUnprotectData - CRYPT32.dll CryptUnprotectData - CRYPT32.dll CryptProtectData - CRYPT32.dll It seems like the first CryptProtectData crypts the username (I passed Username as user) ![]() And the 2nd CryptProtectData the Password (I passed Password as the password string) ![]() Perhaps the 2 sequences are appended? Don't know why and where the Base64 comes in (yet). |
Re: Base64 encoding
Well it seems that in the sample code I found the Base64 is only used to display the encoded binary as hex string.
I made a new topic with the right topic title ![]() |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:25 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz