Function

tCryptography.SignData

Module

XuDsigS

Last Modified

7/15/2014 3:26:44 PM

Comments

All the data that we need will be placed thru object calls
This part will manage the other parts to get the work done.
With luck we don't have to have all the code inline.

Visibility

Public

Owner

tCryptography

Declaration

function  SignData: boolean;

Calls Hierarchy


tCryptography.SignData
 ├tCryptography.DataReady
 │ └Status
 ├tCryptography.Hashbuffer
 │ ├tCryptography.HashStart
 │ │ ├CryptCreateHash
 │ │ └tCryptography.RaiseErr
 │ ├tCryptography.HashBuf
 │ │ ├CryptHashData
 │ │ └tCryptography.RaiseErr
 │ ├tCryptography.GetHashValue
 │ │ ├CryptGetHashParam
 │ │ ├tCryptography.RaiseErr
 │ │ ├MimeEncodedSize
 │ │ └MimeEncode
 │ └tCryptography.HashEnd
 │   └CryptDestroyHash
 ├tCryptography.FindCert
 │ ├CertOpenSystemStore
 │ ├CertEnumCertificatesInStore
 │ ├CertGetNameString
 │ ├SerialNum
 │ ├CertDateTimeStr
 │ ├tCryptography.SigningCert
 │ │ └CertGetIntendedKeyUsage
 │ ├CertVerifyTimeValidity
 │ ├CertFindExtension
 │ ├tCryptography.CRLDistPoint
 │ │ └CryptDecodeObject
 │ ├Revco
 │ │ └CertVerifyRevocation
 │ └tCryptography.CertChainCheck
 │   ├CertCreateCertificateChainEngine
 │   ├Memo
 │   ├tCryptography.RaiseErr
 │   ├CertGetCertificateChain
 │   └SetStatus
 │     └Memo
 ├setPINValue
 │ ├CryptAcquireContext
 │ ├CryptSetProvParam
 │ └CryptReleaseContext
 ├tCryptography.Certsigndata
 │ ├CryptSignMessage
 │ ├MimeEncodedSize
 │ ├MimeEncode
 │ ├tCryptography.CertChainCheck...
 │ ├tCryptography.Release
 │ │ ├tCryptography.sCardReattach
 │ │ │ └SCardReconnect
 │ │ ├CryptMsgClose
 │ │ ├CertFreeCertificateContext
 │ │ ├CertCloseStore
 │ │ ├SCardDisconnect
 │ │ └SCardReleaseContext
 │ └tCryptography.CheckSig
 │   ├CryptMsgOpenToDecode
 │   ├CryptMsgUpdate
 │   ├tCryptography.RaiseErr
 │   ├CryptMsgGetParam
 │   ├CertOpenStore
 │   ├CertGetSubjectCertificateFromStore
 │   ├CertGetNameString
 │   ├CryptMsgControl
 │   ├CertVerifyTimeValidity
 │   └tCryptography.Release...
 └tCryptography.Release...

Calls

Name Declaration Comments
tCryptography.Certsigndata procedure Certsigndata; -
tCryptography.DataReady function DataReady: boolean; -
tCryptography.FindCert function FindCert: boolean; -
tCryptography.Hashbuffer procedure Hashbuffer; -
tCryptography.Release procedure Release; -
setPINValue function setPINValue(PinValue: String; handle: Dword): Boolean; -


Source

774   function tCryptography.SignData: boolean;
775     //All the data that we need will be placed thru object calls
776     //This part will manage the other parts to get the work done.
777     //With luck we don't have to have all the code inline.
778   begin
779     TrackingMsg.Clear;
780     Comment := 'Entered crypto.SignData'+#10#13;
781     TrackingMsg.Add('');
782     TrackingMsg.Add('Entered crypto.SignData');
783     if isDEAsig then
784     begin
785       // order by alphabetic of property name, since this is the order
786       // they will be returned in for verification
787       DataBuffer := '';
788       DataBuffer := DataBuffer + DeaNumber;  // 10
789       DataBuffer := DataBuffer + DetoxNumber;  // 7
790       DataBuffer := DataBuffer + Directions;  // 6
791       DataBuffer := DataBuffer + DrugName;  // 4
792       DataBuffer := DataBuffer + IssuanceDate;  // 1
793       DataBuffer := DataBuffer + OrderNumber;
794       DataBuffer := DataBuffer + PatientAddress;  // 3
795       DataBuffer := DataBuffer + PatientName;  // 2
796       DataBuffer := DataBuffer + ProviderAddress;  // 9
797       DataBuffer := DataBuffer + ProviderName;  // 8
798       DataBuffer := DataBuffer + Quantity;  // 5
799     end;  // if isDEAsig
800     SigningStatus := True;
801     MasterDateValid := False;
802     MasterCertChain := False;
803     SigningStatus := DataReady;  //function, dataready will set reason
804     Result := SigningStatus;
805     if SigningStatus = False then
806     begin
807       Comment := 'Signing Status was False';
808       exit;
809     end;
810     //Build a Hash of the fDataBuffer
811     //Put the results in fHashValue
812     Reason := '';
813     Hashbuffer;
814     if FindCert <> True then
815     begin
816       TrackingMsg.Add('FindCert failed');
817       SigningStatus := False;
818       fHashStr := '';
819       if Reason = '' then
820         Reason := '89802004^Valid Certificate not found.';
821       ShowMessage(Reason); //121214 Show Reason
822     end; //if
823     //Have what we need, Lets sign the data
824     if SigningStatus then
825     begin
826       if not (LastPINValue = '') then
827         setPINValue(LastPINValue,0);
828       TrackingMsg.Add('Going to CertSignData');
829       Certsigndata;
830       if not SigningStatus then
831       begin
832         ShowMessage('Returned from CertSignData with failure'); // 121214 display message
833         TrackingMsg.Add('Returned from CertSignData with failure');
834       end;
835     end;
836     Result := SigningStatus;
837   //  if not Result then // 121214
838   //  SaveLog(); // 121214 remove saving of log to PKISignError
839     //Clean-up
840     Release;
841   end;