Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement fingerprint randomart generation #6

Merged
merged 2 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions assets/openssh_dsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[DSA 1024]----+
| .=+ |
| ..... . |
| .+oo . .o |
| .== + o++o |
| .==+ =+S=.. |
|.+Eo...+*.o |
|+ . +.=. |
| . . +... . |
| .o .. .o |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_dsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[DSA 1024]----+
| |
| |
| E o|
| . . = |
| . . S. o = o|
| . o ooo . * @.|
| o o.... + @ +|
| o.+=o+ o * + |
| B+.+.*=o o.+|
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_ecdsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[ECDSA 256]---+
| . o=++++ .o.|
| + ..+..= =o.o|
| o + .++ * o=*|
| + o .+ * . +B|
| . . oS.E + .o+|
| . . .o o +|
| . . . |
| |
| |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_ecdsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[ECDSA 384]---+
| . ..+|
| . . o .=|
| . . o o o o ...|
| o . + O o = .|
| . o S X o + =|
| . * + o Bo|
| E o o.*|
| . +o*|
| .. OO|
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_ed25519.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+--[ED25519 256]--+
| .... . =.|
| o+o. . o . =E*|
| o=+.+ + o o =.|
| ++..o + . + |
| ... + S + o |
| .+ o . . o |
| .o o o . |
|.....=. |
| ++oo+o |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_ed25519_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+--[ED25519 256]--+
| . |
|E o |
|++. . |
|@o+ . . |
|=X+.o + S |
|.=+= = + . |
| @ = + . |
|.=o% o |
|++O*+ |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_rsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[RSA 2048]----+
| |
| o |
| . . o . |
| o . . . |
| o . S . |
|oo. .. . . |
|+=*+E= . o |
|B@=*= * . |
|#@@*==.. |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/openssh_rsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[RSA 2048]----+
|o . .. |
|.+ o . . . |
|... E . . o |
|+ o o o. + |
|Bo .. S oo + |
|+O.o + .* o |
|++B o o . * |
|++.* . o |
|ooo.+ .. |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pem_dsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[DSA 1024]----+
|B=o**BOo. |
|+*B +Eoo. |
|O+.= . +o |
|*.. o o+. |
| + ooSo |
| + o .oo o |
| + o |
| |
| |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pem_dsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[DSA 1024]----+
| + o+.. |
|o *.oo |
| = = . |
|o =o.. + . |
|+=E.o S o . |
|+=+. o o |
|+=B. |
|B*oo |
|BBBo |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pem_ecdsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[ECDSA 256]---+
|@*=. .*.... |
|*=@+o + +.. |
|=@=O.. +o+ |
|=+Eo* .o+o. |
|. o . S. . |
| . |
| |
| |
| |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pem_ecdsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[ECDSA 256]---+
| E+ o.**oo++ |
| . . *==oo.....|
| o BoO . +.+|
| . = % = o o+|
| o S = o o .|
| o o . |
| + . |
| o |
| |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pem_rsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[RSA 2048]----+
| |
| o |
| . . o . |
| o . . . |
| o . S . |
|oo. .. . . |
|+=*+E= . o |
|B@=*= * . |
|#@@*==.. |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pem_rsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[RSA 2048]----+
| ...E==+=|
| .+.* ooo.|
| ...* = ..|
| +.o + .o |
| o S o o =oo|
| o = = o.==|
| o o . .o=|
| ++|
| .+|
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pkcs8_rsa.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[RSA 4096]----+
| .oX%==o+=E+|
| oo*OBO..o =|
| =o.@ o .. |
| .ooo = . ..|
| o.So o .|
| . . |
| |
| |
| |
+----[SHA256]-----+
11 changes: 11 additions & 0 deletions assets/pkcs8_rsa_enc.randomart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+---[RSA 4096]----+
| |
| . . |
| + |
| + . |
| = S. |
| . Bo+. |
| ..o.+..Bo+ |
|.o*+oo+oo=.o |
|.*X@B+o+o.++E |
+----[SHA256]-----+
10 changes: 10 additions & 0 deletions src/keys/dsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use std::fmt;

/// The key name returned by [`Key::keyname()`](../trait.Key.html#method.keyname)
pub const DSA_NAME: &str = "ssh-dss";
/// The key name returned by [`Key::short_keyname()`](../trait.Key.html#method.short_keyname)
pub const DSA_SHORT_NAME: &str = "DSA";

/// Represent the DSA public key
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -51,6 +53,10 @@ impl Key for DsaPublicKey {
fn keyname(&self) -> &'static str {
DSA_NAME
}

fn short_keyname(&self) -> &'static str {
DSA_SHORT_NAME
}
}

impl PublicParts for DsaPublicKey {
Expand Down Expand Up @@ -128,6 +134,10 @@ impl Key for DsaKeyPair {
fn keyname(&self) -> &'static str {
DSA_NAME
}

fn short_keyname(&self) -> &'static str {
DSA_SHORT_NAME
}
}

impl PublicParts for DsaKeyPair {
Expand Down
10 changes: 10 additions & 0 deletions src/keys/ecdsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pub const NIST_P256_NAME: &str = "ecdsa-sha2-nistp256";
pub const NIST_P384_NAME: &str = "ecdsa-sha2-nistp384";
/// The name of 521 bits curve key returned by [`Key::keyname()`](../trait.Key.html#method.keyname)
pub const NIST_P521_NAME: &str = "ecdsa-sha2-nistp521";
/// The short name of ECDSA returned by [`Key::short_keyname()`](../trait.Key.html#method.short_keyname)
pub const ECDSA_SHORT_NAME: &str = "ECDSA";

/// An enum of the supported elliptic curves
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Expand Down Expand Up @@ -155,6 +157,10 @@ impl Key for EcDsaPublicKey {
fn keyname(&self) -> &'static str {
self.curve.name()
}

fn short_keyname(&self) -> &'static str {
ECDSA_SHORT_NAME
}
}

impl PublicParts for EcDsaPublicKey {
Expand Down Expand Up @@ -277,6 +283,10 @@ impl Key for EcDsaKeyPair {
fn keyname(&self) -> &'static str {
self.curve.name()
}

fn short_keyname(&self) -> &'static str {
ECDSA_SHORT_NAME
}
}

impl PublicParts for EcDsaKeyPair {
Expand Down
10 changes: 10 additions & 0 deletions src/keys/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ use std::{convert::TryFrom, fmt};

/// The key name returned by [`Key::keyname()`](../trait.Key.html#method.keyname)
pub const ED25519_NAME: &str = "ssh-ed25519";
/// The short key name returned by [`Key::short_keyname()`](../trait.Key.html#method.short_keyname)
pub const ED25519_SHORT_NAME: &str = "ED25519";

/// Represent the Ed25519 public key
#[derive(Debug, Clone)]
Expand All @@ -42,6 +44,10 @@ impl Key for Ed25519PublicKey {
fn keyname(&self) -> &'static str {
ED25519_NAME
}

fn short_keyname(&self) -> &'static str {
ED25519_SHORT_NAME
}
}

impl PublicParts for Ed25519PublicKey {
Expand Down Expand Up @@ -80,6 +86,10 @@ impl Key for Ed25519KeyPair {
fn keyname(&self) -> &'static str {
ED25519_NAME
}

fn short_keyname(&self) -> &'static str {
ED25519_SHORT_NAME
}
}

impl Ed25519KeyPair {
Expand Down
Loading