1、加密采用服务端随机生成加密因子放入session中,传入登录或注册界面(每次进入都刷新)

2、页面中引入jquery、aes.js(这个js从网上下的坑比较多,引入先后顺序不一致都会报错,所以最后只用这个改良后的版本即可,无法上传附件只能这样粘贴出js,这样忍着看吧)

!function(t,n){"object"==typeof exports?module.exports=exports=n():"function"==typeof define&&define.amd?define([],n):t.CryptoJS=n()}(this,function(){var t=t||function(t,n){var i=Object.create||function(){function t(){}return function(n){var i;return t.prototype=n,i=new t,t.prototype=null,i}}(),e={},r=e.lib={},o=r.Base=function(){return{extend:function(t){var n=i(this);return t&&n.mixIn(t),n.hasOwnProperty("init")&&this.init!==n.init||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=r.WordArray=o.extend({init:function(t,i){t=this.words=t||[],i!=n?this.sigBytes=i:this.sigBytes=*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var n=this.words,i=t.words,e=this.sigBytes,r=t.sigBytes;if(this.clamp(),e%)for(var o=;o<r;o++){var s=i[o>>>]>>>-o%*&;n[e+o>>>]|=s<<-(e+o)%*}else for(var o=;o<r;o+=)n[e+o>>>]=i[o>>>];return this.sigBytes+=r,this},clamp:function(){var n=this.words,i=this.sigBytes;n[i>>>]&=<<-i%*,n.length=t.ceil(i/)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(),t},random:function(n){for(var i,e=[],r=function(n){var n=n,i=,e=;return function(){i=*(&i)+(i>>)&e,n=18e3*(&n)+(n>>)&e;var r=(i<<)+n&e;return r/=,r+=.,r*(t.random()>.?:-)}},o=;o<n;o+=){var a=r(*(i||t.random()));i=*a(),e.push(*a()|)}return new s.init(e,n)}}),a=e.enc={},c=a.Hex={stringify:function(t){for(var n=t.words,i=t.sigBytes,e=[],r=;r<i;r++){var o=n[r>>>]>>>-r%*&;e.push((o>>>).toString()),e.push((&o).toString())}return e.join("")},parse:function(t){for(var n=t.length,i=[],e=;e<n;e+=)i[e>>>]|=parseInt(t.substr(e,),)<<-e%*;return new s.init(i,n/)}},u=a.Latin1={stringify:function(t){for(var n=t.words,i=t.sigBytes,e=[],r=;r<i;r++){var o=n[r>>>]>>>-r%*&;e.push(String.fromCharCode(o))}return e.join("")},parse:function(t){for(var n=t.length,i=[],e=;e<n;e++)i[e>>>]|=(&t.charCodeAt(e))<<-e%*;return new s.init(i,n)}},f=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},h=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=},_append:function(t){"string"==typeof t&&(t=f.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(n){var i=this._data,e=i.words,r=i.sigBytes,o=this.blockSize,a=*o,c=r/a;c=n?t.ceil(c):t.max((|c)-this._minBufferSize,);var u=c*o,f=t.min(*u,r);if(u){for(var h=;h<u;h+=o)this._doProcessBlock(e,h);var p=e.splice(,u);i.sigBytes-=f}return new s.init(p,f)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:}),p=(r.Hasher=h.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var n=this._doFinalize();return n},blockSize:,_createHelper:function(t){return function(n,i){return new t.init(i).finalize(n)}},_createHmacHelper:function(t){return function(n,i){return new p.HMAC.init(t,i).finalize(n)}}}),e.algo={});return e}(Math);return t});
//# sourceMappingURL=core.min.js.map
!function(e,t,i){"object"==typeof exports?module.exports=exports=t(require("./core.min"),require("./sha1.min"),require("./hmac.min")):"function"==typeof define&&define.amd?define(["./core.min","./sha1.min","./hmac.min"],t):t(e.CryptoJS)}(this,function(e){return function(){var t=e,i=t.lib,r=i.Base,n=i.WordArray,o=t.algo,a=o.MD5,c=o.EvpKDF=r.extend({cfg:r.extend({keySize:,hasher:a,iterations:}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var i=this.cfg,r=i.hasher.create(),o=n.create(),a=o.words,c=i.keySize,f=i.iterations;a.length<c;){s&&r.update(s);var s=r.update(e).finalize(t);r.reset();for(var u=;u<f;u++)s=r.finalize(s),r.reset();o.concat(s)}return o.sigBytes=*c,o}});t.EvpKDF=function(e,t,i){return c.create(i).compute(e,t)}}(),e.EvpKDF});
//# sourceMappingURL=evpkdf.min.js.map
!function(r,e){"object"==typeof exports?module.exports=exports=e(require("./core.min")):"function"==typeof define&&define.amd?define(["./core.min"],e):e(r.CryptoJS)}(this,function(r){return function(){function e(r,e,t){for(var n=[],i=,o=;o<e;o++)if(o%){var f=t[r.charCodeAt(o-)]<<o%*,c=t[r.charCodeAt(o)]>>>-o%*;n[i>>>]|=(f|c)<<-i%*,i++}return a.create(n,i)}var t=r,n=t.lib,a=n.WordArray,i=t.enc;i.Base64={stringify:function(r){var e=r.words,t=r.sigBytes,n=this._map;r.clamp();for(var a=[],i=;i<t;i+=)for(var o=e[i>>>]>>>-i%*&,f=e[i+>>>]>>>-(i+)%*&,c=e[i+>>>]>>>-(i+)%*&,s=o<<|f<<|c,h=;h<&&i+.*h<t;h++)a.push(n.charAt(s>>>*(-h)&));var p=n.charAt();if(p)for(;a.length%;)a.push(p);return a.join("")},parse:function(r){var t=r.length,n=this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var i=;i<n.length;i++)a[n.charCodeAt(i)]=i}var o=n.charAt();if(o){var f=r.indexOf(o);f!==-&&(t=f)}return e(r,t,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),r.enc.Base64});
//# sourceMappingURL=enc-base64.min.js.map
!function(e,t,r){"object"==typeof exports?module.exports=exports=t(require("./core.min"),require("./evpkdf.min")):"function"==typeof define&&define.amd?define(["./core.min","./evpkdf.min"],t):t(e.CryptoJS)}(this,function(e){e.lib.Cipher||function(t){var r=e,i=r.lib,n=i.Base,c=i.WordArray,o=i.BufferedBlockAlgorithm,s=r.enc,a=(s.Utf8,s.Base64),f=r.algo,p=f.EvpKDF,d=i.Cipher=o.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){e&&this._append(e);var t=this._doFinalize();return t},keySize:,ivSize:,_ENC_XFORM_MODE:,_DEC_XFORM_MODE:,_createHelper:function(){function e(e){return"string"==typeof e?B:x}return function(t){return{encrypt:function(r,i,n){return e(i).encrypt(t,r,i,n)},decrypt:function(r,i,n){return e(i).decrypt(t,r,i,n)}}}}()}),h=(i.StreamCipher=d.extend({_doFinalize:function(){var e=this._process(!);return e},blockSize:}),r.mode={}),u=i.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),l=h.CBC=function(){function e(e,r,i){var n=this._iv;if(n){var c=n;this._iv=t}else var c=this._prevBlock;for(var o=;o<i;o++)e[r+o]^=c[o]}var r=u.extend();return r.Encryptor=r.extend({processBlock:function(t,r){var i=this._cipher,n=i.blockSize;e.call(this,t,r,n),i.encryptBlock(t,r),this._prevBlock=t.slice(r,r+n)}}),r.Decryptor=r.extend({processBlock:function(t,r){var i=this._cipher,n=i.blockSize,c=t.slice(r,r+n);i.decryptBlock(t,r),e.call(this,t,r,n),this._prevBlock=c}}),r}(),_=r.pad={},v=_.Pkcs7={pad:function(e,t){for(var r=*t,i=r-e.sigBytes%r,n=i<<|i<<|i<<|i,o=[],s=;s<i;s+=)o.push(n);var a=c.create(o,i);e.concat(a)},unpad:function(e){var t=&e.words[e.sigBytes->>>];e.sigBytes-=t}},y=(i.BlockCipher=d.extend({cfg:d.cfg.extend({mode:l,padding:v}),reset:function(){d.reset.call(this);var e=this.cfg,t=e.iv,r=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var i=r.createEncryptor;else{var i=r.createDecryptor;this._minBufferSize=}this._mode&&this._mode.__creator==i?this._mode.init(this,t&&t.words):(this._mode=i.call(r,this,t&&t.words),this._mode.__creator=i)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!)}else{var t=this._process(!);e.unpad(t)}return t},blockSize:}),i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),m=r.format={},k=m.OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;if(r)var i=c.create([,]).concat(r).concat(t);else var i=t;return i.toString(a)},parse:function(e){var t=a.parse(e),r=t.words;if(==r[]&&==r[]){var i=c.create(r.slice(,));r.splice(,),t.sigBytes-=}return y.create({ciphertext:t,salt:i})}},x=i.SerializableCipher=n.extend({cfg:n.extend({format:k}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),c=n.finalize(t),o=n.cfg;return y.create({ciphertext:c,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=e.createDecryptor(r,i).finalize(t.ciphertext);return n},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),g=r.kdf={},S=g.OpenSSL={execute:function(e,t,r,i){i||(i=c.random());var n=p.create({keySize:t+r}).compute(e,i),o=c.create(n.words.slice(t),*r);return n.sigBytes=*t,y.create({key:n,iv:o,salt:i})}},B=i.PasswordBasedCipher=x.extend({cfg:x.cfg.extend({kdf:S}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=i.kdf.execute(r,e.keySize,e.ivSize);i.iv=n.iv;var c=x.encrypt.call(this,e,t,n.key,i);return c.mixIn(n),c},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt);i.iv=n.iv;var c=x.decrypt.call(this,e,t,n.key,i);return c}})}()});
//# sourceMappingURL=cipher-core.min.js.map
!function(e,i){"object"==typeof exports?module.exports=exports=i(require("./core.min")):"function"==typeof define&&define.amd?define(["./core.min"],i):i(e.CryptoJS)}(this,function(e){!function(){var i=e,t=i.lib,n=t.Base,s=i.enc,r=s.Utf8,o=i.algo;o.HMAC=n.extend({init:function(e,i){e=this._hasher=new e.init,"string"==typeof i&&(i=r.parse(i));var t=e.blockSize,n=*t;i.sigBytes>n&&(i=e.finalize(i)),i.clamp();for(var s=this._oKey=i.clone(),o=this._iKey=i.clone(),a=s.words,f=o.words,c=;c<t;c++)a[c]^=,f[c]^=;s.sigBytes=o.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var i=this._hasher,t=i.finalize(e);i.reset();var n=i.finalize(this._oKey.clone().concat(t));return n}})}()});
//# sourceMappingURL=hmac.min.js.map
!function(e,o,r){"object"==typeof exports?module.exports=exports=o(require("./core.min"),require("./cipher-core.min")):"function"==typeof define&&define.amd?define(["./core.min","./cipher-core.min"],o):o(e.CryptoJS)}(this,function(e){return e.mode.ECB=function(){var o=e.lib.BlockCipherMode.extend();return o.Encryptor=o.extend({processBlock:function(e,o){this._cipher.encryptBlock(e,o)}}),o.Decryptor=o.extend({processBlock:function(e,o){this._cipher.decryptBlock(e,o)}}),o}(),e.mode.ECB});
//# sourceMappingURL=mode-ecb.min.js.map
!function(e,r,i){"object"==typeof exports?module.exports=exports=r(require("./core.min"),require("./cipher-core.min")):"function"==typeof define&&define.amd?define(["./core.min","./cipher-core.min"],r):r(e.CryptoJS)}(this,function(e){return e.pad.Pkcs7});
//# sourceMappingURL=pad-pkcs7.min.js.map
!function(e,r,i){"object"==typeof exports?module.exports=exports=r(require("./core.min"),require("./enc-base64.min"),require("./md5.min"),require("./evpkdf.min"),require("./cipher-core.min")):"function"==typeof define&&define.amd?define(["./core.min","./enc-base64.min","./md5.min","./evpkdf.min","./cipher-core.min"],r):r(e.CryptoJS)}(this,function(e){return function(){var r=e,i=r.lib,n=i.BlockCipher,o=r.algo,t=[],c=[],s=[],f=[],a=[],d=[],u=[],v=[],h=[],y=[];!function(){for(var e=[],r=;r<;r++)r<?e[r]=r<<:e[r]=r<<^;for(var i=,n=,r=;r<;r++){var o=n^n<<^n<<^n<<^n<<;o=o>>>^&o^,t[i]=o,c[o]=i;var p=e[i],l=e[p],_=e[l],k=*e[o]^*o;s[i]=k<<|k>>>,f[i]=k<<|k>>>,a[i]=k<<|k>>>,d[i]=k;var k=*_^*l^*p^*i;u[o]=k<<|k>>>,v[o]=k<<|k>>>,h[o]=k<<|k>>>,y[o]=k,i?(i=p^e[e[e[_^p]]],n^=e[e[n]]):i=n=}}();var p=[,,,,,,,,,,],l=o.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,r=e.words,i=e.sigBytes/,n=this._nRounds=i+,o=*(n+),c=this._keySchedule=[],s=;s<o;s++)if(s<i)c[s]=r[s];else{var f=c[s-];s%i?i>&&s%i==&&(f=t[f>>>]<<|t[f>>>&]<<|t[f>>>&]<<|t[&f]):(f=f<<|f>>>,f=t[f>>>]<<|t[f>>>&]<<|t[f>>>&]<<|t[&f],f^=p[s/i|]<<),c[s]=c[s-i]^f}for(var a=this._invKeySchedule=[],d=;d<o;d++){var s=o-d;if(d%)var f=c[s];else var f=c[s-];d<||s<=?a[d]=f:a[d]=u[t[f>>>]]^v[t[f>>>&]]^h[t[f>>>&]]^y[t[&f]]}}},encryptBlock:function(e,r){this._doCryptBlock(e,r,this._keySchedule,s,f,a,d,t)},decryptBlock:function(e,r){var i=e[r+];e[r+]=e[r+],e[r+]=i,this._doCryptBlock(e,r,this._invKeySchedule,u,v,h,y,c);var i=e[r+];e[r+]=e[r+],e[r+]=i},_doCryptBlock:function(e,r,i,n,o,t,c,s){for(var f=this._nRounds,a=e[r]^i[],d=e[r+]^i[],u=e[r+]^i[],v=e[r+]^i[],h=,y=;y<f;y++){var p=n[a>>>]^o[d>>>&]^t[u>>>&]^c[&v]^i[h++],l=n[d>>>]^o[u>>>&]^t[v>>>&]^c[&a]^i[h++],_=n[u>>>]^o[v>>>&]^t[a>>>&]^c[&d]^i[h++],k=n[v>>>]^o[a>>>&]^t[d>>>&]^c[&u]^i[h++];a=p,d=l,u=_,v=k}var p=(s[a>>>]<<|s[d>>>&]<<|s[u>>>&]<<|s[&v])^i[h++],l=(s[d>>>]<<|s[u>>>&]<<|s[v>>>&]<<|s[&a])^i[h++],_=(s[u>>>]<<|s[v>>>&]<<|s[a>>>&]<<|s[&d])^i[h++],k=(s[v>>>]<<|s[a>>>&]<<|s[d>>>&]<<|s[&u])^i[h++];e[r]=p,e[r+]=l,e[r+]=_,e[r+]=k},keySize:});r.AES=n._createHelper(l)}(),e.AES});
//# sourceMappingURL=aes.min.js.map
!function(e,n){"object"==typeof exports?module.exports=exports=n(require("./core.min")):"function"==typeof define&&define.amd?define(["./core.min"],n):n(e.CryptoJS)}(this,function(e){return e.enc.Utf8});
//# sourceMappingURL=enc-utf8.min.js.map

3、具体加密 encrypt.js

 function encrypt(word){
//按照自己页面模板取出session中的加密因子(thymeleaf中如下取得)
var sessionSalt = [[${session.salt}]];
var key = CryptoJS.enc.Utf8.parse(sessionSalt);
var srcs = CryptoJS.enc.Utf8.parse(word);
var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
return encrypted.toString();
}

4、pom依赖

<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>

5、随机生成加密因子工具类GenerateRandomKeyUtil.java

import java.util.Random;

public class GenerateRandomKeyUtil {
public static String getRandomKey(int length) {
String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/=+";
Random random = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; i++) {
int number = random.nextInt(base.length());
sb.append(base.charAt(number));
}
return sb.toString();
}
}

6、解密工具类AesUtil.java

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import sun.misc.BASE64Decoder; import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.spec.SecretKeySpec;
import java.security.SecureRandom; public class AesUtil { private static final String ALGORITHMSTR = "AES/ECB/PKCS5Padding"; /**
* base 64 encode
* @param bytes 待编码的byte[]
* @return 编码后的base 64 code
*/
public static String base64Encode(byte[] bytes){
return Base64.encodeBase64String(bytes);
} /**
* base 64 decode
* @param base64Code 待解码的base 64 code
* @return 解码后的byte[]
* @throws Exception
*/
public static byte[] base64Decode(String base64Code) throws Exception{
return StringUtils.isEmpty(base64Code) ? null : new BASE64Decoder().decodeBuffer(base64Code);
} /**
* AES加密
* @param content 待加密的内容
* @param encryptKey 加密密钥
* @return 加密后的byte[]
* @throws Exception
*/
public static byte[] aesEncryptToBytes(String content, String encryptKey) throws Exception {
     SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
secureRandom.setSeed(encryptKey.getBytes());
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128, secureRandom);
Cipher cipher = Cipher.getInstance(ALGORITHMSTR);
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), "AES")); return cipher.doFinal(content.getBytes("utf-8"));
} /**
* AES加密为base 64 code
* @param content 待加密的内容
* @param encryptKey 加密密钥
* @return 加密后的base 64 code
* @throws Exception
*/
public static String aesEncrypt(String content, String encryptKey) throws Exception {
return base64Encode(aesEncryptToBytes(content, encryptKey));
} /**
* AES解密
* @param encryptBytes 待解密的byte[]
* @param decryptKey 解密密钥
* @return 解密后的String
* @throws Exception
*/
public static String aesDecryptByBytes(byte[] encryptBytes, String decryptKey) throws Exception {
SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
secureRandom.setSeed(decryptKey.getBytes());
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128, secureRandom); Cipher cipher = Cipher.getInstance(ALGORITHMSTR);
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), "AES"));
byte[] decryptBytes = cipher.doFinal(encryptBytes);
return new String(decryptBytes);
} /**
* 将base 64 code AES解密
* @param encryptStr 待解密的base 64 code
* @param decryptKey 解密密钥
* @return 解密后的string
* @throws Exception
*/
public static String aesDecrypt(String encryptStr, String decryptKey) throws Exception {
return StringUtils.isEmpty(encryptStr) ? null : aesDecryptByBytes(base64Decode(encryptStr), decryptKey);
} /**
* 测试
*/
public static void main(String[] args) throws Exception {
     String sessionSalt = GenerateRandomKeyUtil.getRandomKey(16);
String content = "admin";
System.out.println("加密前:" + content);
System.out.println("加密密钥和解密密钥:" + sessionSalt);
String encrypt = aesEncrypt(content, sessionSalt);
System.out.println("加密后:" + encrypt);
String decrypt = aesDecrypt(encrypt, sessionSalt);
System.out.println("解密后:" + decrypt);
} }

js对用户信息加密传输 java后端解密的更多相关文章

  1. JS前端加密JAVA后端解密详解

    最近有一个加解密的需求,其实没有什么难度,但是实践过程中踩了很多坑,把踩坑过程分享出来. 1.前端JS加密 /** * 加密(需要先加载aes.min.js文件) * @param word * @r ...

  2. js前台加密,java后端解密

    1.前台JS <script type="text/javascript">        $(function() {                $(" ...

  3. Java 前端加密传输后端解密以及验证码功能

    目录(?)[-] 加密解密 1 前端js加密概述 2 前后端加密解密 21 引用的js加密库 22 js加密解密 23 Java端加密解密PKCS5Padding与js的Pkcs7一致 验证码 1 概 ...

  4. JavaScript前端和Java后端的AES加密和解密

    在实际开发项目中,有些数据在前后端的传输过程中需要进行加密,那就需要保证前端和后端的加解密需要统一.这里给大家简单演示AES在JavaScript前端和Java后端是如何实现加密和解密的. 直接上代码 ...

  5. JavaScript前端和Java后端的AES加密和解密(转)

    在实际开发项目中,有些数据在前后端的传输过程中需要进行加密,那就需要保证前端和后端的加解密需要统一.这里给大家简单演示AES在JavaScript前端和Java后端是如何实现加密和解密的. java端 ...

  6. 转发:RSA实现JS前端加密,PHP后端解密

    web前端,用户注册与登录,不能直接以明文形式提交用户密码,容易被截获,这时就引入RSA. 前端加密 需引入4个JS扩展文件,jsbn.js.prng4.js.rng.js和rsa.js. <h ...

  7. RSA实现JS前端加密,PHP后端解密

    web前端,用户注册与登录,不能直接以明文形式提交用户密码,容易被截获,这时就引入RSA. 前端加密 需引入4个JS扩展文件,jsbn.js.prng4.js.rng.js和rsa.js. <h ...

  8. js前台加密,java后台解密实现

    参考资料: JS前台加密,java后台解密实现

  9. js前端加密,php后端解密(crypto-js,openssl_decrypt)

    来源:https://blog.csdn.net/morninghapppy/article/details/79044026 案例:https://blog.csdn.net/zhihua_w/ar ...

随机推荐

  1. location 将跟目录下某个文件夹指向2级目录

    例如: /caffespressos/指向/web01/caffe/ [root@web01 default]# tree web01/ web01/ └── caffe └── index.html ...

  2. lzma解压

    这个软件的使用方法有点特殊:需要将要压缩为lzma格式的文件拖放到批处理上面,会自动进行处理.压缩和解压同样是拖放到上面,程序会自动处理.程序默认使用2个CPU线程进行处理,会自动判断你是压缩还是解压 ...

  3. 基于js鼠标拖动图片排序

    分享一款基于js的图片排序效果.鼠标拖动图片,重新排列图片的排列顺序.该插件适用浏览器:IE8.360.FireFox.Chrome.Safari.Opera.傲游.搜狗.世界之窗.效果图如下: 在线 ...

  4. Can't zip RDDs with unequal numbers of partitions

    java.lang.IllegalArgumentException: Can't zip RDDs with unequal numbers of partitions //如果两个RDD分区数不同 ...

  5. C# Dictionary 复制

    Dictionary<string, int> dictionary = new Dictionary<string, int>(); dictionary.Add(" ...

  6. linux - camera capture

    //cut a picture#include <stdio.h>#include <stdlib.h>#include <string.h>#include &l ...

  7. PHP——小尾巴之流程处理

    说明:首先新建一个流程,把处理流程的节点人员添加进去,最后点确定提交至数据库 处理流程:不同用户登录进去处理自己的节点部分对其审核通过 新建两个流程: 第一个为借款流程:处理顺序为:李四发起=> ...

  8. springMVC介绍

    http://www.iteye.com/blogs/subjects/springMVC —————————————————————————————————————————————————————— ...

  9. div随页面滚动遇顶固定的两种方法(js&jQuery)

    一.遇顶固定的例子 我一直以为是某个div或层随屏幕滚动,遇顶则固定,离开浏览器顶部又还原这样的例子其实不少,其实它的名字叫“层的智能浮动效果”.目前我们在国内的商业网站上就常常看到这样的效果了.例如 ...

  10. EasyUI 创建Tree

    tree可以被从标记创建.easyui tree应该定义在ul元素中.无序列表ul元素提供了基本tree结构.每一个li元素被产生一个tree节点,子ul元素产生父tree节点.例子:     < ...