如何使用自定义主密钥来生成普通密钥和使用Java加密密钥
我正在阅读亚马逊密钥管理系统 docs 。我试图自己实施加密和解密工作流程。我正在使用此Java代码来生成一个自定义主密钥:
private static SecretKey generateMasterKey() throws NoSuchAlgorithmException {
KeyGenerator keyGen = null;
keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256); // 256 bit key
SecretKey masterKey = keyGen.generateKey();
return masterKey;
}
下一步是使用自定义主密钥生成2种键,加密键和Uncrypt键下一步的密码)。我想使用Uncantrypt密钥来加密密码,并将密码加密内容和加密文本加密在数据库中。如何从自定义主密钥中生成加密密钥和Uncrypt密钥?像图像这样的两个键:
I am reading the amazon key management system docs. I have tried to implement the encrypt and decrypt workflow by myself. I am using this java code to generate a custom master key like this:
private static SecretKey generateMasterKey() throws NoSuchAlgorithmException {
KeyGenerator keyGen = null;
keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256); // 256 bit key
SecretKey masterKey = keyGen.generateKey();
return masterKey;
}
The next step is to use the custom master key to generate 2 types of key, the encrypt key and unencrypt key (I do not know how to explain the key name the right way, the key could encrypt the password for the next step). I want to use the unencrypt key to encrypt the password and store the password encrypt content and encrypt text in database. How to generate the encrypt key and unencrypt key from the custom master key? The two keys like the image:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论