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

Free Support Forum - aspose.com

Using Aspose Email to use encryption for PST creation in a memory efficient manner

Our company is using Aspose Email PersonalStorage object to create PSTs. We need to encrypt the PST file on disk. As a result, we are using the method which makes use of a Java IO stream as this can channelled through encryption. However, it seems that this method stores the whole PST in memory. The method which takes in a file location as argument saves the file to disk and is more memory efficient, however, it cannot be channelled through encryption. Would it be possible to write to disk while using encryption in order to be more memory efficient. Could you please advise.



To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input PST.
  • Please create a simple Java application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.


This query is independent of a specific pst.

We are using Java

In Java, the PersonalStorage object can be created by passing either the location of a file, an Aspose IO stream, or a Java IO OutputStream. We need to use a Java IO OutputStream because we are using encryption (CipherInput / Output Streams). The problem is that if we do this, it builds the PST in memory - which is inefficient for us. By contrast, the methods which take the file location or Aspose IO streams as param have the ability to build the file on disk - which is the behaviour we want with Java IO streams.

We wanted to check if there could be a solution where we could use encryption but with the file being composed on disk - e.g. a custom Aspose IO stream (maybe that has callbacks before reading and writing bytes - in blocks - for encryption).



We have logged an investigation ticket as EMAILJAVA-35057 in our issue tracking system for your case. We will inform you via this forum thread once there is an update available on it.

We apologize for your inconvenience.


You can use the PST API, which is optimized for big size PST file to achieve your requirement.

// blockSize - The optimal block size to expand cache buffer(in bytes)
// for example blockSize 10Mb = 10*1024*1024
PersonalStorage create(OutputStream stream, int blockSize, /*FileFormatVersion*/int version)