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

Method initKey

security/src/main/java/pro/tools/security/ToolAES.java:130–144  ·  view source on GitHub ↗

生成密钥 @return byte[] 二进制密钥 @throws Exception

()

Source from the content-addressed store, hash-verified

128 * @throws Exception
129 */
130 public static byte[] initKey() throws NoSuchAlgorithmException {
131 // 实例化
132 KeyGenerator kg = KeyGenerator.getInstance(KEY_ALGORITHM);
133
134 /*
135 * AES 要求密钥长度为 128位、192位或 256位
136 */
137 kg.init(256);
138
139 // 生成秘密密钥
140 SecretKey secretKey = kg.generateKey();
141
142 // 获得密钥的二进制编码形式
143 return secretKey.getEncoded();
144 }
145
146
147}

Callers

nothing calls this directly

Calls 2

getInstanceMethod · 0.80
initMethod · 0.45

Tested by

no test coverage detected