 It is a helper library that would help any other application to encrypt or decrypt files. So, how did we get the inspiration to develop this library? Well, in my personal experience I have developed quite a few projects, enterprise level projects or banking applications where encryption of file is not the main motive of the project. The main motive is implementing some different business logic. But because of security concerns what happens is that the files that are stored on the device they need to be encrypted and not accessible to any other application or viewed by other users. So, developers developing these applications spend a lot of time implementing encryption on their application. So, we plan to develop this library and encrypt or decrypt content in a easy way for these applications. I like to state that UI was not the main motive. So, please forgive our user interface. Ok, going on. So, let us look at how we can encrypt files to our application. So, this is a file system. I want to support three modes. One is the asynchronous mode. The other is the synchronous mode and the third mode is the service mode. So, what do these modes mean? So, the asynchronous mode are library. What it does is that it spawns a background thread. In Android terms it uses an async task to encrypt or decrypt the file in the background. And it keeps on relaying the progress messages to the user or the client application. It is synchronous for the process that is written over there. So, in this mode the client can choose to implement his own thread. And our library doesn't take the liberty to spawn a new thread to do the encrypt or decrypt. And the third option is using a background service. So, what this option does is that it creates a background service. Now, many a times this happens is that an application is encrypting a file and the user suddenly closes the application. So, what happens is that that file gets corrupted. And when it comes to enterprise level applications that is not tolerable by the user. So, creation for developing this feature. So, what the service does is that until and unless the file is completely decrypted or encrypted. This service will keep on running in the background and complete its process before quitting. So, even if the application closes the service doesn't last and only then it closes. Ok. So, let's go and see. Let's encrypt it. It will be small. So, you will see. If you look at the logcat in his code. So, the library relays these progressives to its client application. And we just logged it here because we didn't get time to develop the UI or progressives. But you can see that the library is relaying the progressives to the client application. So, the client can track it. Now, we have used a sync operation to encrypt the service, sorry, the file. Now, let's use the service to decrypt it. For now what we have done is for encrypted files we just added this prefix of ENC. And if you look at decrypted files we have added a prefix of DEC. So, let's decrypt it using a service. We go on and decrypt the file. If you pull down the notification that the service is telling to the user that this service is currently running in the background and doing its stuff. If you go back and come back here and refresh the files itself. You will see that there is a decrypted file as well. I would like to state one problem that we faced when implementing the service. What happens is that Android has two types of services, one are bounded and one have started services. Started services are not bounded to the application. That is, they don't give any progress to the application. And they terminate on their own once they finish their task. And bounded services, they are bounded to the application. So, the problem here is that if the application closes, the bounded service also terminates. But that would not be solving a problem. We are trying to prevent documents from getting corrupted. So, we had to use a combination of both bounded services to make this happen. Let's try the hsync option. Let's try the third option. That is the hsync task option to increment to encrypt and decrypt this hsync file. In the file, let's see if there is a file system and decrypt it as well. Now, just to be sure that these are valid files, that the encrypted file is not readable by other applications and the decrypted files are readable. Let's pull them out to a different platform. And let's take, if you double click on that, and so it is asking us to select the file format. Now, if we look at the same document that has been decrypted, it is readable after decryption. So, the encryption and decryption is actually happening. Similarly, for the encrypted xls, whereas for the decrypted xls, you also see a preview on the icon. So, let's not waste time opening them. So, I would also like to take you through the architecture of the application a little bit. So, can you open that PNG preview? Preview of the application. Yeah. So, this is how the application architecture is. So, this is a client application. The application has only a single interface into our management, that is the crypto manager. The application will call a simple method of the crypto manager, if you can go to the code. What you should do is call this process method. There are two parameters at the configuration. Can you go to the configuration class? Now, in the configuration class, a client only needs to supply these five or six parameters. One is the operation, that is the encrypt or decrypt operation. What is to be performed on the file? The other is the process mode. As we saw, there are three processing modes. The service, nursing class, and synchronous. So, that process mode tells that. Then there is a listener interface. So, all the progress calls that are relayed back to the client are relayed to this particular reference. This cipher object tells the client all about the type of encryption that has to be performed, the padding to be used, etc, etc. So, let's go back to that. Now, what this crypto scheduler does is that, it lets the library make multiple document encrypts and decrypts and processes. So, basically we have maintained a hash map here, that would maintain references to all the operations that are in progress. Now, depending on the type of operation, it calls the respective handler, the service handler or the synchronous, all basically refer to one reference to the service, one reference to the actual nursing class, and ultimately they refer to the same classes for their actual encryption and decryption. So, that was all about the application. Also, I would like to share the GitHub link. This project is open, so anybody wants to contact me.