login about faq

Hello I try to use Delphi non activeX dll.

my actually task is to encrypt a binary document.

function TOmEncrypterPdf.DoEncrypt(data: RawUTF8; publickey: RawUTF8): Boolean;
var
  encryptedStr: PWideChar;
  key, str: PWideChar;
  bytes: HCkByteData;
  s: String;
begin
  key := PWideChar(WideString(publickey));
  str := PWideChar(WideString(data));
  bytes := CkByteData_Create();
  CkCrypt2_StringToBytes(cryptor, str, PWideChar('utf-8'), bytes);
  CkRsa_ImportPublicKey(cryptor, key);
  encryptedStr := CkRsa__encryptBytesENC(cryptor, bytes, False);
  msg.Details.Document := encryptedStr;
end;

I try to get bytes array from my string but get AccessViolation exception:

CkCrypt2_StringToBytes(cryptor, str, PWideChar('utf-8'), bytes);

How to allocate bytes to write encrypted text into ?

Thanks.

asked Sep 30 '14 at 08:24

alexdmatveev's gravatar image

alexdmatveev
111

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×56
×32

Asked: Sep 30 '14 at 08:24

Seen: 1,018 times

Last updated: Sep 30 '14 at 08:24

powered by OSQA