i'm using openssl in generating an certificate requests ,

what option do i specify in generating an private key with bag attributes

example :

Bag Attributes
    friendlyName: test-server
    localKeyID: 54 69 6D 65 20 31 34 37 34 34 32 31 35 37 30 35 35 39 
Key Attributes: <No Attributes>

1 Answer 1


Bag attributes in OpenSSL PEM files seem to be a side effect of converting a PKCS#12 keypair into PEM format. An example is here:

Export PKCS12 files to PEM format using OpenSSL

If you're creating a PKCS#12 file using openssl, some of the command line arguments correlate to the bag attributes, and you can set them that way:

-name friendlyname

This specifies the "friendly name" for the certificate and private
key. This name is typically displayed in list boxes by software
importing the file.

-caname friendlyname

This specifies the "friendly name" for other certificates. This
option may be used multiple times to specify names for all 
certificates in the order they appear. Netscape ignores friendly
names on other certificates whereas MSIE displays them.

-CSP name

Write name as a Microsoft CSP name.

This page describes how to remove Bag Attributes by converting PKCS#12 to PEM, trimming the PEM, and converting PEM back to PKCS#12 - not what you're looking for, but illustrative. You might be able to alter some bag attributes by converting, editing, converting back (although I wouldn't expect anything good to come out of modifying the localKeyID, for example)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .