We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Encrypt PDF with attached encrypted PDF inside

(I have uploaded and linked to a sample file that is causing the crash towards the end of this post)

I am trying to encrypt a PDF file that has attachments inside it. One of the attachments is a PDF file that is itself encrypted.

My VB.Net code crashes (saying invalid password).

Sample Code:
Public Sub EncryptPDF(fileName As String, userPassword As String, ownerPassword As String)
Dim document = New Aspose.Pdf.Document(fileName)
document.Encrypt(userPassword, ownerPassword, 0, Aspose.Pdf.CryptoAlgorithm.AESx256)
End Sub

The code will work if the file that I am putting inside my new pdf was not previously encrypted.

I thought my code may have an error so I also tried encrypting the same file at the Aspose free lock website and that fails too:

Here is a sample PDF file. I actually created this file with Aspose PDF. If I try and encrypt this with the code above, the code fails.

email.pdf (148.9 KB)

You will see that this PDF has another encrypted PDF inside it.

I don’t want to modify the original PDF in anyway… The new PDF is meant to simply serve as a container for it but then I want to encrypt the container pdf too.

Do I need to do anything extra to make this work.



I have been able to reproduce the issue on our end. A ticket with ID PDFNET-49936 has been created in our issue tracking system to further investigate the issue on our end. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Thank you @mudassir.fayyaz

Hopefully a fix is available soon. Would you have a timeline for this (I am a bit stuck until there is an update)?

I am happy to assist with any testing if that will help.

Thank you to you and the rest of the Aspose team for your support and a great product.



Please note that it is logged in free support model and will be investigated and resolved on a first come first serve basis. We will surely inform you a soon as we make some definite progress towards its resolution. Please be patient and spare us some time.

1 Like


Just following up to see if there has been any update on this issue.



Regretfully, the ticket is pending for a resolution. However, we have recorded your concerns and will surely update you as soon as the ticket gets resolved. Please give us some time.

Thank @mudassir.fayyaz

Do you have any expected date for a fix? I had originally logged the issue in May and was hoping to be able to to provide an update by the end of August to my own users. I am happy to assist with any testing if required.

I realise this is part of the free support and I am very grateful for the help I have always received from Aspose.

Thanks again.


At the moment, the ticket is pending for an initial investigation. It will be analyzed and fixed on first come first serve basis. We are afraid that we cannot share any reliable/rough ETA before its investigation is complete. However, we have recorded your concerns and will surely inform you once we have some updates in this regard.

Thanks @mudassir.fayyaz. Is there any way to get this expediated?

Please feel free to email me directly if that is a more appropriate channel to discuss.



The paid support issues are resolved on urgent basis and have the highest priority. Please note that paid support does not guarantee immediate solutions but it does expedite the process of investigation in order to get an ETA. In other words, the issue investigation will be started quickly once you report it in paid support. You can get more information about Paid Support Helpdesk at Purchase Forum.