Parse JWK from PEM objects for keypair in keystore with algorithm Ed25519

Issue #481 new
Former user created an issue

Hi,

im using the java keystore and a key pair generator with algorithm Ed25519.

When i try to parse the keypair fetched from the keystore with the algorithm Ed25519, then i get the unsupported algorithm exception because the JWK parser only supports EdDSA algorithm, but the keys provide Ed25519.

Is there any solution to bypass the JWK parser? Or is it possible to add Ed25519 to the Ed Familiy?

Comments (2)

  1. Rafael Kaczmarek
    private JWK createJWK(...)
                throws CertificateStorageException, IOException, JOSEException {
            final KeyStore.PrivateKeyEntry privateKeyEntry = certificateStorage.getEntry(...);
    
            final StringWriter stringWriter = new StringWriter();
            final JcaPEMWriter pemWriter = new JcaPEMWriter(stringWriter);
    
            pemWriter.writeObject(privateKeyEntry.getPrivateKey());
            pemWriter.writeObject(privateKeyEntry.getCertificate().getPublicKey());
            pemWriter.close();
            stringWriter.close();
    
            /// private/public key algorithm Ed25519
            return ECKey.parseFromPEMEncodedObjects(stringWriter.toString()); /// unsupported algorithm exception
    }
    

  2. Log in to comment