Skip to content

Commit 4ec1875

Browse files
authored
Merge pull request #52 from github/memoize-pub-key
Memoize the public key in SSH signature
2 parents 42b8065 + 7c9505e commit 4ec1875

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/ssh_data/signature.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ def verify(signed_data, **opts)
108108
# If the signature was created from a certificate, this will be an
109109
# SSHData::Certificate. Otherwise, this will be a PublicKey algorithm.
110110
def public_key
111+
@data_public_key ||= load_public_key
112+
end
113+
114+
private def load_public_key
111115
public_key_algorithm, _ = Encoding.decode_string(@publickey)
112116

113117
if PublicKey::ALGOS.include?(public_key_algorithm)

0 commit comments

Comments
 (0)