login about faq

I am experiencing some issues using the TChilkatRSA class in Delphi; namely the basic Encrypt and Decrypt functions. I am attempting to encrypt a string, “This is a test”, using a generated key-pair. However, when I call the EncryptString, I get back nothing but multiple ‘?’. This leads into an issue where the decryption does not return the original value. I think that it has something to do with the conversion between charsets that the API documentation mentions. The EncryptStringENC and DecryptStringENC functions do not suffer from the same issue. I was hoping that you would have some debug suggestions to try to determine the actual cause of the “bad” encryption.

asked Jun 25 '14 at 09:51

chilkat's gravatar image

chilkat ♦♦
11.8k316358421


The EncryptString method will accept a string as input, but returns the binary encrypted bytes (not a string) as output. Encrypted bytes are indistinguishable from random binary byte data, where each byte can have a value from 0 to 255 (0x00 -- 0xFF). A character (visible glyph) is a sequence of one or more bytes interpreted according to a character encoding. For example:

Consider this character: É

In the iso-8859-1 character encoding, it is represented by a single byte: 0xC9

In the utf-8 character encoding, it is represented by a two bytes: 0xC3 0x89

In the ucs-2 character encoding, it is represented by a two bytes: 0x00 0xC9

When bytes are encountered that represent no displayable character (or the sequence makes no sense in the character encoding), then a program must either ignore the bytes or display a "?".

link

answered Jun 25 '14 at 09:51

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
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:

×64
×27
×17
×13

Asked: Jun 25 '14 at 09:51

Seen: 1,080 times

Last updated: Jun 25 '14 at 09:51

powered by OSQA