Digi Tests
Digi Tests
Digi Tests
* get certification
TYPE-POOLS slis.
TYPES: ty_tab TYPE STANDARD TABLE OF raw255,
BEGIN OF l_line,
text TYPE ddtext,
value TYPE fpvalue,
END OF l_line.
START-OF-SELECTION.
* Load the file from the frontend.
l_filename_pdf = p_pdf.
* get FP reference
l_fp = cl_fp=>get_reference( ).
TRY.
* create PDF Object
l_pdfobj = l_fp->create_pdf_object( connection = p_dest ).
* set document
CALL METHOD l_pdfobj->set_document
EXPORTING
pdfdata = l_pdf.
* set certification
CALL METHOD l_pdfobj->set_task_getcertification( ).
* get result
CALL METHOD l_pdfobj->get_certification
IMPORTING
status = l_status
certificate = l_certificate.
l_field-fieldname = 'TEXT'.
l_field-key = 'X'.
l_field-rollname = 'DDTEXT'.
l_field-outputlen = 60.
INSERT l_field INTO TABLE l_fieldcat.
l_field-fieldname = 'VALUE'.
l_field-key = space.
l_field-rollname = 'FPVALUE'.
l_field-outputlen = 132.
INSERT l_field INTO TABLE l_fieldcat.
* Build output table.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = 'SFPSIGNATURE'
all_types = 'X'
TABLES
dfies_tab = l_dfies.
LOOP AT l_dfies INTO l_fies WHERE fieldname <> 'CERTIFICATELIST'.
l_output-text = l_fies-fieldtext.
ASSIGN COMPONENT l_fies-fieldname OF STRUCTURE l_certificate
TO <fs>.
IF l_fies-fieldname = 'STATUS'.
WRITE <fs> TO l_attr-attvalue LEFT-JUSTIFIED.
READ TABLE l_interface->attributes
WITH KEY attvalue = l_attr-attvalue
INTO l_attr.
MOVE l_attr-descript TO l_output-value.
ELSE.
l_output-value = <fs>.
ENDIF.
INSERT l_output INTO TABLE l_outputtable.
ENDLOOP.
ZSSF_TEST_PSE
fm READ_KERNEL
L_KERN_REL 742_REL
L_KERN_DBLIB SQL_Server_9.00
L_KERN_PATCHLEVEL 28
Digital signature - Phase1 :
New : Digitally Signed Documents
�Document content�
Sign Verify
CA Trust
Internet
(Register)
Private key Publickey
� Document unchanged � Identity of the signer � Legal certainty
Digital signature - Phase2:
Secure Store & Forward (SSF) Interface
===================
ZDS_BOOKING_EXAMPLE
DSIG_BOOKING_EX PRG sap c_sign cl_ds_runtime prg SSF01 documents: FP_PDF_TEST_07.
I will use it as a base for my
ZSSF_TEST_PSE PRG tcodes STRUST
add new application code to table SSFAPPLIC and then you can use transaction SSFA
to configure it.
hashing algorithm (in your case SHA1) or PSE location.
DS_AUTHORITY
he digital signature for approval of the documents uploaded in the SOLAR01/SOLAR02.
===================
you are lucky guy. ABAP AS has limited support for crypto. Basically, it supports
only PKCS#7. Fortunately, that's what you need.
Anyway, all stuff is performed within kernel but there are ABAP function modules
which call C routines.
You need to look for FMs with name like SSF_*. As Julius mentioned there is a nice
documentation for this API.
Basically, the easiest way is to use FM SSFV_KRN_ENVELOPE.
It has a simple interface, you pass application ID and string of bytes.
You need to manually add new application code to table SSFAPPLIC and then you can
use transaction SSFA to configure it.
Here you need can define additional parameters like hashing algorithm (in your case
SHA1) or PSE location.
Your new application will use separate certificate which you need to import using
transaction STRUST.
Your client has already given you public key which you need to use for encryption.
Just import .cer file into corresponding PSE. For this scenario you don't need a
private key.
FM (SSF_SIGN or SSF_KRN_SIGN). So you need to sign it with your private key and
then encrypt with public key of receiving system. The receiving system will decrypt
it first using its private key and then verify signature using public key of SAP
system. What certificate you are going to use for signing is up to you. You would
have to just distribute public key to receiving system.
K, now I'm stuck. I'll give you a list of all the things (files, keys,
certificates...) I have, and what I need to do.
Requirement:
1.- Sign an output file for payments with SHA1withRSA.
2.- Envelope with PKCS#7.
3.- This must be done in background mode, so the user doesn't interact with the
signing. So I need to perform this in the application server. The problematic of
including this on an exit, it's not a big deal, so i only wanted to create some
test programs in the first place.
I'll really appreciate your help. I have been working with abap, since 2005, but
this is driving me crazy.
======================
Definition
You use this authorization object to restrict the authorization for executing
digital signatures, depending on the application and the signature object.
The authorization check for executing digital signatures is dependent on the
implementation of the DS_AUTHORITY BAdI. If no specific application authorization
check is implemented in the AUTHORITY_CHECK BADI method, a check is made for the
authorization object defined here.
The C_SIGN authorization object is only valid for implementations of the digital
signature with the CL_DS_RUNTIME class.
Defined fields
The authorization object contains the following fields:
SIGNAPPL - Digital signature application
SIGNOBJ - Digital signature object
ACTVT - Activity
(03) Display - Controls the authorization to display the digital signature log
(06) Delete - Controls the authorization to delete signature process data after
successful archiving
(73) Execute digital signature - Controls the authorization to execute the digital
signature
=============================================================================
report fp_pdf_test_07.
* set signature
class cl_fp definition load.
l_filename_pdf = p_pdf.
l_filename_out = p_out.
* get FP reference
l_fp = cl_fp=>get_reference( ).
try.
* create PDF Object
l_pdfobj = l_fp->create_pdf_object( connection = p_dest ).
* set document
call method l_pdfobj->set_document
exporting
pdfdata = l_pdf.
* set signature
call method l_pdfobj->set_signature
exporting
keyname = s_key
fieldname = s_field
reason = s_reason
location = s_loc
contactinfo = s_cinfo.
* download PDF
data: l_len type i,
l_tab type tsfixml.
write:/ '***************************************************'.
write:/ '***', p_str.
write:/ '***************************************************'.
skip 2.
endform.
endform.
endform.
============================================================================