Skip to content

Commit

Permalink
Fix SSH key fingerprint.
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed Dec 13, 2023
1 parent a7abee6 commit 1ab31bd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bark_core/signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from cryptography.hazmat.primitives.serialization import SSHPublicKeyTypes
from cryptography.hazmat.primitives.hashes import Hash, SHA1, SHA256, SHA384, SHA512
from typing import Any, Union, Optional, Tuple
from base64 import b64decode
from base64 import b64decode, b64encode
from abc import ABC, abstractmethod

import warnings
Expand Down Expand Up @@ -334,8 +334,9 @@ def type(self) -> str:

@property
def fingerprint(self) -> str:
# TODO: fingerprint
return str(self._key)
md = Hash(SHA256())
md.update(self._key)
return b64encode(md.finalize()).decode().rstrip("=")

def verify_signature(self, email: str, signature: bytes, subject: bytes) -> bool:
if email not in self._emails:
Expand Down

0 comments on commit 1ab31bd

Please sign in to comment.