Does Radaee provide encription - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF

TOPIC: Does Radaee provide encription

Does Radaee provide encription 3 years 6 months ago #7353

  • asliyanage
  • asliyanage's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 100
  • Thank you received: 0
I need to know does radaee library provide encryption facility for pdf ?

Please Log in or Create an account to join the conversation.

Does Radaee provide encription 3 years 6 months ago #7357

  • Davide
  • Davide's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 778
  • Karma: 16
  • Thank you received: 61
Yes,

there are simple codes in PDFTestAct.

//byte key[] = new byte[16];
//stream.open("/sdcard/ttt.pdf", key);//pdf file to encrypt.
//stream.ImportFromFile("/sdcard/test.pdf");//import test.pdf and encrypt to ttt.pdf
//stream.ExportToFile("/sdcard/test1.pdf");//decrypt to test1.pdf
//stream.close();

Please Log in or Create an account to join the conversation.

Does Radaee provide encription 3 years 4 months ago #7906

  • asliyanage
  • asliyanage's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 100
  • Thank you received: 0
can you please tell me what is stream and what is the need for byte array?

I have a pdf file in sdcard/pdf/abc.pdf .I need to encrypt the abc.pdf file.could you please tell me the way to do this ?

Please Log in or Create an account to join the conversation.

Does Radaee provide encription 3 years 4 months ago #7916

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 830
  • Karma: 43
  • Thank you received: 10
2 level encryptin supported.
1. PDF standard encryption, see Doument.EncryptAs()
2. APP level encryption, which Davide memtioned.
//byte key[] = new byte[16];
//stream.open("/sdcard/ttt.pdf", key);//pdf file to encrypt.
//stream.ImportFromFile("/sdcard/test.pdf");//import test.pdf and encrypt to ttt.pdf
//stream.ExportToFile("/sdcard/test1.pdf");//decrypt to test1.pdf
//stream.close();
the key must be 16 bytes long, can be any values to set, which both used to encryption and dcryption.
in sample, key not set any value, so java init as all 0.

Please Log in or Create an account to join the conversation.

Last Edit: by .

Does Radaee provide encription 3 years 4 months ago #8008

  • asliyanage
  • asliyanage's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 100
  • Thank you received: 0
I used below code to open the pdf file.Please tell me the way to encrypt this pdf file.path has the pdf file path.


m_doc.Close();
int ret = m_doc.Open(path, null);
if (ret == 0) {

m_reader.setVisibility(View.VISIBLE);
m_reader.PDFOpen(m_doc, false, this);
m_reader.PDFOpen(m_doc, false, this);


mContentView.removeAllViews();
mContentView.addView(m_layout);

}

Please Log in or Create an account to join the conversation.

Does Radaee provide encription 3 years 4 months ago #8011

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 830
  • Karma: 43
  • Thank you received: 10
first you can use this to encrypt PDF file:
byte file_id[] = new byte[16];
//set any bytes to file_id.
int ret = m_doc.Open("sdcard/pdf1.pdf", null);
m_doc.EncryptAs( "sdcard/pdf2.pdf", "owner password", "user password", -1, 0, file_id );
m_doc.Close();
now it saved to pdf2.pdf, and then open pdf2.pdf
int ret = m_doc.Open("sdcard/pdf2.pdf", "user password");//do not forgot password, that passed to EncryptAs
//to do ...
m_doc.Close();
NOTICE:this need premium license.

Please Log in or Create an account to join the conversation.

Last Edit: by .
Powered by Kunena Forum