foxhole/app/key.py

10 lines
241 B
Python
Raw Permalink Normal View History

#!/usr/bin/env python3
from pathlib import Path
from Crypto.PublicKey import RSA
2023-08-02 14:53:09 +02:00
def get_pubkey_as_pem(key_path: Path) -> str:
text = key_path.read_text()
return RSA.import_key(text).public_key().export_key("PEM").decode("utf-8")