English 中文(简体)
Java字图像数据
原标题:Data to image in Javascript

在我的网站上,我的服务器将回答原始数据(使用密码加密的Jpeg图像),当浏览器收到数据时,可以将数据加密成图像,并用 Java本显示数据。

问题回答

什么?

图像只有在服务器向客户转播期间才会得到保护。 此外,为了按照所述加以加密,在客户一方(javascript)的某个地方将节省密码。 因此,每个人都可以看到密码和算法。

如果你想在转播期间保护数据,就只能通过https查阅。

首先,请考虑您的设计,并确保这确实是你想要走的道路。 也许,拥有https或 htaccess保护的普通标识系统更为合适。

如果你真的想去做你描述的方式,我将采取以下方式:

  • convert the images to base64 format (wikipedia article), because handling binary data with JavaScript is nasty.
  • then encrypt your images with AES and a strong key
  • save the result in your database

当客户想要获得你应当掌握的图像时

  • send the encrypted images over HTTPS
  • let him enter the key (or a passphrase which will be hashed,e.g. with SHA512, to the key) in a HTML input field and read it with JavaScript
  • decrypt the images using a JavaScript AES library, e.g. http://point-at-infinity.org/jsaes/
  • change the src attribute of your img tag to the decrypted base64 stream.




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签