PGP encryption from client side (js) with JSF 2 - jsf-2

when client select a file with upload component, I need to implement PGP encryption from client side with JSF 2 (Create a faces component) or primefaces 2.2 (I dont see anything from client side in the upload component), because the file has confidential information, encryption from the server does not help, can you give me some help or any idea?

JSF/PrimeFaces wont help you much - if you have to encrypt the file before sending it will all have to be done client side in JavaScript. So you have to read the file in JS, encrypt in JS, and then you can encode encrypted contents with something like Base64, assign that value to inputText and then submit to server.
See JavaScript read file contents
and
http://www.hanewin.net/encrypt/

Related

How to upload blob with Bulletproof php

I generate a blob jpeg in client side and need to send it to server using ajax and bulletproof php, is it possible without using database ?
Can i convert blob to a file client side so bulletproof can send it to server ?

Can CDNs handle base64 encoded data?

I'm trying to make an app where I take pictures from users add them to a canvas, draw stuff in them, then convert them to a base64 string and upload them.
For this purpose I'm considering the possibility to use a cdn but can't find information on what I can upload to them and how the client side uploading works. I'd like to be able to send the image as base64 and the name to be given to the file, so that when it arrives to the origin cdn, the base64 image is decoded and saved under the specified name (which I will add to the database on the server).Is this possible?Can I have some kind of save.php file on the origin cdn where I write my logic to save the file and to which I'll send XHR requests? Or how this whole thing work?I know this question may sound trivial but I'm looking for it for hours and still didn't find anything which explains in detail how the client side uploading work for CDNs.
CDNs usually do not provide such uploading service for client side, so you can not do it in this way.

image encrypt/decrypt between php and Android

I want to encrypt an image using PHP and decrypt it in an Android app. I found someone suggest to use MCrypt. However, I noticed that ImageMagick, which I use to convert pdf into jpg, seemed to have ability for encryption. Can I use ImageMagick to encrypt the jpg at the server side and decrypt it using JAVA? Thanks very much.
As per documentation
"ImageMagick only scrambles the image pixels. The image metadata remains untouched and readable by anyone with access to the image file.
ImageMagick uses the AES cipher in Counter mode. We use the the first half of your passphrase to derive the nonce. The second half is the cipher key."
To decrypt the image on the client side, you would have to keep the image header as is and decrypt the remainder of the file using the password with which it was encrypted with. That will require custom coding with knowledge of the image format internals. You will also have to find out how the nonce is derived from the passphrase.
You can alternatively use a SSL connection between the client and server or use any cryptographic scheme available in both PHP and Java either with symetric key or public key encryption as per your requirements.

Delphi how to avoid sniffers

I'm developing a project with Delphi 2010, at some point this project connects to internet and send some data to a php file via POST/IDHTTP, those parameters encrypted with aes and as you know there is no way to get source code of php files via browser. But when i use sniffer on my project sniffer software shows full path of php file and parameters. I was wondering is there any chance to hide path and parameters with IDHTTP. For example when i try on Skype sniffer only shows decimal characters on skype's transmission. Is it possible to do same or totally hide the traffic ?
Thanks in advance.
You can use HTTPS, it is supposed to be standard way to transmit HTTP traffic through SSL-protected channel. Example of code you can find for example here.
In addition to Andrei's answer, you can consider encrypting your traffic on-top of using HTTPS.
In other words,
1) Use HTTPS protocol.
2) Add your own layer of encryption to encrypt all data coming to and from your server.
In addition to HTTPs and encrypted data, you can also add security by using client certificates. See https://security.stackexchange.com/questions/3605/certificate-based-authentication-vs-username-and-password-authentication
The answers explain the advantages of using CBA, one of them is
certificate usage never involves revealing any secret data to the
peer, so an attacker impersonating the server cannot learn anything of
value that way

Is it possible to save HTML page as PDF using JavaScript or jquery possible means please write an some example codes?

Is it possible to save HTML page as PDF using jquery possible means please write an some example codes?
No, you cannot do this on client side. It is not possible to save a file locally without involving the local client as it is a security problem to client machine.

Resources