如何在Java KeyStore中存储一个简单的密钥字符串? [英] How to store a simple key string inside Java KeyStore?

查看:429
本文介绍了如何在Java KeyStore中存储一个简单的密钥字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的FS(S3 AWS密钥)上有一个文件,其中包含一个字符串,该字符串是我用于加密过程的密钥。

I have a file on my FS (a S3 AWS key) that contains a string that is a key I use for encryption process.

我想移动它是一个Java KeyStore。

I would like to move it a Java KeyStore.

我知道如何使用keytool将证书导入KeyStore,但我找不到导入简单字符串键的方法。

I know how to import a certificate into a KeyStore with keytool but I can't find the way to import a simple string key.

你能帮忙吗?

推荐答案

我看不到办法它与keytool,但有些戳,我想知道你是否可以在代码中存储和检索它作为PasswordBasedEncryption(PBE)SecretKey。 (免责声明:我自己没试过这个。)

I don't see a way to do it with keytool, but some poking about, I wonder if you could store and retrieve it in code as a PasswordBasedEncryption (PBE) SecretKey. (Disclaimer: I haven't tried this myself).

推动这种想法的资源:
PBEKeySpec javadoc CryptoSpec - 使用基于密码的加密示例

The resources that drove this thought: PBEKeySpec javadoc and CryptoSpec - Using Password Based Encryption example

这篇关于如何在Java KeyStore中存储一个简单的密钥字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆