Failed to remove the new line characters to the encoded base64 string,
As CRYPT_STRING_NOCRLF is used but it is not supported in Windows Server 2003 and Windows XP, How to get the desired result in windows xp and 2003 without using CRYPT_STRING_NOCRLF
Procedure TForm1.Button1Click(Sender: TObject);
var
sLen : Cardinal;
temp : String;
a : Array[0..1] of Byte = ($00,$00);
Begin
CryptBinaryToStringA(@a[0],Length(a),CRYPT_STRING_BASE64 Or CRYPT_STRING_NOCRLF,nil,@sLen);
SetLength(temp,sLen);
CryptBinaryToStringA(@a[0],Length(a),CRYPT_STRING_BASE64 Or CRYPT_STRING_NOCRLF ,@temp[1],@sLen);
ShowMessage(temp);
end;
Isn't it just to do this:
uses StrUtils;
Procedure TForm1.Button1Click(Sender: TObject);
var
sLen : Cardinal;
temp : String;
a : Array[0..1] of Byte = ($00,$00);
Begin
CryptBinaryToStringA(@a[0],Length(a),CRYPT_STRING_BASE64 Or CRYPT_STRING_NOCRLF,nil,@sLen);
SetLength(temp,sLen);
CryptBinaryToStringA(@a[0],Length(a),CRYPT_STRING_BASE64 Or CRYPT_STRING_NOCRLF ,@temp[1],@sLen);
temp:=StrReplace(temp,#13#10,'');
ShowMessage(temp);
end;
ie. replace the CR/LF pairs with empty strings to remove it from the output string?