EldoS | Feel safer!

Software components for data protection, secure storage and transfer

ElRSAPublicKeyCrypto.InputEncoding

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#2256
Posted: 02/12/2007 14:32:20
by Matthew Jones (Standard support level)
Joined: 02/06/2007
Posts: 26

Okay, this is wierd then. I still get the error.
Code
procedure TForm1.btnSaveClick(Sender: TObject);
var
  Crypto : TElRSAPublicKeyCrypto;
  KeyMaterial : TElRSAKeyMaterial;
  InBuf, EncBuf, DecBuf : ByteArray;
  EncSize, DecSize : integer;
begin
   KeyMaterial := TElRSAKeyMaterial.Create;
   KeyMaterial.Generate(1024);
  Crypto := TElRSAPublicKeyCrypto.Create();
  Crypto.KeyMaterial := m_xKeyMaterial;
  Crypto.InputEncoding := rsapkeBinary;
  Crypto.OutputEncoding := rsapkeBase64;

  // encrypting data
  SetLength(InBuf, 33);
  SBRndGenerate(@InBuf[0], Length(InBuf));
  EncSize := 0;
  Crypto.Encrypt(@InBuf[0], Length(InBuf), nil, EncSize);
  SetLength(EncBuf, EncSize);
  Crypto.Encrypt(@InBuf[0], Length(InBuf), @EncBuf[0], EncSize);

  // decrypting encrypted data
  Crypto.InputEncoding := rsapkeBase64;
  Crypto.OutputEncoding := rsapkeBinary;
  DecSize := 0;
  Crypto.Decrypt(@EncBuf[0], EncSize, nil, DecSize);
  SetLength(DecBuf, DecSize);
  Crypto.Decrypt(@EncBuf[0], EncSize, @DecBuf[0], DecSize);
end;

Click the button, and I get an error in TElPublicKeyCrypto.Encrypt at the end where it checks the Length(FOutput) against Outsize and gives SInternalError. The units I've included are SBSymmetricCrypto, SBPublicKeyCrypto, SBUtils. I'm using the PKI version of the code. My current purpose is to write the demo on how to use the PK with Assymetric encryption so that I know I've got a good foundation to roll into my code. But right now not only does this simple example fail, but my main demo code isn't decrypting from a stream either. As I'm sure you guys suffer lots more, debugging encrypted data is hard as it is all "random".

Thanks for all the help, Matthew.
#2257
Posted: 02/12/2007 14:45:20
by Ken Ivanov (EldoS Corp.)

Would you be so kind to check the build number you are using? It is possible that this error has been present in one of the past build updates, but was fixed later.
#2258
Posted: 02/12/2007 14:51:04
by Matthew Jones (Standard support level)
Joined: 02/06/2007
Posts: 26

SecureBlackbox - version 4.0.94 - Released July 20, 2006 is what the changes.txt says. I bought it only a month or so ago, and have now got the need to actually use it.

I will check if there is a newer version.

Matthew
#2259
Posted: 02/12/2007 14:54:11
by Matthew Jones (Standard support level)
Joined: 02/06/2007
Posts: 26

Hmm, I see I bought in December, and just afterwards the version 5 was officially released. I guess I'll update now and see if that just cures my problems.

Matthew
#2260
Posted: 02/12/2007 14:54:46
by Eugene Mayevski (EldoS Corp.)

In fact it's version 5.0 available now and if you purchased a license a month ago, you must have received SecureBlackbox 5 license key. We strongly recommend that you update to SecureBlackbox 5 as we will not be able to provide a full-powered support for old versions (i.e. we can't test them thoroughly and we can't provide fixes for them).


Sincerely yours
Eugene Mayevski
#2261
Posted: 02/12/2007 15:05:33
by Matthew Jones (Standard support level)
Joined: 02/06/2007
Posts: 26

I got a notice, but not automatic key. Email is in the post, as they say. 8-)

Matthew
#2262
Posted: 02/12/2007 15:24:53
by Eugene Mayevski (EldoS Corp.)

delivered.


Sincerely yours
Eugene Mayevski
#11960
Posted: 12/17/2009 12:47:50
by Ami Goldi (Basic support level)
Joined: 12/09/2009
Posts: 3

I don't know if this thread was ever resolved, but using RSA encryption, the data that you are encrypting is limited to the size of the key, minus a few bytes for padding. For example, if you are using 1024 bit keys, then you can only encrypt data that is up to 128 bytes long, otherwise you'll get the "Input too long" error message.
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

Topic viewed 6954 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!