RSA 개인 키와 자체 서명 인증서를 사용하여 p12 파일을 생성하는 방법은 무엇입니까?

RSA 개인 키와 자체 서명 인증서를 사용하여 p12 파일을 생성하는 방법은 무엇입니까?

나는 아래의 정확한 절차가 2주 전에는 효과가 있었다고 생각하지만 지금은 그렇지 않습니다. RSA 개인 키로 시작하여 rsa.pem자체 서명된 인증서를 생성합니다.

openssl req -new -x509 -key rsa.pem -out rsa.cer

그런 다음 파일을 만들려고 합니다 p12.

openssl pkcs12 -export -out rsa.p12 -inkey rsa.pem -in rsa.cer

하지만 다음 메시지만 나타납니다.

Usage: pkcs12 [options]
where options are
-export       output PKCS12 file
-chain        add certificate chain
-inkey file   private key if not infile
-certfile f   add all certs in f
-CApath arg   - PEM format directory of CA's
-CAfile arg   - PEM format file of CA's
-name "name"  use name as friendly name
-caname "nm"  use nm as CA friendly name (can be used more than once).
-in  infile   input filename
-out outfile  output filename
-noout        don't output anything, just verify.
-nomacver     don't verify MAC.
-nocerts      don't output certificates.
-clcerts      only output client certificates.
-cacerts      only output CA certificates.
-nokeys       don't output private keys.
-info         give info about PKCS#12 structure.
-des          encrypt private keys with DES
-des3         encrypt private keys with triple DES (default)
-seed         encrypt private keys with seed
-aes128, -aes192, -aes256
              encrypt PEM output with cbc aes
-camellia128, -camellia192, -camellia256
              encrypt PEM output with cbc camellia
-nodes        don't encrypt private keys
-noiter       don't use encryption iteration
-nomaciter    don't use MAC iteration
-maciter      use MAC iteration
-nomac        don't generate MAC
-twopass      separate MAC, encryption passwords
-descert      encrypt PKCS#12 certificates with triple DES (default RC2-40)
-certpbe alg  specify certificate PBE algorithm (default RC2-40)
-keypbe alg   specify private key PBE algorithm (default 3DES)
-macalg alg   digest algorithm used in MAC (default SHA1)
-keyex        set MS key exchange type
-keysig       set MS key signature type
-password p   set import/export password source
-passin p     input file pass phrase source
-passout p    output file pass phrase source
-engine e     use engine e, possibly a hardware device.
-rand file:file:...
              load the file (or the files in the directory) into
              the random number generator
-CSP name     Microsoft CSP name
-LMK          Add local machine keyset attribute to private key

나는 이전 게시물을 팔로우하고 있습니다.

https://stackoverflow.com/questions/38841563/create-rsacryptoserviceprovider-object-using-rsa-private-key-file-in-c-sharp

https://stackoverflow.com/questions/10994116/openssl-convert-pem-포함-only-rsa-private-key-to-pkcs12

답변1

웹 브라우저에서 복사한(직접 입력하지 않은) 올바른 것처럼 보이는 명령에 대해 구문 오류(또는 사용 지침)가 발생하는 경우 먼저 따옴표 및 하이픈과 같은 영숫자가 아닌 문자를 확인하세요.

요즘 브라우저는 이를 인간의 눈과 유사하게 보이지만 셸이나 프로그램을 혼동하는 유니코드 문자로 대체합니다.

관련 정보