EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Signature encoding

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
#11624
Posted: 11/10/2009 03:41:38
by delagoutte jean (Standard support level)
Joined: 04/02/2009
Posts: 34

I'm working on a signer verifier.
For one of signature, i had a sig file that is encoding in base64.
for decoding this sig file i used this fonction :
Code
var
  PEMPROC : TelPEMProcessor;
  i : integer;
  FBASE64Buff : Array of Byte;
Begin
  try
    PEMProc:= TelPEMProcessor.Create(nil);
    i:=PEMPRoc.PEMDecode(bytearray(FSigBuff),bytearray(FBASE64Buff));
    if (i=0) then
    begin
      fBase64Encoded := True;
      bytearray(FSigBuff):=bytearray(FBASE64Buff);
    end
    else
    begin
      fBase64Encoded := False;
    end;
  finally
    FreeAndNil(PemProc);
  end;


Now i have a other type of signature that is encode with other encoding than base 64. There is lines with 76 caracters. I think it is quotedPrintable but i'm not sure.

How can i decode this type of signature ? Is there a other component
or other method with i can decode base64 and quotedprintable or other ?
thanks for your help
#11626
Posted: 11/10/2009 04:22:27
by Ken Ivanov (EldoS Corp.)

SecureBlackbox includes internal non-documented functions to work with Base64 (Base64Encode, Base64Decode in SBUtils.pas). Unfortunately, there is no support for quoted-printable encoding (except that is available as a part of MIMEBlackbox) available.
#11627
Posted: 11/10/2009 04:52:36
by delagoutte jean (Standard support level)
Joined: 04/02/2009
Posts: 34

I'm note sure it is a qotedprintable encoding. I'm joining the file + sig file to this message.
Windows can open this .p7s file, could you said me if i can used a component of eldos to read this type of signature ?


[ Download ]
#11628
Posted: 11/10/2009 06:20:32
by Eugene Mayevski (EldoS Corp.)

Your p7s file is a detached PKCS#7 signature, encoded in Base64. You need to first decode it using B64Decode function mentioned above, then use TElMessageVerifier class to verify this signature.


Sincerely yours
Eugene Mayevski
#11629
Posted: 11/10/2009 07:58:28
by delagoutte jean (Standard support level)
Joined: 04/02/2009
Posts: 34

Sorry but i need your help for using this fonction. I can't decode.

i use it :
Code
var fsig : file;
    fsigbuff, fBase64Buf : Array of byte;
    outsizebuff : integer;
begin
AssignFile(FSig, aValue);
Reset(FSig, 1);
SetLength(FsigBuff, FileSize(FSig));
BlockRead(FSig, FsigBuff[0], Length(FsigBuff));
CloseFile(FSig);
Base64Decode(@FSigBuff[0],length(FSigBuff),@FBASE64Buff[0],outsizebuf);


I have acess violation on base64decode fonction.
Do you see my error ?
#11630
Posted: 11/10/2009 08:25:53
by Eugene Mayevski (EldoS Corp.)

Of course you get - you have not allocated output buffer and didn't provide it's size to Base64Decode.


Sincerely yours
Eugene Mayevski
#11631
Posted: 11/10/2009 09:42:06
by delagoutte jean (Standard support level)
Joined: 04/02/2009
Posts: 34

thanks, effectively it works better when i allocated :)

for other user if they're needed:
Code
OutSizeBuf:=0;
        Base64Decode(@FSigBuff[0],length(FSigBuff),nil,outsizebuf);
        setlength(FBASE64Buff,outsizebuf);
        if Base64Decode(@FSigBuff[0],length(FSigBuff),@FBASE64Buff[0],outsizebuf)= BASE64_DECODE_OK then
.....
#11632
Posted: 11/10/2009 09:43:54
by delagoutte jean (Standard support level)
Joined: 04/02/2009
Posts: 34

A other question :
Is exist a other component like elmessagesigner and elmessageverifier for xades or xmldsig signature ?
#11633
Posted: 11/10/2009 10:11:10
by Eugene Mayevski (EldoS Corp.)

You have a license for Professional package, which includes XMLBlackbox package (component to perform XML encryption and decryption and to create and verify XML signatures). Please check samples in Samples\XMLBlackbox folder.


Sincerely yours
Eugene Mayevski
Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.

Reply

Statistics

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