on 02-03-2010 9:14 AM
Hi All,
I have requirement, where i need to send the mail Attachment with password protected. I am using Smartform in my Program to create PDF File.. could any one help me in making this attachments password protected.
Thanks
Shashikanth
Hi shashikanth
Hope this link will solve your problem.
http://scn.sap.com/docs/DOC-29209
Regards,
Anson
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello all,
if you need a pure ABAP based solution please check:
Regards,
Steffen Gruber
Hi Gruber,
When I run my report for PDF Encryption the the follwing message come
Access via 'NULL' object reference not possible.
593
594 * set the PDF and the encryption
595 CREATE OBJECT o_pdf.
596 o_pdf->set_pdf_file( result ).
597
598 pass = 'TEST'.
599
600 upass = pass.
601 * CONCATENATE 'O_' pass INTO opass.
602 opass = 'ATEST'.
603 CREATE OBJECT o_encrypt_aes
604 EXPORTING
605 keylength = 128.
606 * o_encrypt ?= o_encrypt_aes.
607
608 * set the user permissions for the PDF file
>>> o_encrypt->set_permission_ex( print_allowed = 'X'
610 modify_allowed = ' '
611 copy_allowed = 'X'
612 add_annotations_allowed = ' '
613 fill_fields_allowed = ' '
614 copy_accessibility_allowed = 'X'
615 assemble_allowed = ' '
616 print_highres_allowed = 'X' ).
617
618 * set the user and the owner password for the PDF
619 o_encrypt->set_passwords( user_password = upass owner_password =
620 * generate the passwords
621 o_encrypt->generate_passwords( o_pdf ).
( as per your API_Reference.pdf I create 2 class CL_PDF & CL_PDF_ENCRYPTION and also copy CL_PDF_ENCRYPTION to CL_PDF_ENCRYPTION_AES )
Please you guide me with screen shot for Class & Method.
With Warm Regards
Manob Chatterjee
Hello Steffen,
When I uncomment at line 606 then the following message show.....
A cast between two incompatible references (to the types
"CL_PDF_ENCRYPTION" and "CL_PDF_ENCRYPTION_AES") makes no sense. This
kind of cast will always produce a runtime error .
Please advice me.
Regards
Manob Chatterjee
Hello Manob,
the API is a reference of the PDF Encryption Library. All the functions and classes are implemented there. The two classes /GRUBE/CL_PDF_ENCRYPTION and /GRUBE/CL_PDF_ENCRYPTION_AES are part of a hierarchy and can be casted into the base class /GRUBE/CL_PDF_ENCRYPTION. It seems that you have tried to implement the classes by yourself and so you have also implement the rest of the functionality which is provided by the PDF Encryption Library.
Cheers,
Steffen
Hello Manob,
that's not so simple. To encrypt PDF in SAP you have to do the following steps inside the class:
- disassemble the existing PDF (from spool or ADS)
- implement AES and RC4 and some other algorithms (e.g. compression/decompressin)
- use the ISO specification 32000_2008 to do the encryption
- assemble the final PDF
There is no standard functionality in the SAP ABAP stack, which covers any of these areas.
This is basically the functionality of the PDF Encryption Library (see: www.pdfencryption.de).
Cheers,
Steffen
Hi Poorna Soysa,
The SAP ABAP stack has no standard functionality to encrypt PDFs (at least as far as I know). There is some part of the functionality implemented in the ADS (Java Stack). However I was never successful to control the owner and user password and the PDF security settings from the ABAP stack or in any other manageable way.
To implement PDF encryption in ABAP just buy and download the PDF specification from http://www.iso.org/iso/catalogue_detail.htm?csnumber=51502 ( ISO 32000-1:2008 ) and implement all the required functions in ABAP.
Cheers,
Steffen
Hello, if you want your PDF to be password protected then:
1) you cannot print smartform because if there would be something like PDF protection, it would definitely NOT be applicable on smartform print (PDF is the "dumb" conversion, this is not a PDF in the sense of Adobe Forms).
2) you cannot password protect the PDF anyway, this question has been answered many times under NetWeaver - Interactive forms by Adobe. You can check these threads to confirm this:
Password protect PDF file:
Hope this solves (proves not possible) your question.
Regards, Otto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well....
Hi Otto - I must disagree - but possibly agree too.
There is no standard way in SAP (that I know of) of password protecting a PDF.
However, I have successfully password protected and encrypted a read only PDF from SAP. We do this as part of a solution to email employees their payslips.
It requires a little bit of work - especially the encryption bit - but it is possible.
But not as standard.
I'm really not sure if this also applies to offline forms - am tempted to try - would be great as part of a recruitment/hire process to be able to mail the form to a potential employee and separately communicate the password - ensures that any data sent to and forth is secure.
Have you ever tried something like that? Or is there some new tooling available these days?
Cheers,
Chris
Hi Guys,
sorry I can't share the code - the company I work for makes money by selling it to people - I can't just grab it and run. I'm sure they'd be happy to sell it to you
That said - they don't hold a copyright on the idea! - If you look closely, Adobe have released the PDF specifications that tell you exactly how a PDF document is formatted.
If you look at the version of PDF that SAP code (as standard) produces - it is a very old version for which the specs are easily found. (from memory it's the 1.4 version that is output).
In the PDF specs it details how the encryption is done. (This is the hard part). You need to build an rc4 (or arc4) encryption routine in SAP - helpfully SAP have md5 hash routines built in - then encrypt the part of the document that need to be encrypted...
This link -[http://www.cs.cmu.edu/dst/Adobe/Gallery/anon21jul01-pdf-encryption.txt|http://www.cs.cmu.edu/dst/Adobe/Gallery/anon21jul01-pdf-encryption.txt] explains a little how you need to break up the doc, digest, etc and do the encryption.
If I had time and my own SAP HR system, I'd do a "clean room" implementation and post it up on SCN. But at the moment, time is highly prized and I've got other priorities.
That said - a good programmer should be able to take the above link, some further web searches and build their own implementation in a few days. Just remember to set both owner and user passwords (and generate a random owner password each time) to ensure that document cannot be easily ripped open.
It's also worth noting that the method I described here allows for 40bit encryption - which can be [brute forced relatively easily.|http://www.net-security.org/secworld.php?id=5561]. If you can code for longer key, then I suggest that you do (just don't export your code outside the USA Depends on to what lengths you want to go to protect the data.
Good luck.
Cheers,
Chris
Hi Chris,
Waiting for your reply.
I had made progress in RC4 algorithm,i could encrypt the plain text with key stream generated from RC4 algorithm using BIT-XOR operator and passed values to /U and /O respectively as per PDF specs.
But still document is not getting decrypted. I feel like i am missing something in RC4 encryption.
Can you please help me in building RC4 routine in SAP.
Looking forward hearing from you.
Regards,
kris
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same required from me some time ago. But I could not find a solution.
Result I have reached that time was it is not possible to do using standard functionality in SAP and you may only do it after implementing some adobe solutions (which means additional software, hardware and development costs).
I mean adding password for sure. E-mailing is quite simple and you can find many examples here.
Edited by: Gungor Ozcelebi on Feb 3, 2010 10:28 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.