rename PublicKey::Base#raw to #rfc4253
This commit is contained in:
Родитель
f7468f4f5e
Коммит
ce06217fed
|
@ -16,10 +16,10 @@ module SSHData
|
|||
def fingerprint(md5: false)
|
||||
if md5
|
||||
# colon separated, hex encoded md5 digest
|
||||
OpenSSL::Digest::MD5.digest(raw).unpack("H2" * 16).join(":")
|
||||
OpenSSL::Digest::MD5.digest(rfc4253).unpack("H2" * 16).join(":")
|
||||
else
|
||||
# base64 encoded sha256 digest with b64 padding stripped
|
||||
Base64.strict_encode64(OpenSSL::Digest::SHA256.digest(raw))[0...-1]
|
||||
Base64.strict_encode64(OpenSSL::Digest::SHA256.digest(rfc4253))[0...-1]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -33,10 +33,10 @@ module SSHData
|
|||
raise "implement me"
|
||||
end
|
||||
|
||||
# Raw encoding of public key.
|
||||
# RFC4253 binary encoding of public key.
|
||||
#
|
||||
# Returns a binary String.
|
||||
def raw
|
||||
def rfc4253
|
||||
raise "implement me"
|
||||
end
|
||||
|
||||
|
@ -46,7 +46,7 @@ module SSHData
|
|||
#
|
||||
# Returns a String key.
|
||||
def openssh(comment: nil)
|
||||
[algo, Base64.strict_encode64(raw), comment].compact.join(" ")
|
||||
[algo, Base64.strict_encode64(rfc4253), comment].compact.join(" ")
|
||||
end
|
||||
|
||||
# Is this public key equal to another public key?
|
||||
|
|
|
@ -80,10 +80,10 @@ module SSHData
|
|||
openssl.verify(OpenSSL::Digest::SHA1.new, openssl_sig, signed_data)
|
||||
end
|
||||
|
||||
# Raw encoding of public key.
|
||||
# RFC4253 binary encoding of public key.
|
||||
#
|
||||
# Returns a binary String.
|
||||
def raw
|
||||
def rfc4253
|
||||
Encoding.encode_fields(
|
||||
[:string, algo],
|
||||
[:mpint, p],
|
||||
|
|
|
@ -100,10 +100,10 @@ module SSHData
|
|||
openssl.verify(digest.new, openssl_sig, signed_data)
|
||||
end
|
||||
|
||||
# Raw encoding of public key.
|
||||
# RFC4253 binary encoding of public key.
|
||||
#
|
||||
# Returns a binary String.
|
||||
def raw
|
||||
def rfc4253
|
||||
Encoding.encode_fields(
|
||||
[:string, algo],
|
||||
[:string, curve],
|
||||
|
|
|
@ -46,10 +46,10 @@ module SSHData
|
|||
end
|
||||
end
|
||||
|
||||
# Raw encoding of public key.
|
||||
# RFC4253 binary encoding of public key.
|
||||
#
|
||||
# Returns a binary String.
|
||||
def raw
|
||||
def rfc4253
|
||||
Encoding.encode_fields(
|
||||
[:string, algo],
|
||||
[:string, pk],
|
||||
|
|
|
@ -32,10 +32,10 @@ module SSHData
|
|||
openssl.verify(OpenSSL::Digest::SHA1.new, raw_sig, signed_data)
|
||||
end
|
||||
|
||||
# Raw encoding of public key.
|
||||
# RFC4253 binary encoding of public key.
|
||||
#
|
||||
# Returns a binary String.
|
||||
def raw
|
||||
def rfc4253
|
||||
Encoding.encode_fields(
|
||||
[:string, algo],
|
||||
[:mpint, e],
|
||||
|
|
|
@ -87,7 +87,7 @@ describe SSHData::PublicKey::DSA do
|
|||
end
|
||||
|
||||
it "can be rencoded" do
|
||||
expect(openssh_key.raw).to eq(fixture("dsa_leaf_for_rsa_ca.pub", binary: true))
|
||||
expect(openssh_key.rfc4253).to eq(fixture("dsa_leaf_for_rsa_ca.pub", binary: true))
|
||||
end
|
||||
|
||||
it "can verify certificate signatures" do
|
||||
|
|
|
@ -8,7 +8,7 @@ describe SSHData::PublicKey::ECDSA do
|
|||
end
|
||||
|
||||
it "can be rencoded" do
|
||||
expect(openssh_key.raw).to eq(fixture("ecdsa_leaf_for_rsa_ca.pub", binary: true))
|
||||
expect(openssh_key.rfc4253).to eq(fixture("ecdsa_leaf_for_rsa_ca.pub", binary: true))
|
||||
end
|
||||
|
||||
it "can verify certificate signatures" do
|
||||
|
|
|
@ -54,7 +54,7 @@ describe SSHData::PublicKey::ED25519 do
|
|||
end
|
||||
|
||||
it "can be rencoded" do
|
||||
expect(openssh_key.raw).to eq(fixture("ed25519_leaf_for_rsa_ca.pub", binary: true))
|
||||
expect(openssh_key.rfc4253).to eq(fixture("ed25519_leaf_for_rsa_ca.pub", binary: true))
|
||||
end
|
||||
|
||||
it "can verify certificate signatures" do
|
||||
|
|
|
@ -60,7 +60,7 @@ describe SSHData::PublicKey::RSA do
|
|||
end
|
||||
|
||||
it "can be rencoded" do
|
||||
expect(openssh_key.raw).to eq(fixture("rsa_leaf_for_rsa_ca.pub", binary: true))
|
||||
expect(openssh_key.rfc4253).to eq(fixture("rsa_leaf_for_rsa_ca.pub", binary: true))
|
||||
end
|
||||
|
||||
it "can verify certificate signatures" do
|
||||
|
|
Загрузка…
Ссылка в новой задаче