# ES256 string encryption

**URL:** <https://forum.elixirforum.com/t/es256-string-encryption/51002>\
**Category:** Questions\
**Tags:** jwt, encryption\
**Created:** [October 13, 2022, 5:35pm UTC](https://forum.elixirforum.com/t/es256-string-encryption/51002 "2022-10-13T17:35:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![voltone](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/voltone/32/24672_2.png) [@voltone](https://forum.elixirforum.com/u/voltone)\
**Post date:** [October 14, 2022, 10:12am UTC](https://forum.elixirforum.com/t/es256-string-encryption/51002/2 "2022-10-14T10:12:39Z")

</div>

I don’t see any mention of JWS in Apple’s documentation, I think they are looking for a raw ECDSA signature. What you want is probably:

```elixir
:public_key.sign(completePath, :sha256, priv)
|> Base.url_encode64(padding: false)

```

Where `priv` is the raw private key in Erlang record format. If you want to keep using JOSE for reading the key you could use `priv = JOSE.JWK.to_key(privateKey) |> elem(1)`. Or you could use [x509](https://hex.pm/packages/x509) instead: `priv = File.read!("authkey.p8") |> X509.PrivateKey.from_pem!()`.

---

_[View the full topic](https://forum.elixirforum.com/t/es256-string-encryption/51002)._
