EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Access violation in CryptoTokenManagerDemo

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#14114
Posted: 08/05/2010 12:16:27
by Jesus Garcia (Standard support level)
Joined: 05/23/2010
Posts: 15

I have tried it, save the public key to a blob, and when i try to load it i get and exception Invalid public key. The code:

WRITE PUBLIC KEY TO BLOB
sClavePublica := taCertificadoUsuario.CreateBlobStream( taCertificadoUsuario.FieldByName( 'CLAVE_PUBLICA' ), bmWrite );
try
Size := 0;
Certificado.X509.GetPublicKeyBlob( nil , Size);
SetLength(Buffer, Size);
Certificado.X509.GetPublicKeyBlob( @Buffer[0], Size );
sClavePublica.Write( Buffer[0] , Size);
Setlength(Buffer,0);
finally
sClavePublica.Free;
end;

READ PUBLIC KEY FROM BLOB

sClavePublica := taCertificadoUsuario.CreateBlobStream( taCertificadoUsuario.FieldByName( 'CLAVE_PUBLICA' ), bmRead );
KeyMaterial := TElRSAKeyMaterial.Create();
KeyMaterial.LoadPublic( sClavePublica ); <==== EXCEPTION

sClavePublica has an array of byt values of more than 100 bytes length.
#14115
Posted: 08/05/2010 13:56:53
by Ken Ivanov (EldoS Corp.)

Please try to set TElRSAKeyMaterial.RawPublicKey to true prior to loading the key and check if it helps.
#14117
Posted: 08/05/2010 15:59:10
by Jesus Garcia (Standard support level)
Joined: 05/23/2010
Posts: 15

Perfect, thank you very much.

Reply

Statistics

Topic viewed 3068 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!