diff options
Diffstat (limited to 'src/certtool-common.h')
-rw-r--r-- | src/certtool-common.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/certtool-common.h b/src/certtool-common.h index 16c3c53dfa..a4a8b5e085 100644 --- a/src/certtool-common.h +++ b/src/certtool-common.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2003-2012 Free Software Foundation, Inc. + * Copyright (C) 2017 Red Hat, Inc. * * This file is part of GnuTLS. * @@ -79,6 +80,18 @@ typedef struct common_info { unsigned sort_chain; } common_info_st; +static inline +void switch_to_pkcs8_when_needed(common_info_st *cinfo, unsigned key_type) +{ + if ((key_type == GNUTLS_PK_RSA_PSS || key_type == GNUTLS_PK_EDDSA_ED25519) && !cinfo->pkcs8) { + fprintf(stderr, "Assuming --pkcs8 is given; %s private keys can only be exported in PKCS#8 format\n", + gnutls_pk_algorithm_get_name(key_type)); + cinfo->pkcs8 = 1; + if (cinfo->password == NULL) + cinfo->password = ""; + } +} + /* this must be provided by the app */ const char *get_pass(void); const char *get_confirmed_pass(bool empty_ok); |