我得到了AsymmetricKeyParameter a = asymmetricCipherKeyPair.getPublic(); 我花了几个小时在这个上面,并且不知道如何将公钥变成一个字节序列。任何想法?
NTRUEncryptionKeyPairGenerator ntruEncryptionKeyPairGenerator = new NTRUEncryptionKeyPairGenerator();
long begin = System.currentTimeMillis();
NTRUEncryptionKeyGenerationParameters ntruEncryptionKeyPairGeneratorParameters = NTRUEncryptionKeyGenerationParameters.EES1087EP2;
ntruEncryptionKeyPairGenerator.init(ntruEncryptionKeyPairGeneratorParameters);
AsymmetricCipherKeyPair asymmetricCipherKeyPair = ntruEncryptionKeyPairGenerator.generateKeyPair();
我试过
AsymmetricKeyParameter a = asymmetricCipherKeyPair.getPublic();
SubjectPublicKeyInfo info = SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(a);
但它会抛出“无法识别的关键参数。”
答案 0 :(得分:0)
((NTRUEncryptionPublicKeyParameters)asymmetricCipherKeyPair.getPublic()).getEncoded();