AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

Base64 encoding

Ein Thema von Remko · begonnen am 19. Mär 2007 · letzter Beitrag vom 20. Mär 2007
Antwort Antwort
Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#1

Base64 encoding

  Alt 19. Mär 2007, 15:35
I'm trying to translate some code from .net (I have it both in c# and VB.net) to Delphi Win32.
The code uses Convert.ToBase64String Method . According to MSDN: Converts an array of 8-bit unsigned integers to its equivalent String representation encoded with base 64 digits.

Is there a WIN32 equivalent?
  Mit Zitat antworten Zitat
Benutzerbild von DGL-luke
DGL-luke

Registriert seit: 1. Apr 2005
Ort: Bad Tölz
4.149 Beiträge
 
Delphi 2006 Professional
 
#2

Re: Base64 encoding

  Alt 19. Mär 2007, 15:38
Hello,


the Base64 format is well documented. http://de.wikipedia.org/wiki/Base64 could be your first source of information.
Lukas Erlacher
  Mit Zitat antworten Zitat
Benutzerbild von ste_ett
ste_ett

Registriert seit: 10. Sep 2004
Ort: Dülmen
464 Beiträge
 
Delphi 7 Professional
 
#3

Re: Base64 encoding

  Alt 19. Mär 2007, 16:01
Zitat von Remko:
I'm trying to translate some code from .net (I have it both in c# and VB.net) to Delphi Win32.
The code uses Convert.ToBase64String Method . According to MSDN: Converts an array of 8-bit unsigned integers to its equivalent String representation encoded with base 64 digits.

Is there a WIN32 equivalent?
8 bit unsigned integer is a normal Byte.
Delphi-Quellcode:
var
  data: array of Byte;
Stefan
"Geht nicht!" ist keine Fehlerbeschreibung und "Hab ich schon versucht!" keine Antwort!

Hey, it compiles! Ship it!
  Mit Zitat antworten Zitat
Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#4

Re: Base64 encoding

  Alt 19. Mär 2007, 16:04
What is the output, hex bytes or Base64 string?
  Mit Zitat antworten Zitat
Benutzerbild von DGL-luke
DGL-luke

Registriert seit: 1. Apr 2005
Ort: Bad Tölz
4.149 Beiträge
 
Delphi 2006 Professional
 
#5

Re: Base64 encoding

  Alt 19. Mär 2007, 16:05
ToBase64 would be the readable form, i.e. the Base64 string.
Lukas Erlacher
  Mit Zitat antworten Zitat
Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#6

Re: Base64 encoding

  Alt 19. Mär 2007, 16:18
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 MSDN-Library durchsuchenCryptProtectData API (this part I got working).
However it also seems to be Base64 encoded, I found this here:

http://bbs.vbstreets.ru/viewtopic.ph...2838b771a1fc69 (translated: http://www.google.com/translate?u=ht...&hl=en&ie=UTF8)

and here:
http://www.anappaday.com/downloads/2...p-manager.html

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).
  Mit Zitat antworten Zitat
marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#7

Re: Base64 encoding

  Alt 19. Mär 2007, 18:21
Hi Remko,

there is a function CryptStringToBinary() coming with the Crypto API (crypt32.dll, wincrypt.h), that could be of some value.

Regards
  Mit Zitat antworten Zitat
Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#8

Re: Base64 encoding

  Alt 19. Mär 2007, 18:45
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)
http://web.inter.nl.net/users/weijnen/dp/Info1.jpg
And the 2nd CryptProtectData the Password (I passed Password as the password string)
http://web.inter.nl.net/users/weijnen/dp/Info2.jpg

Perhaps the 2 sequences are appended? Don't know why and where the Base64 comes in (yet).
  Mit Zitat antworten Zitat
Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#9

Re: Base64 encoding

  Alt 20. Mär 2007, 09:44
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 Password hash in RDP files
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:21 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz