### 说明

改造jsencrypt 添加 RSA 分段加密  中文处理 

使用简单 html  小程序  app 全支持  

第一步 引入JSEncrypt对象

```js
import JSEncrypt from "@/js-sdk/mark -jsencrypt.js"	
```

第二步

```vue
           var encrypt = new JSEncrypt();
			encrypt.setPublicKey(this.PUBLIC_KEY);
			
			this.data = encodeURIComponent(JSON.stringify(this.long_text));
			this.dataEn = encrypt.encryptLong(this.data);
			console.log('encodeURIComponent:%o', this.data);
			console.log('encryptLong后数据:%o', this.dataEn);
				
				
			var decrypt = new JSEncrypt();
			decrypt.setPrivateKey(this.PRIVATE_KEY);
			this.dataDn = decrypt.decryptLong(this.dataEn);
			this.data1 =decodeURIComponent(this.dataDn)
			
			console.log('decryptLong后数据:%o', this.dataDn);
			console.log('decodeURIComponent后数据:%o', this.data1);
```



### 示例代码

```vue
<template>
	<view class="content">
	
	
			<view class="title">{{long_text}}</view>
		
			<view class="title">{{data}}</view>
		
			<view class="title">{{dataEn}}</view>
		
			<view class="title">{{dataDn}}</view>
		
			<view class="title">{{data1}}</view>
	
	</view>
</template>

<script>
	
	import JSEncrypt from "@/js-sdk/mark-jsencrypt.js"	
	
	export default {
		data() {
			return {
				 PUBLIC_KEY : "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCGlCSxFgckJ2EmTHkNrHR0e0jlqXM/DCowNMgH1XMEkc5KG7j4W204+qLesd0ypIvqSgcKuQZirMjyhR1XVfWx7bAMXjBh6odc2bOnNoMBHMRVByn69G7mPSumoa0nJH3zAzx/x4E1fZ2+tiaut9yGcg0nuLq9cEijDYrcK/23EQIDAQAB",
				 PRIVATE_KEY : "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAIaUJLEWByQnYSZMeQ2sdHR7SOWpcz8MKjA0yAfVcwSRzkobuPhbbTj6ot6x3TKki+pKBwq5BmKsyPKFHVdV9bHtsAxeMGHqh1zZs6c2gwEcxFUHKfr0buY9K6ahrSckffMDPH/HgTV9nb62Jq633IZyDSe4ur1wSKMNitwr/bcRAgMBAAECgYBd3dBlz9Z1Sh5Bx08b0XB8mkzzGyiuDf8TFo16oU+THVvEZueyGprpBjA5odeF7i1E4hNdUEZ65sdWGLCpbORsDgbi1rjmbG7oGXK4H7GB+E5VTlX732zwTnLABywrfAU3LRLEWuBTARU6J6WwvNINFq3HzXXPCiXQDNB0+A4+HQJBAMJyyg8w6j6yrZPYZUnPkrwCpdA2Np0h9mhB2nKaQThEUErDLaa48SVd6ueUaqI/2PRoibSEgaDqs0SoF8361P8CQQCxLckt/weiH5qWrrhMSmcxlStD8vnjyDbjLsq4/PxVocpyv8yqt2Yz1Y7zX1m9Al1eCmsuJOzzdO5JMC1STiPvAkBr8gmWEVOY5txRfQoNxbvxv46JXe9Hn/kIu7YndNbMA7CHMH8BVR4Z3l9vnAbud39bf0Ui/4Ru7pwCe0ZrxNnFAkEAiTUr1rLo9mQDEy27C1mTEJK0Lqq7WepylvxlgVxpDOd+H97oYEwmmX2IdnAgzn5GT81BszplRSQIZCUq89IPgQJBALqXh6wStKW/hNuGIPBlw+V6YZnFkAfoBB2rAhbdnY0n8OafrG3OLlDOKtLL78J+Oho/Yv2/YLhQ77C7haIwfZE=",
                long_text:{"name":"中文","age":18,"text":"长长的中文长长的中文长长的中文长长的中文长长的中文长长的中文长长的中文长长的中文长长的中文长长的中文长长的中文长长的中文长长的中文"},

				data:"",
				dataEn:"",
				dataDn:"",
				data1:"",
			}
		},
		onLoad() {
		
		var encrypt = new JSEncrypt();
			encrypt.setPublicKey(this.PUBLIC_KEY);
			
			this.data = encodeURIComponent(JSON.stringify(this.long_text));
			this.dataEn = encrypt.encryptLong(this.data);
			console.log('encodeURIComponent:%o', this.data);
			console.log('encryptLong后数据:%o', this.dataEn);
				
				
			var decrypt = new JSEncrypt();
			decrypt.setPrivateKey(this.PRIVATE_KEY);
			this.dataDn = decrypt.decryptLong(this.dataEn);
			this.data1 =decodeURIComponent(this.dataDn)
			
			console.log('decryptLong后数据:%o', this.dataDn);
			console.log('decodeURIComponent后数据:%o', this.data1);
		
         
		},
		methods: {

		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>

```

