summaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r--ssh-keygen.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 4f90ac5c1..7f5185f8e 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keygen.c,v 1.175 2009/08/27 17:33:49 djm Exp $ */ 1/* $OpenBSD: ssh-keygen.c,v 1.176 2010/01/11 10:51:07 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -181,6 +181,7 @@ do_convert_to_ssh2(struct passwd *pw)
181 Key *k; 181 Key *k;
182 u_int len; 182 u_int len;
183 u_char *blob; 183 u_char *blob;
184 char comment[61];
184 struct stat st; 185 struct stat st;
185 186
186 if (!have_identity) 187 if (!have_identity)
@@ -203,11 +204,14 @@ do_convert_to_ssh2(struct passwd *pw)
203 fprintf(stderr, "key_to_blob failed\n"); 204 fprintf(stderr, "key_to_blob failed\n");
204 exit(1); 205 exit(1);
205 } 206 }
206 fprintf(stdout, "%s\n", SSH_COM_PUBLIC_BEGIN); 207 /* Comment + surrounds must fit into 72 chars (RFC 4716 sec 3.3) */
207 fprintf(stdout, 208 snprintf(comment, sizeof(comment),
208 "Comment: \"%u-bit %s, converted from OpenSSH by %s@%s\"\n", 209 "%u-bit %s, converted by %s@%s from OpenSSH",
209 key_size(k), key_type(k), 210 key_size(k), key_type(k),
210 pw->pw_name, hostname); 211 pw->pw_name, hostname);
212
213 fprintf(stdout, "%s\n", SSH_COM_PUBLIC_BEGIN);
214 fprintf(stdout, "Comment: \"%s\"\n", comment);
211 dump_base64(stdout, blob, len); 215 dump_base64(stdout, blob, len);
212 fprintf(stdout, "%s\n", SSH_COM_PUBLIC_END); 216 fprintf(stdout, "%s\n", SSH_COM_PUBLIC_END);
213 key_free(k); 217 key_free(k);