diff options
author | djm@openbsd.org <djm@openbsd.org> | 2019-07-15 13:16:29 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-07-15 23:21:18 +1000 |
commit | eb0d8e708a1f958aecd2d6e2ff2450af488d4c2a (patch) | |
tree | c5b7686e1e200aac6f3a742c7b15ed30a2c05067 /authfile.c | |
parent | e18a27eedccb024acb3cd9820b650a5dff323f01 (diff) |
upstream: support PKCS8 as an optional format for storage of
private keys, enabled via "ssh-keygen -m PKCS8" on operations that save
private keys to disk.
The OpenSSH native key format remains the default, but PKCS8 is a
superior format to PEM if interoperability with non-OpenSSH software
is required, as it may use a less terrible KDF (IIRC PEM uses a single
round of MD5 as a KDF).
adapted from patch by Jakub Jelen via bz3013; ok markus
OpenBSD-Commit-ID: 027824e3bc0b1c243dc5188504526d73a55accb1
Diffstat (limited to 'authfile.c')
-rw-r--r-- | authfile.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/authfile.c b/authfile.c index 2166c1689..851c1a8a1 100644 --- a/authfile.c +++ b/authfile.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: authfile.c,v 1.132 2019/06/28 13:35:04 deraadt Exp $ */ | 1 | /* $OpenBSD: authfile.c,v 1.133 2019/07/15 13:16:29 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -74,7 +74,7 @@ sshkey_save_private_blob(struct sshbuf *keybuf, const char *filename) | |||
74 | int | 74 | int |
75 | sshkey_save_private(struct sshkey *key, const char *filename, | 75 | sshkey_save_private(struct sshkey *key, const char *filename, |
76 | const char *passphrase, const char *comment, | 76 | const char *passphrase, const char *comment, |
77 | int force_new_format, const char *new_format_cipher, int new_format_rounds) | 77 | int format, const char *openssh_format_cipher, int openssh_format_rounds) |
78 | { | 78 | { |
79 | struct sshbuf *keyblob = NULL; | 79 | struct sshbuf *keyblob = NULL; |
80 | int r; | 80 | int r; |
@@ -82,7 +82,7 @@ sshkey_save_private(struct sshkey *key, const char *filename, | |||
82 | if ((keyblob = sshbuf_new()) == NULL) | 82 | if ((keyblob = sshbuf_new()) == NULL) |
83 | return SSH_ERR_ALLOC_FAIL; | 83 | return SSH_ERR_ALLOC_FAIL; |
84 | if ((r = sshkey_private_to_fileblob(key, keyblob, passphrase, comment, | 84 | if ((r = sshkey_private_to_fileblob(key, keyblob, passphrase, comment, |
85 | force_new_format, new_format_cipher, new_format_rounds)) != 0) | 85 | format, openssh_format_cipher, openssh_format_rounds)) != 0) |
86 | goto out; | 86 | goto out; |
87 | if ((r = sshkey_save_private_blob(keyblob, filename)) != 0) | 87 | if ((r = sshkey_save_private_blob(keyblob, filename)) != 0) |
88 | goto out; | 88 | goto out; |