~ubuntu-branches/ubuntu/lucid/openssl/lucid-proposed

« back to all changes in this revision

Viewing changes to apps/pkcs12.c

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2009-06-13 18:15:46 UTC
  • mto: (11.1.5 squeeze)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: james.westby@ubuntu.com-20090613181546-vbfntai3b009dl1u
Tags: upstream-0.9.8k
ImportĀ upstreamĀ versionĀ 0.9.8k

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* pkcs12.c */
2
 
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
 
2
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3
3
 * project.
4
4
 */
5
5
/* ====================================================================
100
100
    char **args;
101
101
    char *name = NULL;
102
102
    char *csp_name = NULL;
 
103
    int add_lmk = 0;
103
104
    PKCS12 *p12 = NULL;
104
105
    char pass[50], macpass[50];
105
106
    int export_cert = 0;
110
111
    int maciter = PKCS12_DEFAULT_ITER;
111
112
    int twopass = 0;
112
113
    int keytype = 0;
113
 
    int cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
 
114
    int cert_pbe;
114
115
    int key_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
115
116
    int ret = 1;
116
117
    int macver = 1;
127
128
 
128
129
    apps_startup();
129
130
 
 
131
#ifdef OPENSSL_FIPS
 
132
    if (FIPS_mode())
 
133
        cert_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
 
134
    else
 
135
#endif
 
136
    cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
 
137
 
130
138
    enc = EVP_des_ede3_cbc();
131
139
    if (bio_err == NULL ) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
132
140
 
224
232
                        args++; 
225
233
                        name = *args;
226
234
                    } else badarg = 1;
227
 
                } else if (!strcmp (*args, "-CSP")) {
 
235
                } else if (!strcmp (*args, "-LMK"))
 
236
                        add_lmk = 1;
 
237
                else if (!strcmp (*args, "-CSP")) {
228
238
                    if (args[1]) {
229
239
                        args++; 
230
240
                        csp_name = *args;
338
348
        BIO_printf(bio_err,  "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
339
349
        BIO_printf(bio_err,  "              load the file (or the files in the directory) into\n");
340
350
        BIO_printf(bio_err,  "              the random number generator\n");
 
351
        BIO_printf(bio_err,  "-CSP name     Microsoft CSP name\n");
 
352
        BIO_printf(bio_err,  "-LMK          Add local machine keyset attribute to private key\n");
341
353
        goto end;
342
354
    }
343
355
 
562
574
        if (csp_name && key)
563
575
                EVP_PKEY_add1_attr_by_NID(key, NID_ms_csp_name,
564
576
                                MBSTRING_ASC, (unsigned char *)csp_name, -1);
565
 
                
 
577
 
 
578
        if (add_lmk && key)
 
579
                EVP_PKEY_add1_attr_by_NID(key, NID_LocalKeySet, 0, NULL, -1);
566
580
 
567
581
#ifdef CRYPTO_MDEBUG
568
582
        CRYPTO_pop_info();