-
Notifications
You must be signed in to change notification settings - Fork 1
Encrypted WebDAV server
It accesses directly to resources on the root directory specified in the HTTPServerSettings instance.
If the server receive GET /public/chocolate.exe HTTP/1.1 and the <resource_root> used is D:\Documents\WebDAVServer, the resource will be D:\Documents\WebDAVServer\public\chocolate.exe.
Before every GET request and POST request, it will decrypt the content of the file and send it in the response of the request. It will do the same with the PUT request to keep it encrypted on the server and decrypted for the user.
-
webdav.server.localCrypted.
ICrypter -
webdav.server.localCrypted.
CipherCrypter -
webdav.server.localCrypted.
LocalCryptedResource -
webdav.server.localCrypted.
LocalCryptedResourceManager
First, you will have to import the class :
import webdav.server.localCrypted.LocalCryptedResourceManager;Then, you will have to create the HTTPServerSettings instance for the HTTPServer with LocalCryptedResourceManager.class :
HTTPServerSettings settings = new HTTPServerSettings(
/* [...] */ LocalCryptedResourceManager.class /* [...] */
);Finally, you will have to set to the LocalCryptedResourceManager the encrypter and the key to use :
LocalCryptedResourceManager.loadCipherCrypter(ICrypter.Algorithm.AES_ECB_PKCS5Padding);
LocalCryptedResourceManager.setKey("<my password>");Different encryption/decryption algorithms can be found in the enum ICrypter.Algorithm.
AES
- AES_CBC_NoPadding
- AES_CBC_PKCS5Padding
- AES_ECB_NoPadding
- AES_ECB_PKCS5Padding
DES
- DES_CBC_NoPadding
- DES_CBC_PKCS5Padding
- DES_ECB_NoPadding
- DES_ECB_PKCS5Padding
DESede
- DESede_CBC_NoPadding
- DESede_CBC_PKCS5Padding
- DESede_ECB_NoPadding
- DESede_ECB_PKCS5Padding
But you can use your own encryption/decryption system by calling the constructor of CipherCrypter with the algorithm name to use, the transformation name string and the number of bytes of the secret key :
new CipherCrypter("AES", "AES/CBC/NoPadding", 128/8);LocalCryptedResourceManager.loadCipherCrypter(ICrypter.Algorithm.AES_ECB_PKCS5Padding);
LocalCryptedResourceManager.setKey("<my password>");
HTTPServerSettings settings = new HTTPServerSettings(
"WebDAV Server",
HTTPCommand.getStandardCommands(),
LocalCryptedResourceManager.class,
"<my folder>"
);
HTTPServer s = new HTTPServer(1700, settings);
s.run(); // Run the server