@@ -1864,6 +1864,16 @@ def test_ssh_key_fingerprint_rsa_md5(self):
18641864 fingerprint = ssh_key_fingerprint (public_key , hashes .MD5 ())
18651865 assert fingerprint == b"\x10 G\xc2 es\xd6 QIH\x0b \x81 \x1f 6\x04 {R"
18661866
1867+ def test_ssh_key_fingerprint_rsa_sha1 (self ):
1868+ ssh_key = load_vectors_from_file (
1869+ os .path .join ("asymmetric" , "OpenSSH" , "rsa-nopsw.key.pub" ),
1870+ lambda f : f .read (),
1871+ mode = "rb" ,
1872+ )
1873+ public_key = load_ssh_public_key (ssh_key )
1874+ fingerprint = ssh_key_fingerprint (public_key , hashes .SHA1 ())
1875+ assert fingerprint == b"cQ{L\xf8 V\xb5 N\x8c \x8e ^ni?\xb7 (1\xc4 \xba \xc5 "
1876+
18671877 def test_ssh_key_fingerprint_rsa_sha256 (self ):
18681878 ssh_key = load_vectors_from_file (
18691879 os .path .join ("asymmetric" , "OpenSSH" , "rsa-nopsw.key.pub" ),
@@ -1891,6 +1901,16 @@ def test_ssh_key_fingerprint_ed25519_md5(self):
18911901 fingerprint = ssh_key_fingerprint (public_key , hashes .MD5 ())
18921902 assert fingerprint == b"\xe5 R=\x01 \x9e \xa0 \xc1 \xe9 \x8c ?L|\xc5 \x94 W\x85 "
18931903
1904+ def test_ssh_key_fingerprint_ed25519_sha1 (self ):
1905+ ssh_key = load_vectors_from_file (
1906+ os .path .join ("asymmetric" , "OpenSSH" , "ed25519-nopsw.key.pub" ),
1907+ lambda f : f .read (),
1908+ mode = "rb" ,
1909+ )
1910+ public_key = load_ssh_public_key (ssh_key )
1911+ fingerprint = ssh_key_fingerprint (public_key , hashes .SHA1 ())
1912+ assert fingerprint == b"$\x8a \x8d ~p` <\xc4 \xdb \x80 \xf7 *\xaf {)-RX{"
1913+
18941914 def test_ssh_key_fingerprint_ed25519_sha256 (self ):
18951915 ssh_key = load_vectors_from_file (
18961916 os .path .join ("asymmetric" , "OpenSSH" , "ed25519-nopsw.key.pub" ),
@@ -1918,6 +1938,18 @@ def test_ssh_key_fingerprint_ecdsa_md5(self):
19181938 fingerprint = ssh_key_fingerprint (public_key , hashes .MD5 ())
19191939 assert fingerprint == b"\r e\xf2 -\xfa Gq\x8c ^\x16 \xb0 5+\x06 \x1b 7"
19201940
1941+ def test_ssh_key_fingerprint_ecdsa_sha1 (self ):
1942+ ssh_key = load_vectors_from_file (
1943+ os .path .join ("asymmetric" , "OpenSSH" , "ecdsa-nopsw.key.pub" ),
1944+ lambda f : f .read (),
1945+ mode = "rb" ,
1946+ )
1947+ public_key = load_ssh_public_key (ssh_key )
1948+ fingerprint = ssh_key_fingerprint (public_key , hashes .SHA1 ())
1949+ assert fingerprint == (
1950+ b"\xdd \xa5 8\x87 cl\x8f \x89 \xd9 \xd2 \x83 6~\xd1 R\xd7 \xd7 \xf2 \x87 \xa9 "
1951+ )
1952+
19211953 def test_ssh_key_fingerprint_ecdsa_sha256 (self ):
19221954 ssh_key = load_vectors_from_file (
19231955 os .path .join ("asymmetric" , "OpenSSH" , "ecdsa-nopsw.key.pub" ),
@@ -1939,7 +1971,7 @@ def test_ssh_key_fingerprint_unsupported_hash(self):
19391971 )
19401972 public_key = load_ssh_public_key (ssh_key )
19411973 with pytest .raises (TypeError ):
1942- ssh_key_fingerprint (public_key , hashes .SHA1 ()) # type: ignore[arg-type]
1974+ ssh_key_fingerprint (public_key , hashes .SM3 ()) # type: ignore[arg-type]
19431975
19441976 def test_ssh_key_fingerprint_unsupported_key (self ):
19451977 with pytest .raises (ValueError ):
0 commit comments