diff --git a/src/main/scala/ssh/SshUtil.scala b/src/main/scala/ssh/SshUtil.scala index db578de..50e1cc9 100644 --- a/src/main/scala/ssh/SshUtil.scala +++ b/src/main/scala/ssh/SshUtil.scala @@ -28,6 +28,9 @@ } } - def fingerPrint(key: String): String = KeyUtils.getFingerPrint(str2PublicKey(key).get) + def fingerPrint(key: String): Option[String] = str2PublicKey(key) match { + case Some(publicKey) => Some(KeyUtils.getFingerPrint(publicKey)) + case None => None + } } diff --git a/src/main/twirl/account/ssh.scala.html b/src/main/twirl/account/ssh.scala.html index e6ee34c..8f37ace 100644 --- a/src/main/twirl/account/ssh.scala.html +++ b/src/main/twirl/account/ssh.scala.html @@ -17,7 +17,7 @@ @if(i != 0){
} - @key.title (@_root_.ssh.SshUtil.fingerPrint(key.publicKey)) + @key.title (@_root_.ssh.SshUtil.fingerPrint(key.publicKey).getOrElse("Key is invalid.")) Delete } @@ -42,4 +42,4 @@ -} \ No newline at end of file +}