【发布时间】:2017-03-07 12:27:42
【问题描述】:
我正在使用以下方法使用 Spongy Castle 从密钥中提取私钥:
public static PGPPrivateKey findPrivateKey(PGPSecretKey pgpSecKey, char[] pass)
throws PGPException {
if (pgpSecKey == null) return null;
PBESecretKeyDecryptor decryptor = new BcPBESecretKeyDecryptorBuilder(
new BcPGPDigestCalculatorProvider()).build(pass);
return pgpSecKey.extractPrivateKey(decryptor);
}
但最后一行代码在 Android 上运行速度非常慢(大约 90 秒)。关于如何从加密的密钥中提取 PGPPrivateKey 有没有更好的方法?也许我在从 linux 导出密钥时犯了一些错误,但我认为这不是问题,因为我使用了简单的命令gpg --export-secret-keys > key.skr。关于可能导致此问题的任何想法?
【问题讨论】:
标签: android bouncycastle private-key pgp spongycastle