JcaPGPKeyConverter: Set fixed length for DEROctetString representation of keys
While a similar change was applied to the BcPGPKeyConverter the same issue apparently also affects the JcaPGPKeyConverter
import org.bouncycastle.jcajce.util.NamedJcaJceHelper;
import org.bouncycastle.jcajce.util.ProviderJcaJceHelper;
import org.bouncycastle.math.ec.ECPoint;
+import org.bouncycastle.math.ec.rfc8032.Ed25519;
import org.bouncycastle.openpgp.PGPAlgorithmParameters;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPKdfParameters;
@@ -209,7 +210,7 @@ public PrivateKey getPrivateKey(PGPPrivateKey privKey)
return implGetPrivateKeyPKCS8("EdDSA", new PrivateKeyInfo(
new AlgorithmIdentifier(EdECObjectIdentifiers.id_Ed25519),
- new DEROctetString(BigIntegers.asUnsignedByteArray(eddsaK.getX()))));
+ new DEROctetString(BigIntegers.asUnsignedByteArray(Ed25519.SECRET_KEY_SIZE, eddsaK.getX()))));
}
case PublicKeyAlgorithmTags.ELGAMAL_ENCRYPT:
