@Override
    protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException {
        if (keySpec == null) {
            throw new InvalidKeySpecException("keySpec == null");
        }
        if (keySpec instanceof EncodedKeySpec) {
            return new OpenSslMlDsaPublicKey((EncodedKeySpec) keySpec);
        }
        throw new InvalidKeySpecException(
                "Currently only EncodedKeySpec is supported; was " + keySpec.getClass().getName());
    }
An implementation of a {@link KeyFactorySpi} for MLDSA keys based on BoringSSL.
common/src/main/java/org/conscrypt/OpenSslMlDsaKeyFactory.java