summaryrefslogtreecommitdiff
path: root/sshkey.h
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2019-07-15 13:16:29 +0000
committerDamien Miller <djm@mindrot.org>2019-07-15 23:21:18 +1000
commiteb0d8e708a1f958aecd2d6e2ff2450af488d4c2a (patch)
treec5b7686e1e200aac6f3a742c7b15ed30a2c05067 /sshkey.h
parente18a27eedccb024acb3cd9820b650a5dff323f01 (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 'sshkey.h')
-rw-r--r--sshkey.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/sshkey.h b/sshkey.h
index 41d159a1b..d30a69cc9 100644
--- a/sshkey.h
+++ b/sshkey.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.h,v 1.32 2019/06/21 04:21:05 djm Exp $ */ 1/* $OpenBSD: sshkey.h,v 1.33 2019/07/15 13:16:29 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@@ -88,6 +88,13 @@ enum sshkey_serialize_rep {
88 SSHKEY_SERIALIZE_INFO = 254, 88 SSHKEY_SERIALIZE_INFO = 254,
89}; 89};
90 90
91/* Private key disk formats */
92enum sshkey_private_format {
93 SSHKEY_PRIVATE_OPENSSH = 0,
94 SSHKEY_PRIVATE_PEM = 1,
95 SSHKEY_PRIVATE_PKCS8 = 2,
96};
97
91/* key is stored in external hardware */ 98/* key is stored in external hardware */
92#define SSHKEY_FLAG_EXT 0x0001 99#define SSHKEY_FLAG_EXT 0x0001
93 100
@@ -221,7 +228,7 @@ int sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **keyp);
221/* private key file format parsing and serialisation */ 228/* private key file format parsing and serialisation */
222int sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob, 229int sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob,
223 const char *passphrase, const char *comment, 230 const char *passphrase, const char *comment,
224 int force_new_format, const char *new_format_cipher, int new_format_rounds); 231 int format, const char *openssh_format_cipher, int openssh_format_rounds);
225int sshkey_parse_private_fileblob(struct sshbuf *buffer, 232int sshkey_parse_private_fileblob(struct sshbuf *buffer,
226 const char *passphrase, struct sshkey **keyp, char **commentp); 233 const char *passphrase, struct sshkey **keyp, char **commentp);
227int sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type, 234int sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,