Create applicationServerKey for Push API with OpenSSL

18 Views Asked by At

I want to generate a value that's suitable for the applicationServerKey for a Push API subscription. Here is a library that does this correctly:

https://github.com/web-push-libs/vapid/blob/main/python/py_vapid/main.py#L70

Excerpt:

raw_pub = vapid.public_key.public_bytes(
        serialization.Encoding.X962,
        serialization.PublicFormat.UncompressedPoint
    )
print("Application Server Key = {}\n\n".format(
    b64urlencode(raw_pub)))

However I want to perform this in the command-line, instead of with this Python library. I've made an attempt at what seems to me like it should produce the correct output but it does not match.

openssl ec -in key.pem -pubout -outform der -conv_form compressed 2>/dev/null | basez -u | tr -d =

What is this command missing?

0

There are 0 best solutions below