MCPcopy Create free account
hub / github.com/SeanDragon/protools / toKey

Method toKey

security/src/main/java/pro/tools/security/ToolPBE.java:82–93  ·  view source on GitHub ↗

转换密钥 @param password 密码 @return Key 密钥 @throws Exception

(String password)

Source from the content-addressed store, hash-verified

80 * @throws Exception
81 */
82 private static Key toKey(String password) throws NoSuchAlgorithmException, InvalidKeySpecException {
83 // 密钥材料转换
84 PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
85
86 // 实例化
87 SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
88
89 // 生成密钥
90 SecretKey secretKey = keyFactory.generateSecret(keySpec);
91
92 return secretKey;
93 }
94
95 /**
96 * 加密

Callers 2

encryptMethod · 0.95
decryptMethod · 0.95

Calls 1

getInstanceMethod · 0.80

Tested by

no test coverage detected