From 2e9e03c7971f1da71cc9e9bd7d2f159c244839f3 Mon Sep 17 00:00:00 2001
From: suerprisePlus <15810472099@163.com>
Date: 星期二, 03 九月 2024 19:39:48 +0800
Subject: [PATCH] 代码优化

---
 src/main/java/com/yb/helper/RsaHelper.java |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/yb/helper/RsaHelper.java b/src/main/java/com/yb/helper/RsaHelper.java
index 3ef5599..b224ca7 100644
--- a/src/main/java/com/yb/helper/RsaHelper.java
+++ b/src/main/java/com/yb/helper/RsaHelper.java
@@ -8,20 +8,20 @@
 import java.security.spec.X509EncodedKeySpec;
 
 public class RsaHelper {
-//    RsA绉橀挜鍔犲瘑
-public static String encrypt(String key ,String str) throws Exception {
-    // Base64缂栫爜鐨勫叕閽�
-    byte[] decoded = Base64.decodeBase64(key+ "");
+    //    RsA绉橀挜鍔犲瘑
+    public static String encrypt(String key, String str) throws Exception {
+        // Base64缂栫爜鐨勫叕閽�
+        byte[] decoded = Base64.decodeBase64(key + "");
 
-    RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
+        RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
 
-    // RSA鍔犲瘑锛歊SA/ECB/NoPadding
-    Cipher cipher = Cipher.getInstance("RSA");
-    cipher.init(Cipher.ENCRYPT_MODE, pubKey);
+        // RSA鍔犲瘑锛歊SA/ECB/NoPadding
+        Cipher cipher = Cipher.getInstance("RSA");
+        cipher.init(Cipher.ENCRYPT_MODE, pubKey);
 
-    String outStr = Base64.encodeBase64String(cipher.doFinal(str.getBytes("UTF-8")));
+        String outStr = Base64.encodeBase64String(cipher.doFinal(str.getBytes("UTF-8")));
 
-    return outStr;
-}
+        return outStr;
+    }
 
 }

--
Gitblit v1.9.3