Eu estava usando a ferramenta da Microsoft makecert para isso.
Primeiro, você precisa criar uma chave de autoridade de certificação (CA):
makecert -pe -n "CN=My Root CA" -ss root -a sha512 -sky signature -len 2048 -h 1 -cy authority -r my_ca.cer
# -pe: Mark private key as exportable - useful for backup.
# -n "CN=My Root CA": The name of the certificate. Please use an individual name and replace the "My" with your full name.
# -ss root: The store where makecert shall place the certificate (Root certificates store).
# -a sha512: The signature algorithm to use. Right now SHA512 is the maximum available.
# -sky signature: The key type (signature, not exchange).
# -len 2048: Key length in bits. You might consider generating a longer key.
# -h 1: Maximum height of the tree below this certificate. I don't use sub-CAs, so I hope that 1 is the correct value.
# -cy authority: Certificate type is CA, not end-entity.
# -r: Create a self signed certificate.
# my_ca.cer: Name of the file to which the generated public key will be written.
Agora, você precisa criar o (s) certificado (s) para assinatura de e-mail. No seu caso, você começará com apenas um certificado para você:
makecert -pe -n "[email protected],CN=My eMail Signing" -a sha512 -sky exchange -cy end -ss my -eku 1.3.6.1.5.5.7.3.4 -in "My Root CA" -is root -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 -len 2048 my_email.cer
# -pe:Mark private key as exportable - useful for backup.
# -n "[email protected],CN=My eMail Signing": Name of the certificate. This must contain your mail address in the E entry and your name in the CN entry. You should give a useful CN, so please replace My with your full name.
# -a sha512: The signature algorithm to use. Right now SHA512 is the maximum available.
# -sky exchange: The key type (exchange, not signature).
# -cy end: Certificate type is end-entity, not CA.
# -ss my: The store where makecert shall place the certificate (My certificates store).
# -eku 1.3.6.1.5.5.7.3.4: Enhanced key usage "E-mail protection"
# -in "My Root CA": Name of the CA used to sign the generated key. Must be the same as given in "-n" in the above call to makecert.
# -is root: Store where the CA key can be found.
# -sp "Microsoft RSA SChannel Cryptographic Provider": Name of the CryptoAPI provider to use.
# -sy 12: Type of the CryptoAPI provider.
# -len 2048: Key length in bits. You might consider generating a longer key.
# my_email.cer: Name of the file to which the generated public key will be written.
As chaves privada e pública serão gravadas nos armazenamentos de certificados do usuário (no registro) e podem ser usadas imediatamente. As chaves públicas serão gravadas nos arquivos fornecidos.
No seu computador, você pode selecionar imediatamente o certificado de assinatura de e-mail no seu programa de e-mail. Para dar suas chaves públicas a outras pessoas, você pode fornecer uma cópia de suas chaves públicas. Para confiança total, eles podem precisar importar sua chave de CA em seu armazenamento de certificados.