OpenSSLćØćƒćƒƒćƒˆćƒÆćƒ¼ć‚Æć‚»ć‚­ćƒ„ćƒŖćƒ†ć‚£ć‚µćƒ¼ćƒ“ć‚¹ļ¼ˆNSSļ¼‰ćÆć€åŒć˜ć‚³ć‚¤ćƒ³ć®äø”é¢ć§ć™

ē”»åƒć‚æć‚¤ćƒˆćƒ«ćÆä½•ć®ćƒ”ćƒ€ćƒ«ć§ć™ć‹ļ¼Ÿē§ćŸć”ćÆč©±ć—ć¦ć„ć‚‹å…¬é–‹éµć‚¤ćƒ³ćƒ•ćƒ©ć‚¹ćƒˆćƒ©ć‚Æćƒćƒ£å…¬é–‹éµęš—å·č¦ę ¼ļ¼ˆå…¬é–‹éµęš—å·åŒ–ęØ™ęŗ–ć«åŸŗć„ć„ć¦- (PKI / IECå…¬é–‹éµåŸŗē›¤ļ¼‰ - PKCSć‚’ļ¼‰ć€‚ćƒ‘ćƒ–ćƒŖćƒƒć‚Æć‚­ćƒ¼ć‚¤ćƒ³ćƒ•ćƒ©ć‚¹ćƒˆćƒ©ć‚Æćƒćƒ£ć«ćÆć€ćć‚Œć‚‰ć‚’ę“ä½œć™ć‚‹ćŸć‚ć®ć•ć¾ć–ć¾ćŖć‚Ŗćƒ–ć‚øć‚§ć‚ÆćƒˆćØćƒ”ć‚«ćƒ‹ć‚ŗćƒ ć€ćŠć‚ˆć³ć‚Ŗćƒ–ć‚øć‚§ć‚Æćƒˆć®ē›øäŗ’ä½œē”Øć®ćŸć‚ć®ćƒ—ćƒ­ćƒˆć‚³ćƒ«ļ¼ˆTLS态OCSPćŖć©ļ¼‰ćŒå«ć¾ć‚Œć¦ć„ć¾ć™ć€‚ PKI / PKIć‚Ŗćƒ–ć‚øć‚§ć‚Æćƒˆć«ćÆć€x509čØ¼ę˜Žę›øćØć‚­ćƒ¼ćƒšć‚¢ļ¼ˆē§˜åÆ†éµćØå…¬é–‹éµļ¼‰ć€ē½²åćŠć‚ˆć³ęš—å·åŒ–ć•ć‚ŒćŸćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆļ¼ˆpkcs#7态CMSļ¼‰ć€ē§˜åÆ†éµć‚’ę ¼ē“ć™ć‚‹ćŸć‚ć®å®‰å…ØćŖć‚³ćƒ³ćƒ†ćƒŠćƒ¼ļ¼ˆpkcs#8ļ¼‰ć€ćŠć‚ˆć³éµä»˜ćć®ē§˜åÆ†čØ¼ę˜Žę›øļ¼ˆpkcs# 12ļ¼‰ćŖć©ć“ć®ćƒ”ć‚«ćƒ‹ć‚ŗćƒ ć«ćÆć€ć•ć¾ć–ć¾ćŖć‚¢ćƒ«ć‚“ćƒŖć‚ŗćƒ ć‚’ä½æē”Øć—ć¦ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆć‚’ęš—å·åŒ–ćŠć‚ˆć³ē½²åć§ćć‚‹ęš—å·åŒ–ę©Ÿčƒ½ć ć‘ć§ćŖćć€ęØ™ęŗ–ļ¼ˆčØ¼ę˜Žę›øć€č¦ę±‚ć€ē½²å/ęš—å·åŒ–ć•ć‚ŒćŸćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆć€ćƒ—ćƒ­ćƒˆć‚³ćƒ«ćƒ‘ćƒƒć‚±ćƒ¼ć‚øćŖć©ļ¼‰ć«å¾“ć£ć¦PKIć‚Øćƒ³ćƒ‰ć‚Ŗćƒ–ć‚øć‚§ć‚Æćƒˆć‚’å½¢ęˆć™ć‚‹ę©Ÿčƒ½ć‚‚å«ć¾ć‚Œć¾ć™ć€‚ .Pć€‚ļ¼‰ć€‚ćÆć„ć€ćć—ć¦äø­å¤®ć®PKI / PKIć‚Ŗćƒ–ć‚øć‚§ć‚Æćƒˆć‚’č¦šćˆć¦ć„ćŖć„ę–¹ę³•-čŖå®šć‚»ćƒ³ć‚æćƒ¼ļ¼ˆCA)。



ć‚¤ćƒ³ć‚æćƒ¼ćƒćƒƒćƒˆćƒ¦ćƒ¼ć‚¶ćƒ¼ćÆć€ēŸ„ć‚‰ćŖć„ć†ć”ć«ć€ć•ć¾ć–ć¾ćŖPKI / PKIćƒ”ć‚«ćƒ‹ć‚ŗćƒ ćØć‚Ŗćƒ–ć‚øć‚§ć‚Æćƒˆć‚’ä½æē”Øć—ć¾ć™ć€‚ćŸćØćˆć°ć€ć•ć¾ć–ć¾ćŖć‚µć‚¤ćƒˆć«ć‚¢ć‚Æć‚»ć‚¹ć™ć‚‹ćØćć€é›»å­ćƒ”ćƒ¼ćƒ«ć«ē½²åćŠć‚ˆć³/ć¾ćŸćÆęš—å·åŒ–ć™ć‚‹ćØćć€ć¾ćŸćÆćƒÆćƒ¼ć‚Æćƒ•ćƒ­ćƒ¼ć§é›»å­ē½²åć‚’ä½æē”Øć™ć‚‹ćØćć«ć€HTTPSćƒ—ćƒ­ćƒˆć‚³ćƒ«ć‚’ä½æē”Øć—ć¾ć™ć€‚

ćƒ‘ćƒ–ćƒŖćƒƒć‚Æć‚­ćƒ¼ć‚¤ćƒ³ćƒ•ćƒ©ć‚¹ćƒˆćƒ©ć‚Æćƒćƒ£ć‚’ä½œęˆć™ć‚‹ćŸć‚ć®ęœ€ć‚‚é«˜åŗ¦ćŖćƒ„ćƒ¼ćƒ«ć§ć‚ć‚‹PKI / PKIć‚½ćƒ•ćƒˆć‚¦ć‚§ć‚¢ćƒ„ćƒ¼ćƒ«ćÆć€OpenSSLćØćƒćƒƒćƒˆćƒÆćƒ¼ć‚Æć‚»ć‚­ćƒ„ćƒŖćƒ†ć‚£ć‚µćƒ¼ćƒ“ć‚¹ļ¼ˆNSS)です。

OpenSSLćÆć€ć»ć¼ć™ć¹ć¦ć®ä½Žćƒ¬ćƒ™ćƒ«ć®ćƒćƒƒć‚·ćƒ„ć€ęš—å·åŒ–ć€ćŠć‚ˆć³é›»å­ē½²åć‚¢ćƒ«ć‚“ćƒŖć‚ŗćƒ ć‚’ć‚µćƒćƒ¼ćƒˆć™ć‚‹ęœ¬ę ¼ēš„ćŖć‚Ŗćƒ¼ćƒ—ćƒ³ć‚½ćƒ¼ć‚¹ć®ęš—å·åŒ–ćƒ©ć‚¤ćƒ–ćƒ©ćƒŖćØćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć®ć‚»ćƒƒćƒˆć§ć‚ć‚Šć€RSA态DH态DSA态ECć‚­ćƒ¼ć®ä½œęˆć€ē™ŗč”ŒćŖć©ć€äø€čˆ¬ēš„ćŖęš—å·åŒ–ęØ™ęŗ–ć®ć»ćØć‚“ć©ć‚’å®Ÿč£…ć—ć¦ć„ć¾ć™ć€‚ X.509čØ¼ę˜Žę›øć€ćƒ‡ćƒ¼ć‚æć®ęš—å·åŒ–ćØē½²åć€SSL / TLSęŽ„ē¶šć®ä½œęˆć€‚

OpenSSLćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćŒę©Ÿčƒ½ć™ć‚‹ć‚Ŗćƒ–ć‚øć‚§ć‚ÆćƒˆćÆć€ćƒ•ć‚”ć‚¤ćƒ«ļ¼ˆčØ¼ę˜Žę›øć€ć‚­ćƒ¼ļ¼‰ć«ę ¼ē“ć•ć‚Œć¦ć„ć‚‹ć“ćØć«ę³Øę„ć—ć¦ćć ć•ć„ć€‚ćƒćƒƒćƒˆćƒÆćƒ¼ć‚Æć‚»ć‚­ćƒ„ćƒŖćƒ†ć‚£ć‚µćƒ¼ćƒ“ć‚¹ļ¼ˆNSS)は、



ęœ¬ę ¼ēš„ćŖć‚Ŗćƒ¼ćƒ—ćƒ³ć‚½ćƒ¼ć‚¹ć®ęš—å·åŒ–ćƒ©ć‚¤ćƒ–ćƒ©ćƒŖćØćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć®åŒć˜ć‚»ćƒƒćƒˆć§ć™ć€‚



OpenSSLとNSSの主な違いは、OpenSSLćÆčØ¼ę˜Žę›øćØć‚­ćƒ¼ćŒćƒ•ć‚”ć‚¤ćƒ«ć«ę ¼ē“ć•ć‚Œć¦ć„ć‚‹ćØęƒ³å®šć—ć¦ć„ć‚‹ć®ć«åÆ¾ć—ć€NSSはPKCS#11ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ćØćƒˆćƒ¼ć‚Æćƒ³ć‚’ä½æē”Øć—ć¦čØ¼ę˜Žę›øćØć‚­ćƒ¼ć‚’ę ¼ē“ć—ć¦ć„ć‚‹ć“ćØć§ć™ć€‚

ęœ€ć‚‚é‡č¦ćŖć“ćØćÆć€äø”ę–¹ć®ćƒ—ćƒ­ć‚øć‚§ć‚Æćƒˆļ¼ˆOpenSSLとNSSļ¼‰ćŒåŽ³åÆ†ć«ęØ™ęŗ–ć«ęŗ–ę‹ ć—ć¦ć„ć‚‹ćŸć‚ć€ē•°ćŖć‚‹ćƒ—ćƒ­ć‚øć‚§ć‚Æćƒˆć§äø€ē·’ć«ä½æē”Øć—ć¦ć‚‚å•é”ŒćŒćŖć„ć“ćØć§ć™ć€‚ćć‚Œć‚‰ć®é€£é‚¦ć®ćć®ć‚ˆć†ćŖč‰Æć„ä¾‹ćÆć€ćŸćØćˆć°ć€ć‚µć‚¤ćƒˆ/ćƒćƒ¼ć‚æćƒ«ćŒOpenSSLć«åŸŗć„ćmod_sslć‚’å‚™ćˆćŸApacheć«åŸŗć„ć„ć¦ę§‹ēÆ‰ć•ć‚Œć€ćć‚Œć‚‰ćøć®ć‚¢ć‚Æć‚»ć‚¹ćŒTLS 1.0 / TLS1.2ćŠć‚ˆć³TLS1.3ć‚’ć‚µćƒćƒ¼ćƒˆć™ć‚‹Firefoxć‚’ä»‹ć—ć¦å®Ÿč”Œć•ć‚Œć‚‹å “åˆć€HTTPSćƒ—ćƒ­ćƒˆć‚³ćƒ«ć®ä½æē”Øć«å½¹ē«‹ć”ć¾ć™ć€‚ NSSćƒ©ć‚¤ćƒ–ćƒ©ćƒŖć‚’ä½æē”Øć—ć¦å®Ÿč”Œć•ć‚Œć¾ć™ć€‚



OpenSSLćŠć‚ˆć³NSSćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć‚’ä½æē”Øć—ć¦åŒć˜å•é”Œć‚’č§£ę±ŗć™ć‚‹ę–¹ę³•ć‚’ä»„äø‹ć«ē¤ŗć—ć¾ć™ć€‚å°†ę„ēš„ć«ćÆć€čŖ°ć‚‚ćŒč‡Ŗåˆ†ć®å„½ćæć«åˆć‚ć›ć¦ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć‚’ä½æē”Øć§ćć‚‹ć‚ˆć†ć«ćŖć‚Šć¾ć™ć€‚

ć“ć®ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć¾ćŸćÆćć®ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć®ć‚½ćƒ¼ć‚¹ć‚³ćƒ¼ćƒ‰ć‚’č¦‹ć‚‹ćØć€čŖ°ć§ć‚‚ćƒ©ć‚¤ćƒ–ćƒ©ćƒŖé–¢ę•°ć«ē²¾é€šć™ć‚‹ć“ćØćŒć§ćć¾ć™ć€‚



ćƒ•ć‚”ć‚¤ćƒ«ć«äæå­˜ć•ć‚Œć¦ć„ć‚‹čØ¼ę˜Žę›øć‚„ćć®ä»–ć®ć‚Øćƒ³ćƒ†ć‚£ćƒ†ć‚£ć‚’č”Øē¤ŗć™ć‚‹



OpenSSLćƒ‘ćƒƒć‚±ćƒ¼ć‚øć«ćÆ1ć¤ć®ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćŒć‚ć‚Šć¾ć™-opensslć€ćć®ęœ€åˆć®ćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćÆć‚³ćƒžćƒ³ćƒ‰č‡Ŗä½“ļ¼ˆęØ™ęŗ–ć‚³ćƒžćƒ³ćƒ‰ļ¼‰ć§ć‚ć‚Šć€å®Ÿč”Œć™ć‚‹åæ…č¦ćŒć‚ć‚Šć¾ć™ć€‚



$ opensslćƒ˜ćƒ«ćƒ—
Standard commands
asn1parse         ca                ciphers           cms               
crl               crl2pkcs7         dgst              dhparam           
dsa               dsaparam          ec                ecparam           
enc               engine            errstr            exit              
gendsa            genpkey           genrsa            help              
list              nseq              ocsp              passwd            
pkcs12            pkcs7             pkcs8             pkey              
pkeyparam         pkeyutl           prime             rand              
rehash            req               rsa               rsautl            
s_client          s_server          s_time            sess_id           
smime             speed             spkac             srp               
ts                verify            version           x509              

Message Digest commands (see the `dgst' command for more details)
blake2b512        blake2s256        gost              md2               
md4               md5               rmd160            sha1              
sha224            sha256            sha384            sha512            

Cipher commands (see the `enc' command for more details)
aes-128-cbc       aes-128-ecb       aes-192-cbc       aes-192-ecb       
aes-256-cbc       aes-256-ecb       base64            bf                
bf-cbc            bf-cfb            bf-ecb            bf-ofb            
camellia-128-cbc  camellia-128-ecb  camellia-192-cbc  camellia-192-ecb  
camellia-256-cbc  camellia-256-ecb  cast              cast-cbc          
cast5-cbc         cast5-cfb         cast5-ecb         cast5-ofb         
des               des-cbc           des-cfb           des-ecb           
des-ede           des-ede-cbc       des-ede-cfb       des-ede-ofb       
des-ede3          des-ede3-cbc      des-ede3-cfb      des-ede3-ofb      
des-ofb           des3              desx              idea              
idea-cbc          idea-cfb          idea-ecb          idea-ofb          
rc2               rc2-40-cbc        rc2-64-cbc        rc2-cbc           
rc2-cfb           rc2-ecb           rc2-ofb           rc4               
rc4-40            rc5               rc5-cbc           rc5-cfb           
rc5-ecb           rc5-ofb           seed              seed-cbc          
seed-cfb          seed-ecb          seed-ofb          zlib              
$ 




ć”č¦§ć®ćØćŠć‚Šć€openssl helpć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć™ć‚‹ćØć€ć‚³ćƒžćƒ³ćƒ‰č‡Ŗä½“ć®ćƒŖć‚¹ćƒˆć«åŠ ćˆć¦ć€ć‚µćƒćƒ¼ćƒˆć•ć‚Œć¦ć„ć‚‹ćƒćƒƒć‚·ćƒ„ć‚¢ćƒ«ć‚“ćƒŖć‚ŗćƒ ćØęš—å·åŒ–ć‚¢ćƒ«ć‚“ćƒŖć‚ŗćƒ ć®ćƒŖć‚¹ćƒˆćŒč”Øē¤ŗć•ć‚Œć¾ć™ļ¼ˆćƒŖć‚¹ćƒˆć«ćÆåœ§ēø®é–¢ę•°ćØbase64é–¢ę•°ć‚‚å«ć¾ć‚Œć¦ć„ć¾ć™ļ¼‰ć€‚



čØ¼ę˜Žę›øļ¼ˆx509ļ¼‰ć€č¦ę±‚ļ¼ˆreqļ¼‰ć€ć¾ćŸćÆčØ¼ę˜Žę›øå¤±åŠ¹ćƒŖć‚¹ćƒˆļ¼ˆcrlļ¼‰ć‚’č”Øē¤ŗć™ć‚‹ć«ćÆć€ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć—ć¾ć™



怂opensslx509 [| req | crl] [-nameopt utf8] -inform PEM | DER -noout -in <ćƒ•ć‚”ć‚¤ćƒ«å> ..怂



ćŸćØćˆć°ć€ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć—ć¾ć™ć€‚



$openssl x509 -text -nameopt utf8 -inform PEM -noout -in cert.pem


PEM(base64ļ¼‰ļ¼ˆ-inform PEMļ¼‰ć§ć‚Øćƒ³ć‚³ćƒ¼ćƒ‰ć•ć‚Œć€utf-8ć‚Øćƒ³ć‚³ćƒ¼ćƒ‰ļ¼ˆ-nameoptļ¼‰ć§ę–‡å­—ć‚’å«ć‚€ćƒ•ć‚”ć‚¤ćƒ«cert.pem(-in cert.pemļ¼‰ć«ę ¼ē“ć•ć‚Œć¦ć„ć‚‹ęŠ€č”“å½¢å¼ļ¼ˆx509 -textļ¼‰ć§čØ¼ę˜Žę›øć®å†…å®¹ć‚’ć‚³ćƒ³ćƒ”ćƒ„ćƒ¼ć‚æćƒ¼ē”»é¢ć«č”Øē¤ŗć—ć¾ć™ć€‚ utf8ļ¼‰ć€‚ć“ć®å “åˆć€PEMć‚Øćƒ³ć‚³ćƒ¼ćƒ‡ć‚£ćƒ³ć‚°ć®čØ¼ę˜Žę›øč‡Ŗä½“ćÆē”»é¢ć«č”Øē¤ŗć•ć‚Œć¾ć›ć‚“ļ¼ˆ-noout)。



NSSćƒ‘ćƒƒć‚±ćƒ¼ć‚øć§ćÆć€ppćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćÆåŒć˜ć“ćØć‚’č”Œć„ć¾ć™ć€‚



ppćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćÆć€DERまたはPEMć‚Øćƒ³ć‚³ćƒ¼ćƒ‡ć‚£ćƒ³ć‚°ć§ASN.1ę§‹é€ ć‚’å«ć‚€ćƒ•ć‚”ć‚¤ćƒ«ć®PrettyPrintćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć§ć™ć€‚



Usage:  pp [-t type] [-a] [-i input] [-o output] [-w] [-u],  
ć‚æć‚¤ćƒ—ļ¼š

  • c-čØ¼ę˜Žę›ø;
  • cr-čØ¼ę˜Žę›øć®č¦ę±‚ć€‚
  • pk-公開鍵;
  • pk-å…¬é–‹éµćƒ•ć‚”ć‚¤ćƒ«ć€‚
  • crl-å–ć‚Šę¶ˆć•ć‚ŒćŸčØ¼ę˜Žę›øć®ćƒŖć‚¹ćƒˆć€‚


čØ¼ę˜Žę›øć«é©ē”Øć•ć‚Œć‚‹åˆ„ć®ć‚æć‚¤ćƒ—ć§ć‚ć‚‹ci(certificate-identityļ¼‰ć«ę³Øę„ć—ć¦ćć ć•ć„ć€‚ć“ć®ć‚æć‚¤ćƒ—ć§ćÆć€ć‚µćƒ–ć‚øć‚§ć‚Æćƒˆļ¼ˆę‰€ęœ‰č€…ļ¼‰ć€ē™ŗč”Œč€…ļ¼ˆē™ŗč”Œč€…ļ¼‰ć€ć‚·ćƒŖć‚¢ćƒ«ē•Ŗå·ļ¼ˆć‚·ćƒŖć‚¢ćƒ«ē•Ŗå·ļ¼‰ć€ęŒ‡ē“‹ļ¼ˆSHA-1ćŠć‚ˆć³SHA-256ęŒ‡ē“‹ļ¼‰ćŖć©ć®č­˜åˆ„ęƒ…å ±ć‚’čØ¼ę˜Žę›øć‹ć‚‰å–å¾—ć§ćć¾ć™ć€‚ x509恮opensslćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć«ć‚‚åŒę§˜ć®ćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćŒć‚ć‚Šć¾ć™ć€‚



ćƒ‡ćƒ•ć‚©ćƒ«ćƒˆć§ćÆć€ć™ć¹ć¦ć®ć‚Ŗćƒ–ć‚øć‚§ć‚ÆćƒˆćÆDERć‚Øćƒ³ć‚³ćƒ¼ćƒ‰ć•ć‚Œć¦ć„ć‚‹ćØč¦‹ćŖć•ć‚Œć¾ć™ć€‚ć‚Ŗćƒ–ć‚øć‚§ć‚ÆćƒˆćŒPEMć‚Øćƒ³ć‚³ćƒ¼ćƒ‡ć‚£ćƒ³ć‚°ć®å “åˆćÆć€ć€Œ-ać€ćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æć‚’ęŒ‡å®šć™ć‚‹åæ…č¦ćŒć‚ć‚Šć¾ć™ļ¼ˆopensslćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć®ć€Œ-informPEMć€ćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćØåŒę§˜ļ¼‰ć€‚ć¾ćŸć€ć‚Ŗćƒ–ć‚øć‚§ć‚Æćƒˆć«UTF-8ć‚Øćƒ³ć‚³ćƒ¼ćƒ‡ć‚£ćƒ³ć‚°ć®ę–‡å­—ćŒå«ć¾ć‚Œć¦ć„ć‚‹å “åˆćÆć€ć‚‚ć†1ć¤ć®ćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćƒ¼ć€Œ-uć€ćŒčØ­å®šć•ć‚Œć¾ć™ć€‚ opensslćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć«ć‚‚åŒę§˜ć®ćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æć€Œ-nameoptutf8ć€ćŒć‚ć‚‹ć“ćØć‚’ę€ć„å‡ŗć—ć¦ćć ć•ć„ć€‚



NSSćƒ‘ćƒƒć‚±ćƒ¼ć‚øć«ćÆć€ć‚Ŗćƒ–ć‚øć‚§ć‚Æćƒˆć®ASN.1ę§‹é€ ć‚’č”Øē¤ŗć™ć‚‹ćŸć‚ć®ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć‚‚å«ć¾ć‚Œć¦ć„ć¾ć™ć€‚ć“ć‚ŒćÆopensslćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£asn1.parseć®é”žä¼¼ē‰©ć§ć™ć€‚ć“ć‚ŒćÆderdumpćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć§ć™ļ¼š



$derdump -i < > [-o < >]


ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć®åå‰ć‹ć‚‰ć€DERć§ć‚Øćƒ³ć‚³ćƒ¼ćƒ‰ć•ć‚ŒćŸå½¢å¼ć®ćƒ•ć‚”ć‚¤ćƒ«ć§ę©Ÿčƒ½ć™ć‚‹ć“ćØćŒć‚ć‹ć‚Šć¾ć™ć€‚ć—ć‹ć—ć€ćć‚ŒćÆå¤§äøˆå¤«ć§ć™ć€‚ć“ć®ćƒ‘ćƒƒć‚±ćƒ¼ć‚øć«ćÆć€ćƒ•ć‚”ć‚¤ćƒ«ć‚’PEM / BASE64ć‚Øćƒ³ć‚³ćƒ¼ćƒ‡ć‚£ćƒ³ć‚°ć‹ć‚‰DERć‚Øćƒ³ć‚³ćƒ¼ćƒ‡ć‚£ćƒ³ć‚°ć«ć€ć¾ćŸćÆćć®é€†ć«å¤‰ę›ć™ć‚‹2ć¤ć®ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćŒå«ć¾ć‚Œć¦ć„ć¾ć™ć€‚ć“ć‚Œć‚‰ćÆatobćŠć‚ˆć³btoaćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć§ć™ć€‚



ćŸćØćˆć°ć€OpenSSLć§čØ¼ę˜Žę›øć‚’PEMå½¢å¼ć‹ć‚‰DERå½¢å¼ć«å¤‰ę›ć™ć‚‹ć«ćÆć€ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć—ć¾ć™ć€‚



$openssl x509 -inform der -in CERT.der -out CERT.pem 


NSSć§ćÆć€ę¬”ć®ć‚ˆć†ć«ćŖć‚Šć¾ć™ć€‚



$btoa -in CERT.der -out CERT.pem -w "CERTIFICATE"


怌-wć€ć‚Ŗćƒ—ć‚·ćƒ§ćƒ³ćÆć€å‡ŗåŠ›ćƒ•ć‚”ć‚¤ćƒ«ć®ęœ€åˆćØęœ€å¾Œć«å«ć‚ć‚‹ćƒ†ć‚­ć‚¹ćƒˆć‚’ęŒ‡å®šć—ć¾ć™ć€‚ć“ć®å “åˆć€ć€Œ-w CERTIFICATEć€ćÆć€PEM標準のOpenSSLćƒ˜ćƒƒćƒ€ćƒ¼ćØćƒˆćƒ¬ćƒ¼ćƒ©ćƒ¼ć«ćŖć‚Šć¾ć™ć€‚



-----BEGIN CERTIFICATE-----
<    BASE64>
-----END CERTIFICATE----- 


OpenSSLとNSSはどごらも、pkcs#12ć‚³ćƒ³ćƒ†ćƒŠć§å‹•ä½œć—ć¾ć™ć€‚ć¾ćŸć€ć©ć”ć‚‰ć‚‚pkcs12ć‚³ćƒ³ćƒ†ćƒŠć®ä½œęˆć ć‘ć§ćŖćć€ć‚³ćƒ³ćƒ†ćƒ³ćƒ„ć®č”Øē¤ŗć‚‚åÆčƒ½ć§ć™ć€‚ćŸć ć—ć€opensslćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć‚’ä½æē”Øć™ć‚‹å “åˆćÆć€ęœ€åˆć«ć‚³ćƒ³ćƒ†ćƒŠć‚’åˆ†č§£ć—ć€ć‚³ćƒ³ćƒ†ćƒŠć®čØ¼ę˜Žę›øć‚’å€‹åˆ„ć®ćƒ•ć‚”ć‚¤ćƒ«ć«äæå­˜ć™ć‚‹åæ…č¦ćŒć‚ć‚Šć¾ć™ć€‚ćć®å¾Œć€å®‰å…Øć«č”Øē¤ŗć§ćć¾ć™ć€‚NSSć§ćÆć€ć‚³ćƒ³ćƒ†ćƒŠć®å†…å®¹ć®č”Øē¤ŗć‚’1å›žć®ćƒ‘ć‚¹ć§å®Ÿč”Œć§ćć¾ć™ć€‚ć“ć‚Œć‚’č”Œć†ć«ćÆć€ę¬”ć®å½¢å¼ć®pk12utilćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć‚’ä½æē”Øć—ć¾ć™ć€‚



pk12util -l <   pkcs12> [-W <   pkcs12>] [-d <  NSS>] [-h <>]


ä¾‹ćˆć°ļ¼š



$ pk12util -l cert_RSA.p12 -W 01234567
Certificate(has private key):
    Data:
        Version: 3 (0x2)
        Serial Number: 3 (0x3)
        Signature Algorithm: PKCS #1 SHA-1 With RSA Encryption
        Issuer: "CN=CA-RSA"
        Validity:
            Not Before: Thu May 21 09:50:00 2020
            Not After : Fri May 21 16:17:00 2021
        Subject: "CN=soft.lissi.ru"
        Subject Public Key Info:
            Public Key Algorithm: PKCS #1 RSA Encryption
            RSA Public Key:
                Modulus:
                    a2:f3:e1:63:fd:4f:60:4e:a9:de:56:37:a6:be:54:f3:
                    3d:67:9a:68:9e:f1:47:69:e3:3a:10:b0:2e:88:0c:ef:
                    7c:7f:48:47:6b:c0:75:63:c7:13:23:88:9a:ff:9a:48:
                    30:6a:a0:52:53:6f:4e:e5:84:c0:a1:b0:50:a2:ab:3d:
                    f9:62:2c:d8:30:be:19:1b:c9:f4:b8:20:57:a1:8e:5e:
                    61:8c:a7:50:91:44:61:99:71:40:bb:dc:4c:b7:7c:67:
                    be:a0:71:26:9f:af:dd:69:63:84:7d:93:3f:92:1b:fb:
                    d1:78:d7:95:75:42:8e:14:a8:63:e2:7b:7d:ef:c8:74:
                    35:7c:39:44:82:ad:92:1f:98:0e:91:95:c8:d8:bd:41:
                    fc:44:7e:4d:f5:94:d1:cc:25:ea:df:69:d7:b1:d7:86:
                    ad:4d:03:f1:35:65:03:a6:84:f8:26:6e:9b:d3:c9:67:
                    d5:a5:a4:9e:c7:82:76:28:9f:90:14:f1:16:6a:29:5d:
                    f8:df:c6:6c:e4:21:0d:6f:c5:87:61:a0:65:e3:97:0f:
                    96:42:ad:7d:96:79:ef:1d:ab:6c:e3:a0:da:3a:65:d8:
                    39:69:f3:20:e2:b1:27:fe:cb:4c:8c:0c:f5:76:f2:65:
                    a0:c7:bb:08:b0:f5:50:c0:96:8a:30:e9:75:f7:56:65
                Exponent: 65537 (0x10001)
        Signed Extensions:
            Name: Certificate Basic Constraints
            Critical: True
            Data: Is not a CA.

            Name: Certificate Key Usage
            Usages: Digital Signature
                    Non-Repudiation
                    Key Encipherment

            Name: Certificate Subject Alt Name
            DNS name: "lissi.ru"

            Name: Certificate Type
            Data: <SSL Server>

            Name: Certificate Comment
            Comment: "xca certificate"

    Signature Algorithm: PKCS #1 SHA-1 With RSA Encryption
    Signature:
        12:8c:c3:7e:e9:18:5a:d7:ee:f8:10:8b:72:55:ba:ee:
        8b:85:6c:aa:e3:de:58:26:a2:da:15:c6:3b:15:d9:82:
        6d:02:33:16:cc:0c:84:9d:96:b0:67:d4:63:10:b5:42:
        a1:c3:de:cb:40:6f:9b:9b:eb:c1:98:b6:66:55:ae:88:
        56:14:02:5c:62:8c:bc:22:97:94:cf:53:da:2e:47:c1:
        c6:83:dc:39:6f:0b:b8:39:4e:66:89:a3:9d:51:c6:e3:
        bd:fc:9e:f3:7b:02:a4:77:bc:08:4e:89:e6:57:54:5c:
        c1:cc:83:93:9e:4e:f5:41:4e:b5:13:bc:64:29:a9:8d:
        ce:13:ae:48:6c:21:fc:da:2a:a2:87:67:f8:df:23:53:
        08:a3:11:93:69:91:84:40:4b:58:c1:f3:d0:78:dc:33:
        f6:a5:a6:6f:ed:39:a9:ec:f3:48:e8:06:09:4c:c3:9f:
        9c:0f:58:80:7f:f5:09:40:2a:f1:cf:42:d7:5b:57:62:
        99:e7:dc:a5:31:f3:9d:1f:5a:88:c2:30:1b:8c:ec:69:
        8b:87:dc:4c:08:9e:70:49:3d:5e:7b:8f:6f:98:50:8b:
        0d:b9:8f:c1:7e:9b:1f:c2:76:3a:ca:c5:e3:3d:ea:93:
        81:c0:3b:e2:b7:d1:5d:e4:fd:48:d6:1b:8f:96:e2:18
    Fingerprint (SHA-256):
        D3:38:99:C9:8B:A5:49:96:BC:26:7B:10:1E:2A:7C:4B:55:15:E5:94:47:C6:D0:49:44:2E:48:58:1B:CF:83:7E
    Fingerprint (SHA1):
        D5:26:80:B7:CE:40:5B:54:85:F6:B2:31:58:C3:3E:9D:A4:3D:C1:F3

    Friendly Name: soft.lissi.ru

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 1 (0x1)
        Signature Algorithm: PKCS #1 SHA-1 With RSA Encryption
        Issuer: "CN=CA-RSA"
        Validity:
            Not Before: Wed May 20 16:12:00 2020
            Not After : Tue May 21 16:12:00 2030
        Subject: "CN=CA-RSA"
        Subject Public Key Info:
            Public Key Algorithm: PKCS #1 RSA Encryption
            RSA Public Key:
                Modulus:
                    a3:ca:c1:3b:ac:17:1b:32:69:90:8c:70:3b:95:3e:78:
                    4c:90:55:27:2a:25:05:16:54:d3:88:69:b0:43:a0:20:
                    3d:ca:0d:a2:f9:a5:2f:8c:e1:69:b6:df:79:bd:25:7d:
                    aa:71:2b:f2:9f:82:f1:e7:49:cf:fa:3c:b6:6f:80:09:
                    b2:ee:d5:18:e3:3d:96:67:38:cb:9c:e8:e5:76:c4:a8:
                    0b:b9:ad:dd:42:25:c7:da:cf:d4:15:41:bf:b0:0e:4f:
                    d1:9c:b7:d0:b1:32:a0:c7:14:67:ba:a2:9a:e7:23:26:
                    d7:7e:32:d9:5d:15:47:9e:4b:b0:b1:8b:04:38:1e:c3:
                    b2:fc:17:fe:8e:d1:cb:de:de:fd:13:17:b3:0e:5b:58:
                    e1:37:c7:12:32:b6:94:82:77:b8:4c:87:99:c6:c3:7d:
                    51:ed:3c:41:73:31:aa:13:de:26:84:e7:f7:a9:34:e9:
                    b3:9e:7d:aa:91:65:79:a7:14:9d:fc:45:42:de:e6:43:
                    9d:67:96:94:66:38:0b:2e:32:0a:4d:c3:3d:14:b9:06:
                    6b:e0:92:e2:35:0c:8f:78:7f:2c:ad:ec:dc:67:66:0b:
                    8c:47:82:c5:0e:39:a5:35:75:b5:fb:7f:2d:07:97:ef:
                    15:d8:fc:d4:72:6a:da:32:86:9e:64:ea:4a:e3:37:5b
                Exponent: 65537 (0x10001)
        Signed Extensions:
            Name: Certificate Basic Constraints
            Critical: True
            Data: Is a CA with no maximum path length.

            Name: Certificate Key Usage
            Usages: Certificate Signing
                    CRL Signing

            Name: Certificate Type
            Data: <SSL CA,S/MIME CA,ObjectSigning CA>

            Name: Certificate Comment
            Comment: "xca certificate"

    Signature Algorithm: PKCS #1 SHA-1 With RSA Encryption
    Signature:
        24:90:ac:91:3f:13:f6:1a:d4:3c:1b:de:33:e1:4a:0c:
        d8:27:a0:00:d2:43:c8:1b:13:90:93:d3:d2:f0:fe:79:
        da:14:fd:34:2e:3a:f4:fc:c8:71:c9:4f:0d:65:c0:fd:
        40:04:92:ef:7e:72:35:09:4a:08:1e:ed:21:53:06:03:
        73:f9:13:e7:a3:9c:e2:17:9c:25:b2:a5:f9:dc:07:7d:
        32:9f:cd:82:85:6c:26:79:dd:ee:e7:31:4e:10:55:19:
        d6:ac:1e:70:39:01:d2:37:00:3b:41:de:a9:c2:bd:bf:
        b4:c1:f8:8d:bd:d4:6b:95:6d:53:f3:17:76:40:d4:05:
        a4:1e:69:e8:54:92:91:bf:89:b6:ba:45:c5:14:89:bb:
        f4:44:cf:91:ca:16:44:55:86:8f:b9:37:4e:9e:9e:04:
        cd:48:e7:57:ec:c8:e2:72:f3:df:34:49:0a:9b:3f:67:
        a4:01:dd:f3:a3:bb:ec:b5:b8:20:f5:7e:45:8e:ae:53:
        7e:b8:92:38:0a:b7:41:8e:81:15:ab:72:42:f7:37:4a:
        6d:d7:4f:aa:0a:99:ee:9b:49:16:54:03:42:d6:fe:c1:
        ee:63:71:28:b1:84:c2:e6:d4:7b:f6:10:4c:a0:7a:39:
        9d:03:30:ff:78:24:ce:5b:ac:fe:ac:6d:f6:61:77:a6
    Fingerprint (SHA-256):
        AA:1F:B9:29:D2:F9:CC:AB:3D:F7:8C:26:26:4B:51:A3:71:01:1A:94:F8:FE:47:1D:BD:E3:72:DD:63:17:FE:6C
    Fingerprint (SHA1):
        B3:7A:A1:65:01:E2:A0:09:F4:55:17:EC:40:88:5C:42:9A:45:F5:36

Key(shrouded):
    Friendly Name: soft.lissi.ru

    Encryption algorithm: PKCS #12 V2 PBE With SHA-1 And 3KEY Triple DES-CBC
        Parameters:
            Salt:
                08:0b:8d:be:fa:fc:a5:a3
            Iteration Count: 2048 (0x800)
$




ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćÆä¾æåˆ©ć§ć™ćŒć€č»Ÿč†ć«ćƒć‚ØćŒćŖć„ć‚ć‘ć§ćÆć‚ć‚Šć¾ć›ć‚“ć€‚č»Ÿč†ć®ćƒć‚ØćÆć€ćƒ­ć‚·ć‚¢ć®ę–‡å­—ć€ć¾ćŸćÆć‚€ć—ć‚UTF-8ć‚Øćƒ³ć‚³ćƒ¼ćƒ‡ć‚£ćƒ³ć‚°ćŒćƒ‰ćƒƒćƒˆļ¼ˆ.....ļ¼‰ćØć—ć¦č”Øē¤ŗć•ć‚Œć‚‹ć“ćØć§ć™ć€‚ć¾ćŸć€ppćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć«-ućƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćŒć‚ć‚‹å “åˆļ¼ˆutf-8ć‚Øćƒ³ć‚³ćƒ¼ćƒ‡ć‚£ćƒ³ć‚°ćŒå­˜åœØć™ć‚‹å “åˆļ¼‰ć€ć“ć“ć§ćć‚Œć‚’åæ˜ć‚Œć¦ć—ć¾ć„ć¾ć™ļ¼ˆcertutilćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć‚’ę¤œčØŽć™ć‚‹ćØćć«ć“ć‚Œć«å†ć³ē›“é¢ć—ć¾ć™ļ¼‰ć€‚ć“ć‚Œć‚’äæ®ę­£ć™ć‚‹ć®ćÆé›£ć—ćć‚ć‚Šć¾ć›ć‚“ć€‚pk12util.cćƒ•ć‚”ć‚¤ćƒ«ć«ć‚ć‚‹P12U_ListPKCS12File関数に1č”Œčæ½åŠ ć™ć‚‹ć ć‘ć§ååˆ†ć§ć™ć€‚

PRIntn
P12U_ListPKCS12File(char *in_file, PK11SlotInfo *slot,
                    secuPWData *slotPw, secuPWData *p12FilePw)
{
    SEC_PKCS12DecoderContext *p12dcx = NULL;
    SECItem uniPwitem = { 0 };
    SECStatus rv = SECFailure;
    const SEC_PKCS12DecoderItem *dip;
/*    UTF-8*/
    SECU_EnableUtf8Display(PR_TRUE);

.   .   .   .   .

}


ćć®å¾Œć€ćƒ­ć‚·ć‚¢čŖžć®ę–‡å­—ć«å•é”ŒćÆć‚ć‚Šć¾ć›ć‚“ć€‚
$ pk12util -l 1000.p12 -d "." -W 01234567

Certificate(has private key):

Data:

Version: 3 (0x2)

Serial Number: 4096 (0x1000)

Signature Algorithm: PKCS #1 SHA-256 With RSA Encryption

Issuer: «E=ca@test.ru,OGRN=1111111111111,INN=222222222222,CN=

,OU=

,O= ,STR

EET=Ā». , . 0",L=,ST=

,C=RU"

Validity:

Not Before: Tue Jul 07 08:40:14 2020

Not After: Fri Aug 06 08:40:14 2021

Subject: «E=test@rsa.ru,CN= »

Subject Public Key Info:

Public Key Algorithm: PKCS #1 RSA Encryption

RSA Public Key:

Modulus:

9a:9f:6c:60:94:f7:ec:f7:94:b3:51:01:e2:1a:c5:25:

28:bb:02:77:49:52:4d:99:8a:6e:26:12:55:8f:71:34:

04:da:39:24:f9:b4:6b:d0:0a:42:27:1b:b2:d7:9b:d9:

c3:76:b0:e0:1c:7c:21:ce:79:9f:d5:2b:17:63:cb:94:

5b:d9:b2:53:ff:b9:bf:4f:3d:cf:b7:8d:8a:37:ba:02:

8c:da:d2:0d:fd:46:5b:45:1d:95:64:07:6e:fa:88:0d:

a4:bd:b3:4a:ed:99:f1:fd:73:c5:b6:05:a0:e5:ee:6b:

c3:83:5b:d0:64:05:77:6a:18:d8:c8:28:a1:d0:06:41:

23:0d:bb:87:8a:77:14:fb:6c:5d:af:db:2b:0b:11:a3:

16:1b:2b:05:18:26:a9:b5:00:4a:40:da:b3:05:aa:2a:

67:c0:18:0d:03:f7:d2:b9:ba:7c:36:f9:95:2e:56:81:

a3:09:99:5e:20:10:95:38:10:c9:c1:6f:c3:6c:a6:1b:

78:51:c6:e4:4f:11:bc:c0:22:4b:ca:59:16:f2:45:95:

0d:fd:7b:46:cf:c7:ac:1c:3d:d7:26:fc:ad:80:3e:2c:

21:93:29:32:a6:79:e2:a8:c6:e9:5e:45:34:d3:38:57:

8f:cd:95:5e:91:09:84:34:21:d2:16:29:69:75:4d:a3

Exponent: 65537 (0x10001)

Signed Extensions:

Name: Certificate Basic Constraints

Critical: True

Data: Is not a CA.



Name: Certificate Key Usage

Usages: Digital Signature

Key Encipherment

Key Agreement



Name: Certificate Type

Data: <SSL Client,S/MIME>



Name: Extended Key Usage

TLS Web Client Authentication Certificate

E-Mail Protection Certificate



Name: Certificate Subject Key ID

Data:

26:a1:b3:98:1c:fe:62:ba:23:81:96:37:3f:08:bd:70:

d6:f2:b1:46



Name: Certificate Authority Key Identifier

Key ID:

0a:b6:f6:87:64:1d:8e:b3:63:08:29:9f:21:59:ad:47:

d8:ea:07:f4

Issuer:

Directory Name: «E=ca@test.ru,OGRN=1111111111111,INN=22222222

2222,CN= ,OU=

,O=

,STREET=Ā».

, . 0",L=,ST=

,C=RU"

Serial Number:

00:a2:9b:22:32:3e:a7:3d:d8



Name: Certificate Subject Alt Name

RFC822 Name: «test@rsa.ru»



Name: Certificate Issuer Alt Name

Error: Parsing extension: Certificate extension value is invalid.

Data: Sequence {

}



Signature Algorithm: PKCS #1 SHA-256 With RSA Encryption

Signature:

2f:75:7e:71:9e:15:5c:97:fe:a2:e1:2a:52:39:56:55:

e0:62:60:bc:5f:6d:c2:b6:ec:cd:8b:10:b3:b1:3f:e5:

d6:d1:5f:a5:fa:61:c1:ce:3e:db:6a:2f:b2:13:46:8d:

67:cf:18:09:61:97:01:45:bc:99:bb:0c:d6:0a:a3:03:

87:0a:8e:10:3a:d5:e3:94:6d:4a:24:fa:c3:40:0b:43:

c2:3b:00:56:06:c4:d2:fc:b2:7e:e9:00:e5:2f:4b:e2:

3a:91:49:ce:f8:c3:60:ec:01:74:d8:1a:3b:af:e6:f6:

91:db:c5:f1:d7:de:be:18:38:47:41:8a:e2:ef:80:91:

10:54:41:ae:55:22:6f:d7:8c:fa:46:b6:b6:2a:ee:6a:

0c:c9:03:18:af:4e:93:6c:61:f3:b4:78:0c:61:93:f1:

d8:1b:00:c3:e5:29:9a:08:0a:f8:31:67:88:3d:c3:88:

7a:60:c0:c4:52:94:25:56:e5:a3:df:7d:58:c5:df:9a:

c7:22:7e:2c:f6:fb:2c:bf:b7:7f:c5:ca:2b:0f:8c:20:

77:b9:1f:e0:62:5a:3d:d4:6f:12:ea:c8:51:67:a5:75:

ad:e9:ac:9e:4e:2e:2d:34:80:e7:d8:64:f6:8f:2f:33:

32:1f:8b:bc:9c:e8:77:4a:ee:7b:84:31:ec:28:e9:70

Fingerprint (SHA-256):

96:F4:A5:FA:6D:8A:F8:7E:A6:10:49:BD:43:34:C1:92:C6:7D:FF:63:41:8E:69:C0:AC:34:6B:CB:63:7B:56:31

Fingerprint (SHA1):

B6:91:9B:C6:7A:45:9C:92:FD:E7:C7:33:00:FA:91:DF:7D:5F:00:21



Friendly Name:



Certificate:

Data:

Version: 3 (0x2)

Serial Number:

00:a2:9b:22:32:3e:a7:3d:d8

Signature Algorithm: PKCS #1 SHA-256 With RSA Encryption

Issuer: «E=ca@test.ru,OGRN=1111111111111,INN=222222222222,CN=

,OU=

,O= ,STR

EET=Ā». , . 0",L=,ST=

,C=RU"

Validity:

Not Before: Tue Jul 07 08:08:11 2020

Not After: Fri Jul 05 08:08:11 2030

Subject: «E=ca@test.ru,OGRN=1111111111111,INN=222222222222,CN=

,OU=

,O= ,STR

EET=Ā». , . 0",L=,ST=

,C=RU"

Subject Public Key Info:

Public Key Algorithm: PKCS #1 RSA Encryption

RSA Public Key:

Modulus:

e7:08:ed:83:08:10:7b:48:56:37:8b:e2:4a:31:1a:7b:

0d:4e:d2:a2:67:d7:04:60:a0:09:db:06:64:21:01:4e:

0d:41:d8:61:15:c6:58:83:66:7e:6b:65:72:0d:2b:c3:

50:26:11:04:82:4b:1a:12:d0:dc:e1:13:1c:76:69:0f:

c2:59:e2:5d:60:6d:fe:8a:48:fa:8b:1e:05:07:34:6d:

8a:e3:76:23:42:9e:7b:64:0b:6a:fb:36:63:31:96:df:

ed:d3:e8:7c:6e:39:d4:7d:da:b8:f4:ec:53:57:60:f1:

d8:a4:3a:3f:3b:4a:63:6c:2a:55:90:21:15:23:4a:37:

21:31:a0:c4:bb:84:0d:96:18:3c:3b:ba:92:e3:e2:17:

56:e5:d9:8c:58:24:8a:a3:53:b6:4f:02:4d:30:a6:0f:

34:ad:20:cf:6f:03:ca:23:1e:d3:15:bc:80:09:d8:1e:

90:07:da:90:a9:34:9e:6e:ed:6b:10:b7:a1:a4:a9:b4:

04:ac:6a:40:d8:00:52:d6:6a:28:f2:8c:c6:84:81:8a:

cd:63:a6:53:82:d2:4e:11:ec:94:81:d7:9c:79:8a:30:

9c:40:75:4d:d9:88:0b:cc:a4:0c:5d:6d:23:a6:ac:56:

8c:49:d9:1f:2b:63:cb:50:fc:a3:e0:3e:35:4e:f4:03

Exponent: 65537 (0x10001)

Signed Extensions:

Name: Certificate Basic Constraints

Critical: True

Data: Is a CA with no maximum path length.



Name: Certificate Subject Key ID

Data:

0a:b6:f6:87:64:1d:8e:b3:63:08:29:9f:21:59:ad:47:

d8:ea:07:f4



Signature Algorithm: PKCS #1 SHA-256 With RSA Encryption

Signature:

17:7d:29:dc:4d:6e:4c:99:7a:bc:b2:2a:a5:80:f9:5f:

0c:60:00:2b:f3:f4:ef:19:d7:ed:56:07:5d:24:e1:b3:

f6:43:e2:05:9b:75:ce:cd:cf:27:1e:1c:cd:d8:cc:43:

77:16:04:7e:8a:dd:89:c4:b2:75:ae:f4:84:23:53:18:

fe:be:c5:1d:40:55:aa:91:9f:f5:96:06:5d:07:22:a8:

1c:b9:29:c4:49:2e:75:10:75:22:95:36:16:58:2f:77:

f5:fa:6d:de:c4:67:ca:f3:e1:98:51:b4:ba:b7:2a:7f:

06:db:33:5a:a6:bb:53:57:f4:18:93:16:9c:0e:43:d0:

46:e6:84:55:bb:ff:68:fe:fa:32:d5:23:2a:d5:65:9b:

d9:63:45:6b:53:71:64:dd:da:e1:40:fa:89:30:b1:73:

8b:f8:7c:3c:2f:72:24:ad:e8:5c:07:89:2f:3a:0d:37:

48:29:1f:0d:5f:9e:11:73:56:b8:d9:24:eb:2d:2e:18:

c7:9b:90:62:09:20:61:75:b9:a1:9a:3f:99:34:8e:06:

30:ce:7d:60:42:7d:e0:14:f2:88:f2:41:a0:46:4d:55:

17:d4:c2:15:64:c9:3e:f5:cc:0a:41:f7:c0:d0:94:96:

ea:64:e0:45:3a:e0:a3:d6:22:a9:d1:e3:c4:51:e8:96

Fingerprint (SHA-256):

F5:DF:15:79:5E:1E:41:84:96:8C:8C:CA:37:0C:A6:BB:C3:21:AE:3D:32:42:8C:63:C2:64:BA:0A:74:DC:37:F8

Fingerprint (SHA1):

CF:C6:B9:D4:3C:16:6F:31:91:2A:09:2F:FE:4C:57:89:0F:5A:F1:DB



Friendly Name:



Key(shrouded):

Friendly Name:



Encryption algorithm: PKCS #12 V2 PBE With SHA-1 And 3KEY Triple DES-CBC

Parameters:

Salt:

c4:fa:4a:6a:4f:54:a1:7a

Iteration Count: 2048 (0x800)

$



opensslćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć‚’ä½æē”Øć—ć¦PKCS#12ć‚³ćƒ³ćƒ†ćƒŠć‚’ä½œęˆć™ć‚‹ćØććÆć€CAFL63ć‚°ćƒ©ćƒ•ć‚£ć‚«ćƒ«ć‚·ć‚§ćƒ«ć‚’ä½æē”Øć—ć¾ć—ćŸć€‚







ä»Šć“ćć€NSSćƒŖćƒć‚øćƒˆćƒŖć«ć¤ć„ć¦čŖ¬ę˜Žć™ć‚‹ćØćć§ć™ć€‚



NSSć‚¹ćƒˆćƒ¬ćƒ¼ć‚ø



NSSćƒŖćƒć‚øćƒˆćƒŖćÆć€3ć¤ć®ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ćŒę ¼ē“ć•ć‚Œć¦ć„ć‚‹ćƒ‡ć‚£ćƒ¬ć‚ÆćƒˆćƒŖć§ć™ć€‚



ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ļ¼ˆDB)には、cert8.db /cert9.dbčØ¼ę˜Žę›øćŒę ¼ē“ć•ć‚Œć¾ć™ć€‚ key3.db / key4.dbćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć«ćÆć€ē§˜åÆ†éµćŒę ¼ē“ć•ć‚Œć¾ć™ć€‚ćć—ć¦ęœ€å¾Œć«ć€secmod.db / pkcs11.txtćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć«ćÆć€PKCS#11ć‚¤ćƒ³ć‚æćƒ¼ćƒ•ć‚§ć‚¤ć‚¹ć‚’ä½æē”Øć—ć¦ć‚µćƒ¼ćƒ‰ćƒ‘ćƒ¼ćƒ†ć‚£ć®ćƒˆćƒ¼ć‚Æćƒ³/ć‚¹ćƒžćƒ¼ćƒˆć‚«ćƒ¼ćƒ‰/ć‚Æćƒ©ć‚¦ćƒ‰ć‚’ę“ä½œć§ćć‚‹ć‚ˆć†ć«ć™ć‚‹ęƒ…å ±ļ¼ˆäø»ć«ćƒ©ć‚¤ćƒ–ćƒ©ćƒŖćøć®ćƒ‘ć‚¹ļ¼‰ćŒę ¼ē“ć•ć‚Œć¾ć™ć€‚



modutilćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćÆć€ę¬”ć®å½¢å¼ć§NSSćƒŖćƒć‚øćƒˆćƒŖć‚’ä½œęˆć™ć‚‹ć‚ˆć†ć«čØ­čØˆć•ć‚Œć¦ć„ć¾ć™ć€‚



modutil -create -force [-dbdir < NSS>] , 
< NSS> := [<  >:]<  NSS>
<  > := dbm|sql , :
$modutil -create -force -dbdir "sql:/~/TEST_NSS"


dbmćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć‚æć‚¤ćƒ—ćÆć€Berkeleyćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ļ¼ˆcert8.db态key3.dbć€ćŠć‚ˆć³secmod.dbļ¼‰ć®ä½œęˆć‚’å‰ęćØć—ć¦ć„ć¾ć™ć€‚sqlć‚æć‚¤ćƒ—ćÆć€SQLite3ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ļ¼ˆcert9.db态key9.dbć€ćŠć‚ˆć³ćƒ†ć‚­ć‚¹ćƒˆćƒ•ć‚”ć‚¤ćƒ«pkcs11.txtļ¼‰ć®ä½œęˆć‚’å‰ęćØć—ć¦ć„ć¾ć™ć€‚SQLite3ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ćÆćƒ‡ćƒ•ć‚©ćƒ«ćƒˆć§ä½œęˆć•ć‚Œć¾ć™ć€‚NSSćƒŖćƒć‚øćƒˆćƒŖćƒ‡ć‚£ćƒ¬ć‚ÆćƒˆćƒŖćÆäŗ‹å‰ć«ä½œęˆć™ć‚‹åæ…č¦ćŒć‚ć‚Šć¾ć™ć€‚ćƒ‡ćƒ•ć‚©ćƒ«ćƒˆć§ćÆļ¼ˆ-dbdirまたは-dćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćƒ¼ćŒęŒ‡å®šć•ć‚Œć¦ć„ćŖć„é™ć‚Šļ¼‰ć€ćƒ¦ćƒ¼ć‚¶ćƒ¼ć®ćƒ›ćƒ¼ćƒ ćƒ•ć‚©ćƒ«ćƒ€ćƒ¼ć«ć‚ć‚‹ć€Œ.netscapeć€ć‚¹ćƒˆć‚¢ćŒä½æē”Øć•ć‚Œć¾ć™ć€‚ć“ć®ć‚¹ćƒˆćƒ¬ćƒ¼ć‚øćÆć€ćŸćØćˆć°google-chromećƒ–ćƒ©ć‚¦ć‚¶ć«ć‚ˆć£ć¦ä½æē”Øć•ć‚Œć¾ć™ć€‚



å¤ć„å½¢å¼ļ¼ˆDBMļ¼‰ć®čØ¼ę˜Žę›øć‚¹ćƒˆć‚¢ļ¼ˆcert8.db态key3.db态secmod.dbļ¼‰ć‹ć‚‰ę–°ć—ć„å½¢å¼ļ¼ˆSQLite3ļ¼‰ļ¼ˆcert9.db态key4.db态pkcs11.txtļ¼‰ć§ć‚¹ćƒˆć‚¢ć‚’ä½œęˆć™ć‚‹ć“ćØć‚‚ē°”å˜ć§ć™ć€‚ć“ć‚Œć‚’č”Œć†ć«ćÆć€ć‚­ćƒ¼ļ¼ˆ-Kļ¼‰ć¾ćŸćÆ-Xćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćƒ¼ć‚’ęŒ‡å®šć—ćŸčØ¼ę˜Žę›øļ¼ˆ-Lļ¼‰ć‚’č”Øē¤ŗć™ć‚‹ćƒ¢ćƒ¼ćƒ‰ć§čØ¼ę˜Žę›øcertutilć‚’ę“ä½œć™ć‚‹ćŸć‚ć®ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć‚’å®Ÿč”Œć—ć¾ć™ć€‚ę¬”ć«ä¾‹ć‚’ē¤ŗć—ć¾ć™ć€‚



$certutil -K -X -d ~/TEST_NSS


または



$certutil -L -X -d ~/TEST_NSS


ć“ć®ć‚ˆć†ćŖćƒŖćƒć‚øćƒˆćƒŖćÆć€Firefox态Thunderbird态Seamonkey态GoogleChrome态LibreOfficeなど、NSSć§ę§‹ēÆ‰ć•ć‚ŒćŸć™ć¹ć¦ć®ćƒ—ćƒ­ć‚øć‚§ć‚Æćƒˆć§åˆ©ē”Øć§ćć‚‹ć“ćØć«ę³Øę„ć—ć¦ćć ć•ć„ć€‚



NSSć‚¹ćƒˆćƒ¬ćƒ¼ć‚øć‚’ä½œęˆć™ć‚‹ćØć€2ć¤ć®ēµ„ćæč¾¼ćæćƒˆćƒ¼ć‚Æćƒ³ć‚’å‚™ćˆćŸēµ„ćæč¾¼ćæć®ć€ŒNSSå†…éƒØPKCS#11ćƒ¢ć‚øćƒ„ćƒ¼ćƒ«ć€ćŒč‡Ŗå‹•ēš„ć«ä½æē”ØåÆčƒ½ć«ćŖć‚Šć¾ć™ć€‚



$modutil -list -dbdir ~/TEST_NSS
Listing of PKCS #11 Modules
-----------------------------------------------------------
  1. NSS Internal PKCS #11 Module
           uri: pkcs11:library-manufacturer=Mozilla%20Foundation;library-description=NSS%20Internal%20Crypto%20Services;library-version=3.52
         slots: 2 slots attached
        status: loaded

         slot: NSS Internal Cryptographic Services
        token: NSS Generic Crypto Services
          uri: pkcs11:token=NSS%20Generic%20Crypto%20Services;manufacturer=Mozilla%20Foundation;serial=0000000000000000;model=NSS%203

         slot: NSS User Private Key and Certificate Services
        token: NSS Certificate DB
          uri: pkcs11:token=NSS%20Certificate%20DB;manufacturer=Mozilla%20Foundation;serial=0000000000000000;model=NSS%203
-----------------------------------------------------------
$


怌NSSGenericCrypto Servicesć€ćƒˆćƒ¼ć‚Æćƒ³ćÆęš—å·åŒ–ę©Ÿčƒ½ćØćƒ”ć‚«ćƒ‹ć‚ŗćƒ ć‚’å®Ÿč£…ć—ć€ć€ŒNSS Certificate DBć€ćƒˆćƒ¼ć‚Æćƒ³ćÆć€čØ¼ę˜Žę›øćØć‚­ćƒ¼ć€ćŠć‚ˆć³ćć®ä»–ć®čæ½åŠ ęƒ…å ±ļ¼ˆćŸćØćˆć°ć€ćƒ«ćƒ¼ćƒˆčØ¼ę˜Žę›øć®äæ”é ¼ć«é–¢ć™ć‚‹ļ¼‰ć‚’ę ¼ē“ć™ć‚‹ć‚ˆć†ć«čØ­čØˆć•ć‚Œć¦ć„ć¾ć™ć€‚ć€ŒNSSčØ¼ę˜Žę›øDBć€ćƒˆćƒ¼ć‚Æćƒ³ļ¼ˆå†…éƒØNSSćƒˆćƒ¼ć‚Æćƒ³ļ¼‰ćÆć€cert8.db / cert9.dbćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć‚’ä½æē”Øć—ć¦čØ¼ę˜Žę›øć‚’ę ¼ē“ć—ć€ē§˜åÆ†éµć‚’key3.db /key4.dbćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć«ę ¼ē“ć—ć¾ć™ć€‚



ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć™ć‚‹ćØć€ćƒ‡ćƒ•ć‚©ćƒ«ćƒˆć§ć‚µćƒćƒ¼ćƒˆć•ć‚Œć¦ć„ć‚‹ęš—å·åŒ–ćƒ”ć‚«ćƒ‹ć‚ŗćƒ ćŖć©ć€NSSå†…éƒØPKCS#11ćƒ¢ć‚øćƒ„ćƒ¼ćƒ«ć®ēµ„ćæč¾¼ćæćƒˆćƒ¼ć‚Æćƒ³ć«é–¢ć™ć‚‹ęƒ…å ±ć‚’å–å¾—ć§ćć¾ć™ć€‚



$ modutil -list'NSSå†…éƒØPKCS#11ćƒ¢ć‚øćƒ„ćƒ¼ćƒ« '-dbdir怜 / TEST_NSS
— Name: NSS Internal PKCS #11 Module

Library file: **Internal ONLY module**

Manufacturer: Mozilla Foundation

Description: NSS Internal Crypto Services

PKCS #11 Version 3.0

Library Version: 3.52

Cipher Enable Flags: None

Default Mechanism Flags: RSA:ECC:DH:RC2:RC4:DES:AES:CAMELLIA:SEED:SHA1:SHA256:SHA512:MD5:MD2:SSL:TLS



Slot: NSS Internal Cryptographic Services

Slot Mechanism Flags: RSA:ECC:DH:RC2:RC4:DES:AES:CAMELLIA:SEED:SHA1:SHA256:SHA512:MD5:MD2:SSL:TLS

Manufacturer: Mozilla Foundation

Type: Software

Version Number: 3.52

Firmware Version: 1.0

Status: Enabled

Token Name: NSS Generic Crypto Services

Token Manufacturer: Mozilla Foundation

Token Model: NSS 3

Token Serial Number: 0000000000000000

Token Version: 4.0

Token Firmware Version: 0.0

Access: Write Protected

Login Type: Public (no login required)

User Pin: NOT Initialized



Slot: NSS User Private Key and Certificate Services

Slot Mechanism Flags: None

Manufacturer: Mozilla Foundation

Type: Software

Version Number: 3.52

Firmware Version: 1.0

Status: Enabled

Token Name: NSS Certificate DB

Token Manufacturer: Mozilla Foundation

Token Model: NSS 3

Token Serial Number: 0000000000000000

Token Version: 0.0

Token Firmware Version: 0.0

Access: NOT Write Protected

Login Type: Public (no login required)

User Pin: Initialized

— $



å¤–éƒØPKCS#11ćƒ‡ćƒć‚¤ć‚¹ć‚’ę“ä½œć™ć‚‹ćŸć‚ć®čæ½åŠ ćƒ¢ć‚øćƒ„ćƒ¼ćƒ«ć®ęŽ„ē¶šćÆć€åŒć˜modutilćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć‚’ä½æē”Øć—ć¦č”Œć‚ć‚Œć¾ć™ć€‚



$modutil -add < > -libfile <  > [-dbdir < NSS>]


ćŸćØćˆć°ć€ćƒ­ć‚·ć‚¢ć®ęš—å·åŒ–ć‚’ć‚µćƒćƒ¼ćƒˆć™ć‚‹RUTokenćƒˆćƒ¼ć‚Æćƒ³ć‚’ę“ä½œć™ć‚‹ć«ćÆć€ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć™ć‚‹ć ć‘ć§ć™ć€‚



$modutil -add "ruTokenECP" -libfile /usr/lib64/librtpkcs11ecp_2.0.so -dbdir $HOME/.netscape 


ē‰¹å®šć®NSSćƒŖćƒć‚øćƒˆćƒŖć‚’ć‚µćƒćƒ¼ćƒˆć™ć‚‹ćƒ¢ć‚øćƒ„ćƒ¼ćƒ«ć®ćƒŖć‚¹ćƒˆćØć€å„ćƒ¢ć‚øćƒ„ćƒ¼ćƒ«ć«é–¢ć™ć‚‹ęƒ…å ±ļ¼ˆćƒ©ć‚¤ćƒ–ćƒ©ćƒŖć€ć‚µćƒćƒ¼ćƒˆć•ć‚Œć¦ć„ć‚‹ć‚¹ćƒ­ćƒƒćƒˆć®ćƒŖć‚¹ćƒˆć€ćŠć‚ˆć³ćć‚Œć‚‰ć«ęŽ„ē¶šć•ć‚Œć¦ć„ć‚‹ćƒˆćƒ¼ć‚Æćƒ³ļ¼‰ć‚’å–å¾—ć™ć‚‹ć«ćÆć€ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć—ć¾ć™ć€‚



$modutil -list [-dbdir < NSS>]


ē‰¹å®šć®ćƒ¢ć‚øćƒ„ćƒ¼ćƒ«ć®ęŽ„ē¶šć•ć‚ŒćŸćƒˆćƒ¼ć‚Æćƒ³ć«é–¢ć™ć‚‹å®Œå…ØćŖęƒ…å ±ć‚’å–å¾—ć™ć‚‹ć«ćÆć€ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć™ć‚‹åæ…č¦ćŒć‚ć‚Šć¾ć™ć€‚



$modutil -list < > [-dbdir < NSS>]


ēµ„ćæč¾¼ćæļ¼ˆå†…éƒØļ¼‰NSSćƒˆćƒ¼ć‚Æćƒ³ć«é–¢ć™ć‚‹ęƒ…å ±ć‚’å—ć‘å–ć£ćŸćØćć«ć™ć§ć«ä½æē”Øć—ć¾ć—ćŸć€‚

ć¾ćŸć€ćƒ¢ć‚øćƒ„ćƒ¼ćƒ«ć‚’čæ½åŠ ć§ćć‚‹å “åˆćÆć€ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć‹ć‚‰ćƒ¢ć‚øćƒ„ćƒ¼ćƒ«ć‚’å‰Šé™¤ć™ć‚‹ć“ćØć‚‚ć§ćć¾ć™ć€‚



$modutil -delete < > [-dbdir < NSS>] 


å¤–éƒØćƒˆćƒ¼ć‚Æćƒ³ćøć®ć‚¢ć‚Æć‚»ć‚¹ćÆé€šåøøPINć§äæč­·ć•ć‚Œć¦ć„ć¾ć™ć€‚ćŸć ć—ć€ēµ„ćæč¾¼ćæć®NSSčØ¼ę˜Žę›øDBćƒˆćƒ¼ć‚Æćƒ³ćøć®ć‚¢ć‚Æć‚»ć‚¹ćÆć€ćƒ‡ćƒ•ć‚©ćƒ«ćƒˆć§ćÆćƒ‘ć‚¹ćƒÆćƒ¼ćƒ‰ć§äæč­·ć•ć‚Œć¦ć„ć¾ć›ć‚“ļ¼ˆPINć‚³ćƒ¼ćƒ‰ļ¼‰ć€‚ć—ć‹ć—ć€ćć‚Œć‚’ē¢ŗē«‹ć™ć‚‹ć“ćØćÆé›£ć—ćć‚ć‚Šć¾ć›ć‚“ć€ä¾‹ćˆć°ļ¼š



$modutil -dbdir $HOME/.netscape -changepw "NSS Certificate DB"  


åŒę§˜ć«ć€å¤–éƒØćƒˆćƒ¼ć‚Æćƒ³ć®PINć‚³ćƒ¼ćƒ‰ć‚’å¤‰ę›“ć§ćć¾ć™ć€‚



ä»Šć“ćć€ćƒˆćƒ¼ć‚Æćƒ³ć€ćć®ćƒ”ć‚«ćƒ‹ć‚ŗćƒ ć€ćŠć‚ˆć³ć‚Ŗćƒ–ć‚øć‚§ć‚Æćƒˆć®ę“ä½œć«ē§»ć‚‹ćØćć§ć™ć€‚



PKCS#11ćƒˆćƒ¼ć‚Æćƒ³ć‚Ŗćƒ–ć‚øć‚§ć‚Æćƒˆćøć®ć‚¢ć‚Æć‚»ć‚¹



certutilćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćÆć€PKCS#11ćƒˆćƒ¼ć‚Æćƒ³ć®ć‚Ŗćƒ–ć‚øć‚§ć‚Æćƒˆļ¼ˆć‚­ćƒ¼ć€čØ¼ę˜Žę›øļ¼‰ć«ć‚¢ć‚Æć‚»ć‚¹ć™ć‚‹ćŸć‚ć«ä½æē”Øć•ć‚Œć¾ć™ć€‚certutilćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćÆopensslćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćØåŒć˜ć‚ˆć†ć«ę©Ÿčƒ½ć™ć‚‹ć“ćØć«ę³Øę„ć—ć¦ćć ć•ć„ć€‚certutilćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć®ę©Ÿčƒ½ć‚’č”Øē¤ŗć™ć‚‹ć«ćÆć€ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć™ć‚‹ć ć‘ć§ć™ć€‚



$certutil -H


ć—ć‹ć—ć€ä»ŠćÆčØ¼ę˜Žę›øćØć‚­ćƒ¼ćøć®ć‚¢ć‚Æć‚»ć‚¹ć«ć®ćæé–¢åæƒćŒć‚ć‚Šć¾ć™ć€‚ PKCS#11ćƒˆćƒ¼ć‚Æćƒ³ć«äæå­˜ć™ć‚‹å “åˆć€é€šåøøć€äø”ę–¹ć«CKA_IDå±žę€§ćØCKA_LABELå±žę€§ćŒå‰²ć‚Šå½“ć¦ć‚‰ć‚Œć‚‹ć“ćØć‚’ę€ć„å‡ŗć—ć¦ćć ć•ć„ć€‚ē‰¹å®šć®ćƒˆćƒ¼ć‚Æćƒ³ć®čØ¼ę˜Žę›øć®ćƒŖć‚¹ćƒˆć‚’č”Øē¤ŗć™ć‚‹ć«ćÆć€ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć—ć¾ć™ć€‚



$certutil -L [-d < NSS>] [-h < >]


å®Ÿéš›ć®ćƒˆćƒ¼ć‚Æćƒ³ćƒ©ćƒ™ćƒ«ć¾ćŸćÆć‚­ćƒ¼ćƒÆćƒ¼ćƒ‰ć®1つ(allまたはinternalļ¼‰ć‚’ćƒˆćƒ¼ć‚Æćƒ³ćƒ©ćƒ™ćƒ«ćØć—ć¦ęŒ‡å®šć§ćć¾ć™ć€‚ęœ€åˆć®ć‚±ćƒ¼ć‚¹ļ¼ˆćƒˆćƒ¼ć‚Æćƒ³ćƒ©ćƒ™ćƒ«all)では、NSSć‚¹ćƒˆćƒ¬ćƒ¼ć‚øć«ęŽ„ē¶šć•ć‚Œć¦ć„ć‚‹ć™ć¹ć¦ć®ćƒˆćƒ¼ć‚Æćƒ³ćŒę¤œē“¢ć•ć‚Œć€2ē•Ŗē›®ć®ć‚±ćƒ¼ć‚¹ļ¼ˆå†…éƒØć¾ćŸćÆć€ŒNSSčØ¼ę˜Žę›øDBć€ļ¼‰ć§ćÆć€ć€ŒNSSčØ¼ę˜Žę›øDBć€ć‚¹ćƒˆćƒ¬ćƒ¼ć‚øć®å†…éƒØćƒˆćƒ¼ć‚Æćƒ³ćŒč”Øē¤ŗć•ć‚Œć¾ć™ć€‚



ćŸćØćˆć°ć€ć‚¢ć‚Æć‚»ć‚¹ćƒ¢ć‚øćƒ„ćƒ¼ćƒ«ćŒNSSćƒŖćƒć‚øćƒˆćƒŖć€Œ/ home / a513 / tmp / TEST_NSSć€ć«ē™»éŒ²ć•ć‚Œć¦ć„ć‚‹ć€ŒLS11SW2016ć€ćØć„ć†ćƒ©ćƒ™ćƒ«ć®ä»˜ć„ćŸćƒˆćƒ¼ć‚Æćƒ³ć®čØ¼ę˜Žę›øć®ćƒŖć‚¹ćƒˆć‚’å–å¾—ć™ć‚‹ć«ćÆć€ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć—ć¾ć™ć€‚



$ certutil -L -d /home/a513/tmp/TEST_NSS -h "LS11SW2016"
Enter Password or Pin for "LS11SW2016":
Certificate Nickname                                  Trust Attributes
                                                      SSL,S/MIME,JAR/XPI
LS11SW2016:TestCA_P11                                 u,u,u
LS11SW2016:clientnss from CryptoArmPKCS               u,u,u
LS11SW2016:                                   u,u,u
LS11SW2016:Thenderbird-60.3.0 from 32                 u,u,u
LS11SW2016:  from  12_512             u,u,u
LS11SW2016:Text4Key                                   u,u,u
LS11SW2016:KmailKleopatra  GnuPG-2001               u,u,u
LS11SW2016:setvernss from CryptoArmPKCS               u,u,u
LS11SW2016:   from  12_512                       u,u,u
LS11SW2016:Test 12 512                                u,u,u
LS11SW2016:Kleopatra  GnuPG-2001                    ,,   
$


ćƒˆćƒ¼ć‚Æćƒ³ć®čØ¼ę˜Žę›øć®ćƒŖć‚¹ćƒˆćÆ2ć¤ć®åˆ—ć«č”Øē¤ŗć•ć‚Œć¾ć™ć€‚ęœ€åˆć®åˆ—ć«ćÆčØ¼ę˜Žę›øć®ćƒ‹ćƒƒć‚Æćƒćƒ¼ćƒ ćŒē¤ŗć•ć‚Œć€2ē•Ŗē›®ć®åˆ—ć«ćÆćć®čØ¼ę˜Žę›øć®äæ”é ¼å±žę€§ćŒå«ć¾ć‚Œć¦ć„ć¾ć™ć€‚



ć•ć‚‰ć«ć€čØ¼ę˜Žę›øćŒé…ē½®ć•ć‚Œć¦ć„ć‚‹ćƒˆćƒ¼ć‚Æćƒ³ć«ē§˜åÆ†éµćŒć‚ć‚‹å “åˆć€ć“ć®åˆ—ć«ćÆå€¤ć€Œu态u态uć€ćŒå«ć¾ć‚Œć¾ć™ć€‚



å±žę€§ćŒčØ­å®šć•ć‚Œć¦ć„ćŖć„å “åˆć€åˆ—ć«ćÆå€¤ć€Œć€ć€ć€ćŒå«ć¾ć‚Œć¾ć™ć€‚



怌u态u态uć€ć®äæ”é ¼å±žę€§ć‚’ęŒć¤čØ¼ę˜Žę›øļ¼ˆē§˜åÆ†éµć‚’ęŒć£ć¦ć„ć‚‹ļ¼‰ćÆć€čŖčØ¼ć¾ćŸćÆé›»å­ē½²åć®ē”Ÿęˆć«ä½æē”Øć§ćć¾ć™ć€‚



ä»–ć®äæ”é ¼å±žę€§å€¤ćÆć€åŸ‹ć‚č¾¼ć¾ć‚ŒćŸć€ŒNSSčØ¼ę˜Žę›øDBć€ćƒˆćƒ¼ć‚Æćƒ³ć«ć‚ć‚‹čØ¼ę˜Žę›øć«čØ­å®šć§ćć¾ć™ć€‚ć—ć‹ć—ć€ćć‚Œć«ć¤ć„ć¦ćÆå¾Œć§č©³ć—ćčŖ¬ę˜Žć—ć¾ć™ć€‚



NSSć®čØ¼ę˜Žę›øć®ćƒ‹ćƒƒć‚Æćƒćƒ¼ćƒ ćÆä½•ć§ć™ć‹ļ¼Ÿ



<nickname> := [< >:]<CKA_LABEL>


å†…éƒØćƒˆćƒ¼ć‚Æćƒ³ļ¼ˆć€ŒNSSčØ¼ę˜Žę›øDBć€ļ¼‰ć®å “åˆć€ćƒ‹ćƒƒć‚Æćƒćƒ¼ćƒ ć®ćƒˆćƒ¼ć‚Æćƒ³ćƒ©ćƒ™ćƒ«ćŒę¬ č½ć—ć¦ć„ć‚‹åÆčƒ½ę€§ćŒć‚ć‚Šć¾ć™ć€‚



PKCS#11ćƒˆćƒ¼ć‚Æćƒ³ć®ćƒ”ć‚«ćƒ‹ć‚ŗćƒ ć‚’ę¤œčØŽć™ć‚‹ćØć€ć‚­ćƒ¼ć®ē”Ÿęˆć€čØ¼ę˜Žę›øćØć‚­ćƒ¼ć®ć‚¤ćƒ³ćƒćƒ¼ćƒˆć®ę“ä½œć ć‘ć§ćÆć€CKA_IDå±žę€§ćØCKA_LABELå±žę€§ć®å€¤ć‚’čØ­å®šć§ććŖć„ć“ćØćŒć‚ć‹ć‚Šć¾ć™ć€‚ć“ć‚ŒćÆć™ć¹ć¦ć‚¢ćƒ—ćƒŖć‚±ćƒ¼ć‚·ćƒ§ćƒ³ć‚½ćƒ•ćƒˆć‚¦ć‚§ć‚¢é–‹ē™ŗč€…ć«ē§»ć•ć‚Œć¾ć™ć€‚ćŸć ć—ć€NSSćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć‚’ä½æē”Øć—ć¦ćƒˆćƒ¼ć‚Æćƒ³ć‚’ę“ä½œć™ć‚‹ćØć€å•é”Œć‚’å¼•ćē¶™ćć“ćØćŒć‚ć‹ć‚Šć¾ć™ć€‚



ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’ä½æē”Øć—ć¦ć€ē§˜åÆ†éµć®ćƒŖć‚¹ćƒˆć‚’č”Øē¤ŗć—ć¾ć™ć€‚



$certutil -K [-d < NSS>] [-h < >]


ć“ć‚Œć«ć‚ˆć‚Šć€ć‚­ćƒ¼ć‚æć‚¤ćƒ—ć€ć‚­ćƒ¼CKA_IDćŠć‚ˆć³CKA_LABELćŒå‡ŗåŠ›ć•ć‚Œć¾ć™ć€‚



ć—ć‹ć—ć€čØ¼ę˜Žę›øć«ęˆ»ć‚Šć¾ć™ć€‚ćƒˆćƒ¼ć‚Æćƒ³ć®čØ¼ę˜Žę›øć‚’ćƒ†ć‚­ć‚¹ćƒˆå½¢å¼ć§č”Øē¤ŗć™ć‚‹ć«ćÆć€ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć™ć‚‹ć ć‘ć§ć™ć€‚



$certutil -L [-d < NSS>] -n <nickname >


ä¾‹ćˆć°ļ¼š



certutil -L -d '/ home / a513 / tmp / TEST_NSS' -n'NSSčØ¼ę˜Žę›øDBļ¼šćƒ†ć‚¹ćƒˆčØ¼ę˜Žę›ø '
$ certutil -L -d "/home/a513/tmp/TEST_NSS" -n «NSS Certificate DB: »

Certificate:

Data:

Version: 3 (0x2)

Serial Number: 4096 (0x1000)

Signature Algorithm: PKCS #1 SHA-256 With RSA Encryption

Issuer: «E=ca@test.ru,OGRN=1111111111111,INN=222222222222,CN=

,OU=

,O= ,STR

EET=Ā». , . 0",L=,ST=

,C=RU"

Validity:

Not Before: Tue Jul 07 08:40:14 2020

Not After: Fri Aug 06 08:40:14 2021

Subject: «E=test@rsa.ru,CN= »

Subject Public Key Info:

Public Key Algorithm: PKCS #1 RSA Encryption

RSA Public Key:

Modulus:

9a:9f:6c:60:94:f7:ec:f7:94:b3:51:01:e2:1a:c5:25:

28:bb:02:77:49:52:4d:99:8a:6e:26:12:55:8f:71:34:

04:da:39:24:f9:b4:6b:d0:0a:42:27:1b:b2:d7:9b:d9:

c3:76:b0:e0:1c:7c:21:ce:79:9f:d5:2b:17:63:cb:94:

5b:d9:b2:53:ff:b9:bf:4f:3d:cf:b7:8d:8a:37:ba:02:

8c:da:d2:0d:fd:46:5b:45:1d:95:64:07:6e:fa:88:0d:

a4:bd:b3:4a:ed:99:f1:fd:73:c5:b6:05:a0:e5:ee:6b:

c3:83:5b:d0:64:05:77:6a:18:d8:c8:28:a1:d0:06:41:

23:0d:bb:87:8a:77:14:fb:6c:5d:af:db:2b:0b:11:a3:

16:1b:2b:05:18:26:a9:b5:00:4a:40:da:b3:05:aa:2a:

67:c0:18:0d:03:f7:d2:b9:ba:7c:36:f9:95:2e:56:81:

a3:09:99:5e:20:10:95:38:10:c9:c1:6f:c3:6c:a6:1b:

78:51:c6:e4:4f:11:bc:c0:22:4b:ca:59:16:f2:45:95:

0d:fd:7b:46:cf:c7:ac:1c:3d:d7:26:fc:ad:80:3e:2c:

21:93:29:32:a6:79:e2:a8:c6:e9:5e:45:34:d3:38:57:

8f:cd:95:5e:91:09:84:34:21:d2:16:29:69:75:4d:a3

Exponent: 65537 (0x10001)

Signed Extensions:

Name: Certificate Basic Constraints

Critical: True

Data: Is not a CA.



Name: Certificate Key Usage

Usages: Digital Signature

Key Encipherment

Key Agreement



Name: Certificate Type

Data: <SSL Client,S/MIME>



Name: Extended Key Usage

TLS Web Client Authentication Certificate

E-Mail Protection Certificate



Name: Certificate Subject Key ID

Data:

26:a1:b3:98:1c:fe:62:ba:23:81:96:37:3f:08:bd:70:

d6:f2:b1:46



Name: Certificate Authority Key Identifier

Key ID:

0a:b6:f6:87:64:1d:8e:b3:63:08:29:9f:21:59:ad:47:

d8:ea:07:f4

Issuer:

Directory Name: «E=ca@test.ru,OGRN=1111111111111,INN=22222222

2222,CN= ,OU=

,O=

,STREET=Ā».

, . 0",L=,ST=

,C=RU"

Serial Number:

00:a2:9b:22:32:3e:a7:3d:d8



Name: Certificate Subject Alt Name

RFC822 Name: «test@rsa.ru»



Name: Certificate Issuer Alt Name

Error: Parsing extension: Certificate extension value is invalid.

Data: Sequence {

}



Signature Algorithm: PKCS #1 SHA-256 With RSA Encryption

Signature:

2f:75:7e:71:9e:15:5c:97:fe:a2:e1:2a:52:39:56:55:

e0:62:60:bc:5f:6d:c2:b6:ec:cd:8b:10:b3:b1:3f:e5:

d6:d1:5f:a5:fa:61:c1:ce:3e:db:6a:2f:b2:13:46:8d:

67:cf:18:09:61:97:01:45:bc:99:bb:0c:d6:0a:a3:03:

87:0a:8e:10:3a:d5:e3:94:6d:4a:24:fa:c3:40:0b:43:

c2:3b:00:56:06:c4:d2:fc:b2:7e:e9:00:e5:2f:4b:e2:

3a:91:49:ce:f8:c3:60:ec:01:74:d8:1a:3b:af:e6:f6:

91:db:c5:f1:d7:de:be:18:38:47:41:8a:e2:ef:80:91:

10:54:41:ae:55:22:6f:d7:8c:fa:46:b6:b6:2a:ee:6a:

0c:c9:03:18:af:4e:93:6c:61:f3:b4:78:0c:61:93:f1:

d8:1b:00:c3:e5:29:9a:08:0a:f8:31:67:88:3d:c3:88:

7a:60:c0:c4:52:94:25:56:e5:a3:df:7d:58:c5:df:9a:

c7:22:7e:2c:f6:fb:2c:bf:b7:7f:c5:ca:2b:0f:8c:20:

77:b9:1f:e0:62:5a:3d:d4:6f:12:ea:c8:51:67:a5:75:

ad:e9:ac:9e:4e:2e:2d:34:80:e7:d8:64:f6:8f:2f:33:

32:1f:8b:bc:9c:e8:77:4a:ee:7b:84:31:ec:28:e9:70

Fingerprint (SHA-256):

96:F4:A5:FA:6D:8A:F8:7E:A6:10:49:BD:43:34:C1:92:C6:7D:FF:63:41:8E:69:C0:AC:34:6B:CB:63:7B:56:31

Fingerprint (SHA1):

B6:91:9B:C6:7A:45:9C:92:FD:E7:C7:33:00:FA:91:DF:7D:5F:00:21



Mozilla-CA-Policy: false (attribute missing)

Certificate Trust Flags:

SSL Flags:

User

Email Flags:

User

Object Signing Flags:

User

$



åŒć˜ćƒˆćƒ¼ć‚Æćƒ³ć§č”Øē¤ŗć•ć‚ŒćŸčØ¼ę˜Žę›øć«ē§˜åÆ†éµćŒć‚ć‚‹å “åˆć€čØ¼ę˜Žę›øć®äæ”é ¼ćƒ•ćƒ©ć‚°ćÆćƒ¦ćƒ¼ć‚¶ćƒ¼ć«ćŖć‚Šć¾ć™ć€‚



čØ¼ę˜Žę›øć®äæ”é ¼ćƒ•ćƒ©ć‚°ļ¼š

SSLćƒ•ćƒ©ć‚°ļ¼š

ćƒ¦ćƒ¼ć‚¶ćƒ¼

é›»å­ćƒ”ćƒ¼ćƒ«ćƒ•ćƒ©ć‚°ļ¼š

ćƒ¦ćƒ¼ć‚¶ćƒ¼

ć‚Ŗćƒ–ć‚øć‚§ć‚Æćƒˆē½²åćƒ•ćƒ©ć‚°ļ¼š

ćƒ¦ćƒ¼ć‚¶ćƒ¼


ćƒˆćƒ¼ć‚Æćƒ³ć‹ć‚‰ęØ™ęŗ–å‡ŗåŠ›ć«čØ¼ę˜Žę›øć‚’ć‚Øć‚Æć‚¹ćƒćƒ¼ćƒˆć™ć‚‹ć«ćÆć€ć€Œ-ać€ć¾ćŸćÆć€Œ-rć€ćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćƒ¼ć‚’čæ½åŠ ć™ć‚‹ć ć‘ć§ć™ć€‚ć€Œ-ać€ć‚Ŗćƒ—ć‚·ćƒ§ćƒ³ćÆć€čØ¼ę˜Žę›øć‚’PEMå½¢å¼ć§å‡ŗåŠ›ć™ć‚‹ć‚ˆć†ć«ęŒ‡ē¤ŗć—ć¾ć™ć€‚



$ certutil -L -d '/ home / a513 / tmp / TEST_NSS' -n'NSSčØ¼ę˜Žę›øDBļ¼šćƒ†ć‚¹ćƒˆčØ¼ę˜Žę›ø '-a
-----BEGIN CERTIFICATE-----

MIIGiTCCBXGgAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwggF2MQswCQYDVQQGEwJS

VTEsMCoGA1UECAwj0JzQvtGB0LrQvtCy0YHQutCw0Y8g0L7QsdC70LDRgdGC0Ywx

GzAZBgNVBAcMEtCl0LDQsdGA0LDQs9GA0LDQtDEqMCgGA1UECQwh0YPQuy4g0KXQ

sNCy0YDQvtCy0YHQutCw0Y8sINC0LiAwMTAwLgYDVQQKDCfQo9C00L7RgdGC0L7Q

stC10YDRj9GO0YjQuNC5INCm0LXQvdGC0YAxOzA5BgNVBAsMMtCe0YLQtNC10Lsg

0KPQtNC+0YHRgtC+0LLQtdGA0Y/RjtGI0LjQuSDQptC10L3RgtGAMTAwLgYDVQQD

DCfQo9C00L7RgdGC0L7QstC10YDRj9GO0YjQuNC5INCm0LXQvdGC0YAxGjAYBggq

hQMDgQMBARIMMjIyMjIyMjIyMjIyMRgwFgYFKoUDZAESDTExMTExMTExMTExMTEx

GTAXBgkqhkiG9w0BCQEWCmNhQHRlc3QucnUwHhcNMjAwNzA3MDg0MDE0WhcNMjEw

ODA2MDg0MDE0WjBMMS4wLAYDVQQDDCXQotC10YHRgtC+0LLRi9C5INGB0LXRgNGC

0LjRhNC40LrQsNGCMRowGAYJKoZIhvcNAQkBFgt0ZXN0QHJzYS5ydTCCASIwDQYJ

KoZIhvcNAQEBBQADggEPADCCAQoCggEBAJqfbGCU9+z3lLNRAeIaxSUouwJ3SVJN

mYpuJhJVj3E0BNo5JPm0a9AKQicbsteb2cN2sOAcfCHOeZ/VKxdjy5Rb2bJT/7m/

Tz3Pt42KN7oCjNrSDf1GW0UdlWQHbvqIDaS9s0rtmfH9c8W2BaDl7mvDg1vQZAV3

ahjYyCih0AZBIw27h4p3FPtsXa/bKwsRoxYbKwUYJqm1AEpA2rMFqipnwBgNA/fS

ubp8NvmVLlaBowmZXiAQlTgQycFvw2ymG3hRxuRPEbzAIkvKWRbyRZUN/XtGz8es

HD3XJvytgD4sIZMpMqZ54qjG6V5FNNM4V4/NlV6RCYQ0IdIWKWl1TaMCAwEAAaOC

AkcwggJDMAwGA1UdEwEB/wQCMAAwCwYDVR0PBAQDAgOoMBEGCWCGSAGG+EIBAQQE

AwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwQwHQYDVR0OBBYEFCah

s5gc/mK6I4GWNz8IvXDW8rFGMIIBsAYDVR0jBIIBpzCCAaOAFAq29odkHY6zYwgp

nyFZrUfY6gf0oYIBfqSCAXowggF2MQswCQYDVQQGEwJSVTEsMCoGA1UECAwj0JzQ

vtGB0LrQvtCy0YHQutCw0Y8g0L7QsdC70LDRgdGC0YwxGzAZBgNVBAcMEtCl0LDQ

sdGA0LDQs9GA0LDQtDEqMCgGA1UECQwh0YPQuy4g0KXQsNCy0YDQvtCy0YHQutCw

0Y8sINC0LiAwMTAwLgYDVQQKDCfQo9C00L7RgdGC0L7QstC10YDRj9GO0YjQuNC5

INCm0LXQvdGC0YAxOzA5BgNVBAsMMtCe0YLQtNC10Lsg0KPQtNC+0YHRgtC+0LLQ

tdGA0Y/RjtGI0LjQuSDQptC10L3RgtGAMTAwLgYDVQQDDCfQo9C00L7RgdGC0L7Q

stC10YDRj9GO0YjQuNC5INCm0LXQvdGC0YAxGjAYBggqhQMDgQMBARIMMjIyMjIy

MjIyMjIyMRgwFgYFKoUDZAESDTExMTExMTExMTExMTExGTAXBgkqhkiG9w0BCQEW

CmNhQHRlc3QucnWCCQCimyIyPqc92DAWBgNVHREEDzANgQt0ZXN0QHJzYS5ydTAJ

BgNVHRIEAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQAvdX5xnhVcl/6i4SpSOVZV4GJg

vF9twrbszYsQs7E/5dbRX6X6YcHOPttqL7ITRo1nzxgJYZcBRbyZuwzWCqMDhwqO

EDrV45RtSiT6w0ALQ8I7AFYGxNL8sn7pAOUvS+I6kUnO+MNg7AF02Bo7r+b2kdvF

8dfevhg4R0GK4u+AkRBUQa5VIm/XjPpGtrYq7moMyQMYr06TbGHztHgMYZPx2BsA

w+UpmggK+DFniD3DiHpgwMRSlCVW5aPffVjF35rHIn4s9vssv7d/xcorD4wgd7kf

4GJaPdRvEurIUWelda3prJ5OLi00gOfYZPaPLzMyH4u8nOh3Su57hDHsKOlw

-----END CERTIFICATE-----



DERå‡ŗåŠ›ć«ćÆć€ć€Œ-rć€ćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćƒ¼ć‚’ä½æē”Øć—ć¾ć™ć€‚



ćƒˆćƒ¼ć‚Æćƒ³ć®čØ¼ę˜Žę›øć‚’ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ć™ć‚‹



OpenSSLć‚’ä½æē”Øć—ć¦ē”Ÿęˆć—ćŸå€‹äŗŗčØ¼ę˜Žę›øćØē§˜åÆ†éµć‚’å‚™ćˆćŸPKCS#12ć‚³ćƒ³ćƒ†ćƒŠćŒć‚ć‚‹ćØć—ć¾ć™ć€‚å€‹äŗŗčØ¼ę˜Žę›øć‚’NSSć‚¹ćƒˆć‚¢ć«ć‚Øć‚Æć‚¹ćƒćƒ¼ćƒˆć™ć‚‹ć«ćÆć€ę¬”ć®pk12utilć‚³ćƒžćƒ³ćƒ‰ć‚’ä½æē”Øć—ć¾ć™ć€‚



$pk12util -i < pkcs12> [-d < NSS>] [-h < >]


ē‰¹å®šć®ćƒˆćƒ¼ć‚Æćƒ³ć®čØ¼ę˜Žę›øć‚’ć‚¤ćƒ³ćƒćƒ¼ćƒˆć™ć‚‹å “åˆćÆć€ćć®ćƒ©ćƒ™ćƒ«ć‚’čØ­å®šć™ć‚‹åæ…č¦ćŒć‚ć‚Šć¾ć™ć€‚ć‚‚ć†1ć¤ć®ę©Ÿčƒ½ć«ę³Øę„ć—ć¾ć—ć‚‡ć†ć€‚ć‚³ćƒ³ćƒ†ćƒŠć«ćƒ«ćƒ¼ćƒˆčØ¼ę˜Žę›øćŒå«ć¾ć‚Œć¦ć„ć‚‹å “åˆć€ćć‚Œć‚‰ćÆå†…éƒØćƒˆćƒ¼ć‚Æćƒ³ć€ŒNSSčØ¼ę˜Žę›øDBć€ć«äæå­˜ć•ć‚Œć¾ć™ć€‚ć“ć‚ŒćÆćƒ‡ćƒ•ć‚©ćƒ«ćƒˆć§ćÆäæ”é ¼å±žę€§ć‚’čØ­å®šć—ć¾ć›ć‚“ć€‚ä½•ć‚‰ć‹ć®ē†ē”±ć§ć€ē™»éŒ²ę©Ÿé–¢ć®ē‰¹å®šć®čØ¼ę˜Žę›øļ¼ˆćƒ«ćƒ¼ćƒˆčØ¼ę˜Žę›øļ¼‰ć¾ćŸćÆSSLčØ¼ę˜Žę›øć«äæ”é ¼å±žę€§ć‚’čØ­å®šć™ć‚‹åæ…č¦ćŒć‚ć‚‹å “åˆćÆć€ę¬”ć®å½¢å¼ć®certutilćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćŒä½æē”Øć•ć‚Œć¾ć™ć€‚



$certutil -M -n <nickname-> -t < > [-d < NSS>]


čØ¼ę˜Žę›øć”ćØć«ć€SSL态S / MIMEć€å„äæ”é ¼čØ­å®šć®ć‚³ćƒ¼ćƒ‰ē½²åć®é †åŗć§č”Øć•ć‚Œć‚‹3ć¤ć®åˆ©ē”ØåÆčƒ½ćŖäæ”é ¼ć‚«ćƒ†ć‚“ćƒŖćŒć‚ć‚Šć¾ć™ć€‚



< > := x,y,z , 


  • x-SSLć®å±žę€§ć€
  • y-S / MIMEć®å±žę€§ć€
  • z-ć‚³ćƒ¼ćƒ‰ē½²åć®å±žę€§ć€‚


x态y态zć®å„ä½ē½®ćÆć€ē©ŗć«ć™ć‚‹ć‹ļ¼ˆć€ć€ę˜Žē¤ŗēš„ćŖäæ”é ¼ć‚’ä½æē”Øć—ćŖć„ļ¼‰ć€1ć¤ä»„äøŠć®å±žę€§ć‚’å«ć‚ć‚‹ć“ćØćŒć§ćć¾ć™ć€‚



  • p-ęœ‰åŠ¹ćŖćƒ”ć‚¢ć€‚
  • P-äæ”é ¼ć§ćć‚‹ćƒŽćƒ¼ćƒ‰ļ¼ˆpć‚’ę„å‘³ć—ć¾ć™ļ¼‰
  • c-ē™»éŒ²ę©Ÿé–¢ć®ęœ‰åŠ¹ćŖčØ¼ę˜Žę›øļ¼ˆęœ‰åŠ¹ćŖCA)
  • T-ć‚Æćƒ©ć‚¤ć‚¢ćƒ³ćƒˆčØ¼ę˜Žę›øć‚’ē™ŗč”Œć™ć‚‹ćŸć‚ć®äæ”é ¼ć§ćć‚‹CA(cć‚‚ęš—ē¤ŗć•ć‚Œć¾ć™ļ¼‰
  • C-ć‚µćƒ¼ćƒćƒ¼čØ¼ę˜Žę›øć‚’ē™ŗč”Œć™ć‚‹ćŸć‚ć®äæ”é ¼ć§ćć‚‹CA(SSLć®ćæļ¼‰ļ¼ˆęš—é»™ć®c)


ć™ć¹ć¦ć®å¤–éƒØćƒˆćƒ¼ć‚Æćƒ³ćŒē§˜åÆ†éµć‚’ćƒˆćƒ¼ć‚Æćƒ³ć«ć‚¤ćƒ³ćƒćƒ¼ćƒˆć™ć‚‹ę“ä½œć‚’čØ±åÆć™ć‚‹ć‚ć‘ć§ćÆćŖć„ ć“ćØć«ę³Øę„ć—ć¦ćć ć•ć„ć€‚



ćƒ•ć‚”ć‚¤ćƒ«ć‹ć‚‰å˜ē“”ćŖčØ¼ę˜Žę›øć‚’ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ć™ć‚‹ć«ćÆć€ę¬”ć®å½¢å¼ć®certutilćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć‚’ä½æē”Øć—ć¾ć™ć€‚



$certutil -A -n < > -t < > [-d < NSS>] [-h < >] [-a] [-i <  >]


ę®‹åæµćŖćŒć‚‰ć€ć“ć®ć‚³ćƒ³ćƒ†ć‚­ć‚¹ćƒˆć§ćÆć€<certificatelabel>ćÆäøŠčØ˜ć®čØ¼ę˜Žę›øć®ćƒ‹ćƒƒć‚Æćƒćƒ¼ćƒ ćØåŒē­‰ć§ćÆć‚ć‚Šć¾ć›ć‚“ć€‚ć“ć“ć§ć€čØ¼ę˜Žę›øćƒ©ćƒ™ćƒ«ćÆCKA_LABELć®ćæć«äø€č‡“ć—ć€ćƒˆćƒ¼ć‚Æćƒ³ćƒ©ćƒ™ćƒ«ć‚’ęŒ‡å®šć›ćšć«ćƒ©ćƒ™ćƒ«ć®ćæć«äø€č‡“ć—ć¾ć™ć€‚ć‚ć‚‹ēØ®ć®ēŸ›ē›¾ć€‚



ćƒ‡ćƒ•ć‚©ćƒ«ćƒˆć§ćÆć€čØ¼ę˜Žę›øćÆDERć§ć‚Øćƒ³ć‚³ćƒ¼ćƒ‰ć•ć‚ŒćŸćƒ•ć‚”ć‚¤ćƒ«ć«ć‚ć‚‹ćØč¦‹ćŖć•ć‚Œć¾ć™ć€‚čØ¼ę˜Žę›øćŒPEMć§ć‚Øćƒ³ć‚³ćƒ¼ćƒ‰ć•ć‚Œć¦ć„ć‚‹å “åˆćÆć€ć€Œ-ać€ćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćƒ¼ć‚’ęŒ‡å®šć™ć‚‹åæ…č¦ćŒć‚ć‚Šć¾ć™ć€‚ 怌-ić€ćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćƒ¼ćŒęŒ‡å®šć•ć‚Œć¦ć„ćŖć„å “åˆć€čØ¼ę˜Žę›øćÆęØ™ęŗ–å…„åŠ›ļ¼ˆstdinļ¼‰ć‹ć‚‰å–å¾—ć•ć‚Œć¾ć™ć€‚ćƒ‡ćƒ•ć‚©ćƒ«ćƒˆć§ćÆć€čØ¼ę˜Žę›øćÆć€ŒNSS Certificate DBć€ćƒˆćƒ¼ć‚Æćƒ³ć«ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ć•ć‚Œć¾ć™ćŒć€čØ¼ę˜Žę›øć‚’å¤–éƒØćƒˆćƒ¼ć‚Æćƒ³ļ¼ˆć€Œ-hć€ćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćƒ¼ļ¼‰ć«ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ć™ć‚‹ć“ćØć‚‚ć§ćć¾ć™ć€‚å¤–éƒØćƒˆćƒ¼ć‚Æćƒ³ć«čØ¼ę˜Žę›øć‚’ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ć™ć‚‹å “åˆć€čØ¼ę˜Žę›øćÆå†…éƒØćƒˆćƒ¼ć‚Æćƒ³ļ¼ˆć€ŒNSSčØ¼ę˜Žę›øDBć€ļ¼‰ćØå¤–éƒØćƒˆćƒ¼ć‚Æćƒ³ć®äø”ę–¹ć«ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ć•ć‚Œć¾ć™ć€‚ć“ć®å “åˆć€å¤–éƒØćƒˆćƒ¼ć‚Æćƒ³ć®äæ”é ¼å±žę€§ćÆē„”č¦–ć•ć‚Œć€ć€ŒčØ¼ę˜Žę›øć®äæ”é ¼ć‚’å¤‰ę›“ć§ćć¾ć›ć‚“ć§ć—ćŸć€ćØć„ć†č­¦å‘ŠćŒē™ŗč”Œć•ć‚Œć¾ć™ć€‚



å†…éƒØćƒˆćƒ¼ć‚Æćƒ³ć®é‡č¤‡ć™ć‚‹čØ¼ę˜Žę›øćÆć€åæ…č¦ć«åæœć˜ć¦å‰Šé™¤ć§ćć¾ć™ć€‚



ćƒˆćƒ¼ć‚Æćƒ³ć‹ć‚‰čØ¼ę˜Žę›øć‚’å‰Šé™¤ć™ć‚‹ć«ćÆć€ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’ä½æē”Øć—ć¾ć™ć€‚



$certutil -D [-d < NSS>] -n <nickname->


ćŸćØćˆć°ć€ćƒ©ćƒ™ćƒ«ļ¼ˆCKA_LABEL) "User1"ć®čØ¼ę˜Žę›øć‚’RuTokenECP20ćƒˆćƒ¼ć‚Æćƒ³ć‹ć‚‰å‰Šé™¤ć™ć‚‹ć«ćÆć€ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć™ć‚‹ć ć‘ć§ć™ć€‚



$certutil -D -d /home/a513/tmp/TEST_NSS -n "RuTokenECP20:1"


čØ¼ę˜Žę›øć‚’å‰Šé™¤ć—ć¦ć‚‚ć€ćć®ē§˜åÆ†éµćÆå‰Šé™¤ć•ć‚Œć¾ć›ć‚“ļ¼ˆć‚‚ć”ć‚ć‚“ć€ē§˜åÆ†éµćŒć‚ć‚‹å “åˆļ¼‰ć€‚ē§˜åÆ†éµć‚’å‰Šé™¤ć™ć‚‹ć«ćÆć€ę¬”ć®å½¢å¼ć®ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć™ć‚‹åæ…č¦ćŒć‚ć‚Šć¾ć™ć€‚



$certutil -F [-k < >] [-d < NSS>] -n <nickname->, 
< > := rsa|dsa|ec


NSSćƒŖćƒć‚øćƒˆćƒŖć€å€‹äŗŗčØ¼ę˜Žę›øä»˜ćć®ćƒˆćƒ¼ć‚Æćƒ³ćŒć§ććŸć®ć§ć€é›»å­ē½²åć‚’ä½æē”Øć§ćć¾ć™ć€‚



é›»å­ē½²åć®å½¢ęˆćØę¤œčØ¼



NSSćƒ‘ćƒƒć‚±ćƒ¼ć‚øć«ćÆć€é›»å­ē½²åć‚’ę“ä½œć™ć‚‹ćŸć‚ć®3ć¤ć®ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćŒć‚ć‚Šć¾ć™ć€‚



p7signćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćÆć€é›»å­ē½²åć‚’ē”Ÿęˆć™ć‚‹ćŸć‚ć«ä½æē”Øć•ć‚Œć¾ć™ć€‚



$pksign -k <nickname  > [-d < NSS>] [-e] [-i <  >] [-o <   >], 
<nickname  > := [< >:]<CKA_LABEL>


ę®‹åæµćŖćŒć‚‰ć€ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćÆć€ćć®å½¢ęˆę™‚åˆ»ć‚’å‚ē…§ć›ćšć«ē½²åć‚’ē”Ÿęˆć—ć¾ć™ć€‚ć—ć‹ć—ć€ć“ć‚ŒćÆē°”å˜ć«äæ®ę­£ć§ćć¾ć™ć€‚ē½²åē”Ÿęˆę™‚é–“ć‚’čæ½åŠ ć™ć‚‹ćŸć‚ć®é–¢ę•°ć‚’å‘¼ć³å‡ŗć—ć¦ć€p7sign.cćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć®SignFileé–¢ę•°ć«č”Œć‚’čæ½åŠ ć™ć‚‹ć ć‘ć§ååˆ†ć§ć™ć€‚



SignFile(FILE *outFile, PRFileDesc *inFile, CERTCertificate *cert,
         PRBool encapsulated)
{  
. . . 
    /* XXX Need a better way to handle that usage stuff! */
    cinfo = SEC_PKCS7CreateSignedData(cert, certUsageEmailSigner, NULL,
                                      SEC_OID_SHA1,
                                      encapsulated ? NULL : &digest,
                                      NULL, NULL);
    if (cinfo == NULL)
        return -1;
/*   */
    SEC_PKCS7AddSigningTime(cinfo);

    if (encapsulated) {
        SEC_PKCS7SetContent(cinfo, (char *)data2sign.data, data2sign.len);
    }
 . . . 
}


ć“ć‚Œć§ć€é›»å­ē½²åćŒCAdes-BESå½¢å¼ć§ē”Ÿęˆć•ć‚Œć¾ć™ć€‚



NSSć§ćÆć€čØ¼ę˜Žę›øćØćć®ē§˜åÆ†éµćŒåŒć˜ćƒˆćƒ¼ć‚Æćƒ³ć«äæå­˜ć•ć‚Œć€ćć‚Œć‚‰ć®ćƒ©ćƒ™ćƒ«ļ¼ˆCKA_LABEL)とCKA_IDćŒåŒć˜ć§ć‚ć‚‹ć“ćØćŒčŖć‚ć‚‰ć‚Œć¦ć„ć¾ć™ć€‚ć—ćŸćŒć£ć¦ć€ē§˜åÆ†éµć®ćƒ‹ćƒƒć‚Æćƒćƒ¼ćƒ ćØčØ¼ę˜Žę›øč‡Ŗä½“ć®ćƒ‹ćƒƒć‚Æćƒćƒ¼ćƒ ćÆåŒć˜ć§ć™ć€‚čØ¼ę˜Žę›øå†…ć®ē§˜åÆ†éµć®å­˜åœØćÆć€č”Øē¤ŗć•ć‚ŒćŸčØ¼ę˜Žę›øć®äæ”é ¼å±žę€§ć®å€¤ "u态u态u"ć«ć‚ˆć£ć¦ę¤œå‡ŗć§ćć‚‹ć“ćØć‚’ę€ć„å‡ŗć—ć¦ćć ć•ć„ļ¼ˆć‚³ćƒžćƒ³ćƒ‰certutil -L)。



ćƒ‡ćƒ•ć‚©ćƒ«ćƒˆć§ćÆć€p7signćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćÆćƒ‡ć‚æćƒƒćƒć•ć‚ŒćŸē½²åć‚’ē”Ÿęˆć—ć¾ć™ć€‚čæ½åŠ ć®ē½²åćŒåæ…č¦ćŖå “åˆćÆć€ć€Œ-eć€ćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćƒ¼ć‚’ęŒ‡å®šć™ć‚‹åæ…č¦ćŒć‚ć‚Šć¾ć™ć€‚ NSSć‚¹ćƒˆć‚¢ć®å†…éƒØćƒˆćƒ¼ć‚Æćƒ³ć«ć€ē½²åč€…ć®čØ¼ę˜Žę›øć®ćƒ«ćƒ¼ćƒˆčØ¼ę˜Žę›øćƒć‚§ćƒ¼ćƒ³ćŒćŖć„å “åˆć€ć¾ćŸćÆē½²åč€…ć®äæ”é ¼å±žę€§ćŒčØ­å®šć•ć‚Œć¦ć„ćŖć„å “åˆć€ē½²åćÆē”Ÿęˆć•ć‚ŒćŖć„ć“ćØć«ę³Øę„ć—ć¦ćć ć•ć„ć€‚



p7verifyćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćÆć€é›»å­ē½²åć‚’ę¤œčØ¼ć™ć‚‹ćŸć‚ć«ä½æē”Øć•ć‚Œć¾ć™ć€‚



$p7verify -c < > -s <  > [-d < NSS>] [-u < >] 


怌-uć€ćƒ‘ćƒ©ćƒ”ćƒ¼ć‚æćŒé‡č¦ć§ć™ć€‚ē½²åč€…ć®čØ¼ę˜Žę›øć®ć‚æć‚¤ćƒ—ć‚’ē¢ŗčŖć™ć‚‹ć‚ˆć†ć«ęŒ‡ē¤ŗć—ć€ęŒ‡å®šć•ć‚ŒćŸć‚æć‚¤ćƒ—ćØäø€č‡“ć—ćŖć„å “åˆć€ē½²åćÆē„”åŠ¹ć«ćŖć‚Šć¾ć™ć€‚



値<certificateusage>ć«ćÆć€ę¬”ć®å€¤ć‚’ęŒ‡å®šć§ćć¾ć™ć€‚

0 - certUsageSSLClient

1 - certUsageSSLServer

2 - certUsageSSLServerWithStepUp

3 - certUsageSSLCA

4 - certUsageEmailSigner

5 - certUsageEmailRecipient

6 - certUsageObjectSigner

7 - certUsageUserCertImport

8 - certUsageVerifyCA

9 - certUsageProtectedObjectSigner

10 - certUsageStatusResponder

11 - certUsageAnyCA

12 - certUsageIPsec


ćƒ‡ćƒ•ć‚©ćƒ«ćƒˆćÆcertUsageEmailSigner(4)です。

p7contentćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć‚’ä½æē”Øć™ć‚‹ćØć€ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆć«ē½²åć—ćŸę™‚é–“ć€ē½²åč€…ć€ćŠć‚ˆć³ē½²åč€…ć®é›»å­ćƒ”ćƒ¼ćƒ«ć‚¢ćƒ‰ćƒ¬ć‚¹ć«é–¢ć™ć‚‹ęƒ…å ±ć‚’å–å¾—ć§ćć¾ć™ć€‚ē½²åćŒę·»ä»˜ć•ć‚Œć¦ć„ć‚‹å “åˆćÆć€ē½²åć•ć‚ŒćŸć‚³ćƒ³ćƒ†ćƒ³ćƒ„č‡Ŗä½“ć‚‚å–å¾—ć•ć‚Œć¾ć™ć€‚



p7contentćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć®å½¢å¼ćÆę¬”ć®ćØćŠć‚Šć§ć™ć€‚



$p7content [-d < NSS>] [-i <  >] [-o < >]


ä¾‹ćˆć°ļ¼š



$ p7content -d "sql:/home/a513/tmp/TEST_NSS" -i "/home/a513/DATE_NSS.txt.p7s"
Content printed between bars (newline added before second bar):

#     ,    "-" ()
#     
---------------------------------------------
  NSS

---------------------------------------------
Content was not encrypted.
Signature is valid.
The signer's common name is  1
The signer's email address is user1@mail.ru
Signing time: Fri Jul 17 10:00:45 2020
There were certs or crls included.
$


ć“ć‚Œć‚‰ćÆć€NSSćƒ‘ćƒƒć‚±ćƒ¼ć‚øć«å«ć¾ć‚Œć¦ć„ć‚‹ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć®ć»ć‚“ć®äø€éƒØć§ć™ć€‚å½“ē„¶ć€OpenSSLとNSSć®äø”ę–¹ć«ć€čØ¼ę˜Žę›øč¦ę±‚ć‚’ä½œęˆć—ć¦čØ¼ę˜Žę›øć‚’ē™ŗč”Œć§ćć‚‹ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ļ¼ˆć¾ćŸćÆć‚³ćƒžćƒ³ćƒ‰ļ¼‰ćŒć‚ć‚Šć¾ć™ć€‚ opensslć®å “åˆćØåŒć˜ć‚ˆć†ć«ć€å®Œå…Øć«ę©Ÿčƒ½ć™ć‚‹CAć‚’ćƒ‡ćƒ—ćƒ­ć‚¤ć§ćć¾ć™ć€‚ selfservćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ļ¼ˆopenssl s_serverć®ć‚¢ćƒŠćƒ­ć‚°ļ¼‰ć‚’ä½æē”Øć—ć¦tls-serverを起動し、tls-client tstclnt(openssl s-clientć®ć‚¢ćƒŠćƒ­ć‚°ļ¼‰ćŖć©ć‚’ä½æē”Øć§ćć¾ć™ć€‚



ごなみに、NSSć®ęš—å·ć‚¹ć‚¤ćƒ¼ćƒˆć®ćƒŖć‚¹ćƒˆćÆlistsuitesćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć§å–å¾—ć§ćć¾ć™ć€‚ OpenSSLでは、opensslciphersć‚³ćƒžćƒ³ćƒ‰ćŒć“ć®ē›®ēš„ć‚’ęžœćŸć—ć¾ć™ć€‚ OpenSSLęš—å·ć‚¹ć‚¤ćƒ¼ćƒˆåć‹ć‚‰IANAęš—å·ć‚¹ćƒ¼ćƒ„åćøć®ćƒžćƒƒćƒ”ćƒ³ć‚°ćÆć“ć“ć«ć‚ć‚Šć¾ć™ć€‚



å®Ÿéš›ć€OpenSSLとNSSćÆć€åŒć˜ć‚³ć‚¤ćƒ³ć®2ć¤ć®å“é¢ļ¼ˆåŒć˜ćƒ—ćƒ­ćƒˆć‚³ćƒ«ćØęØ™ęŗ–ć®2ēØ®é”žć®ć‚¤ćƒ³ć‚æćƒ¼ćƒ•ć‚§ć‚¤ć‚¹ļ¼‰ć§ć‚ć‚‹ćƒ‘ćƒ–ćƒŖćƒƒć‚Æć‚­ćƒ¼ć‚¤ćƒ³ćƒ•ćƒ©ć‚¹ćƒˆćƒ©ć‚Æćƒćƒ£ć§ć™ć€‚



ć“ć®ćƒˆćƒ”ćƒƒć‚Æć«čˆˆå‘³ćŒć‚ć‚Œć°ć€č©±ćÆē¶šćć¾ć™ć€‚



結論として、NSSć®ć‚°ćƒ©ćƒ•ć‚£ć‚«ćƒ«ć‚·ć‚§ćƒ«ć«ć¤ć„ć¦ć‚‚č©³ć—ćčŖ¬ę˜Žć—ćŸć„ćØę€ć„ć¾ć™ć€‚OpenSSLć«ćÆć•ć¾ć–ć¾ćŖć‚°ćƒ©ćƒ•ć‚£ć‚«ćƒ«ć‚·ć‚§ćƒ«ćŒć‚ć‚Šć¾ć™ć€‚XCAとCAFL63恮2ć¤ć ć‘ć«ę³Øę„ć—ć¾ć™ć€‚



NSSćƒ‘ćƒƒć‚±ćƒ¼ć‚øē”Øć®GuinsspyGUI



ęœ€åˆć®č³Ŗå•ćÆä½•ć‚’é–‹ē™ŗć™ć‚‹ć‹ć§ć™ć€‚Pythonć§ę±ŗå®šć•ć‚Œć¾ć—ćŸć€‚



2ē•Ŗē›®ć®č³Ŗå•ćÆć€ć‚°ćƒ©ćƒ•ć‚£ć‚«ćƒ«ć‚¤ćƒ³ć‚æćƒ¼ćƒ•ć‚§ć‚¤ć‚¹ć‚’ä½•ć«ę›øćč¾¼ć‚€ć‹ć§ć™ć€‚ē­”ćˆćÆTkinter恧恙怂



guiはもともとPAGEć§é–‹ē™ŗć•ć‚Œć¾ć—ćŸć€‚ć—ć‹ć—ć€ćć®å¾Œć€å½¼ć‚‰ćÆå½¼ć‹ć‚‰é›¢ć‚Œć¾ć—ćŸć€‚ć—ć‹ć—ć€ę–‡č„ˆćÆę®‹ć£ćŸć€‚



ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć®ę©Ÿčƒ½ćÆć€äøŠčØ˜ć®ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćØć‚³ćƒžćƒ³ćƒ‰ć«åŸŗć„ć„ć¦ć„ć¾ć™ć€‚ć“ć‚Œć‚‰ć«åŠ ćˆć¦ć€ć€Œcertutil -Rć€ć‚³ćƒžćƒ³ćƒ‰ć«åŸŗć„ćåˆ„ć®ę©Ÿčƒ½ć€ŒčØ¼ę˜Žę›øćƒŖć‚Æć‚Øć‚¹ćƒˆć®ä½œęˆć€ćŒčæ½åŠ ć•ć‚Œć¾ć—







ćŸć€‚ć‚¦ć‚£ć‚øć‚§ćƒƒćƒˆć®ćƒ†ćƒ¼ćƒžćØć—ć¦ć€python3恮Breezećƒ†ćƒ¼ćƒžćØpython2恮Arcćƒ†ćƒ¼ćƒžć‚’ä½æē”Øć™ć‚‹ć“ćØć«ć—ć¾ć—ćŸć€‚å¾Œč€…ć«ćÆć€Breezećƒ†ćƒ¼ćƒžćŒćŖć„ćŸć‚ć§ć™ć€‚ć“ć‚Œć‚’č”Œć†ć«ćÆć€pythonać®ćƒ†ćƒ¼ćƒžć‚’å«ć‚€ćƒ‘ćƒƒć‚±ćƒ¼ć‚øć‚’ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ć™ć‚‹åæ…č¦ćŒć‚ć‚Šć¾ć™ć€‚



$pip install ttkthemes


čØ¼ę˜Žę›øć‚’å‡¦ē† するには、fsb795ćƒ‘ćƒƒć‚±ćƒ¼ć‚øć‚‚åæ…č¦ć§ć™ć€‚



$pip install fsb795


guinsspyćŒåŸŗć„ć„ć¦ć„ć‚‹NSSćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ćÆć€ć‚³ćƒ³ć‚½ćƒ¼ćƒ«ć‚’ä»‹ć—ć¦ćƒ‘ć‚¹ćƒÆćƒ¼ćƒ‰ć¾ćŸćÆPINć‚’č¦ę±‚ć™ć‚‹ć“ćØćŒć‚ˆćć‚ć‚Šć¾ć™ć€‚GUIć‚’ä»‹ć—ć¦ćć‚Œć‚‰ćØåÆ¾č©±ć™ć‚‹å”Æäø€ć®ę–¹ę³•ćÆć€pexpectćƒ‘ćƒƒć‚±ćƒ¼ć‚øć‚’ä½æē”Øć™ć‚‹ć“ćØć§ć™ć€‚



$pip install pexpect


pexpectćƒ‘ćƒƒć‚±ćƒ¼ć‚øć®ä½æē”Øä¾‹ćØć—ć¦ć€PKCS#12ć‚³ćƒ³ćƒ†ćƒŠć‚’ć‚¤ćƒ³ćƒćƒ¼ćƒˆć™ć‚‹ćŸć‚ć®ć‚³ćƒ¼ćƒ‰ć‚’ę¬”ć«ē¤ŗć—ć¾ć™ć€‚



importP12
def importP12(frameManager):
    global readpw
    global filename
    tokname = frameManager.STCombobox1.get()
    fp12 = frameManager.SEntry1.get()
    if (fp12 == () or fp12 == ''):
        tkMessageBox.showinfo(title="  PKCS#12", message='  \n')
        return (-1, "", "")
    filename = fp12
    if sys.platform != "win32":
        cmd_import_p12 = '"' + patch_win + 'pk12util" -i "' + fp12 + '" -h "' + tokname + '"  -d "' + NSSname + '"'
        id = pexpect.spawn(cmd_import_p12, timeout=1)
    else:
        cmd_import_p12 = '"' + patch_win + 'pk12util" -i "' + fp12 + '" -h "'  + tokname + '"  -d "' + NSSname + '"'
        id = pexpect.popen_spawn.PopenSpawn(cmd_import_p12, timeout=10)
    while(True):
        ret = id.expect(["Enter Password or Pin", "Enter password for PKCS12 file",pexpect.EOF, pexpect.TIMEOUT])
        if (ret == 0 or ret == 1):
            root.update()
            if (ret == 0):
                password('', tokname, 0)
                pasP11 = readpw
            else:
                password('', os.path.basename(fp12), 1)
                pasP12 = readpw
            if (readpwok == 0):
                if sys.platform != "win32":
                    id.close()
                return (-3, fp12, "")
            if sys.platform != "win32":
                id.send(readpw)
                id.send("\r")
            else:
                id.sendline(readpw)
            lseek = 1
        elif (ret == 2):
            break
        elif (ret == 3):
            break
            if sys.platform != "win32":
                id.close()
            return (-1, fp12, "")
    if sys.platform != "win32":
        res = id.before.decode('UTF-8')
        id.close()
    else:
        res = id.before.decode('UTF-8')
    if (res.find("PKCS12 IMPORT SUCCESSFUL") != -1):
        ret = 0
    elif (res.find("SEC_ERROR_BAD_PASSWORD") != -1):
        ret = -1
        return (ret, fp12, "")
    else:
        ret = -2
    return (ret, fp12, res)




ćƒ—ćƒ­ć‚·ćƒ¼ć‚øćƒ£å†…ć®ć‚Øćƒ³ćƒ‰ćƒ¬ć‚¹ćƒ«ćƒ¼ćƒ—ļ¼ˆwhile(True):)は、欔の4ć¤ć®ć‚¤ćƒ™ćƒ³ćƒˆć®ć„ćšć‚Œć‹ćŒē™ŗē”Ÿć™ć‚‹ć®ć‚’å¾…ć”ć¾ć™ć€‚



ret = id.expect(["Enter Password or Pin", "Enter password for PKCS12 file",pexpect.EOF, pexpect.TIMEOUT])


ęœ€åˆć®ć‚¤ćƒ™ćƒ³ćƒˆćÆć€ćƒ‘ć‚¹ćƒÆćƒ¼ćƒ‰ć¾ćŸćÆPINć®å…„åŠ›ļ¼ˆć€Œćƒ‘ć‚¹ćƒÆćƒ¼ćƒ‰ć¾ćŸćÆćƒ”ćƒ³ć®å…„åŠ›ć€ļ¼‰ćøć®ę‹›å¾…ć«é–¢é€£ä»˜ć‘ć‚‰ć‚Œć¦ć„ć¾ć™ć€‚

ć“ć‚ŒćŒē™ŗē”Ÿć™ć‚‹ćØć€PINć‚³ćƒ¼ćƒ‰ć‚’å…„åŠ›ć™ć‚‹ćŸć‚ć®ć‚¦ć‚£ćƒ³ćƒ‰ć‚¦ćŒē”»é¢ć«č”Øē¤ŗć•ć‚Œć¾ć™ļ¼ˆć‚¹ć‚ÆćƒŖćƒ¼ćƒ³ć‚·ćƒ§ćƒƒćƒˆć®å·¦å“ć®ć‚¦ć‚£ćƒ³ćƒ‰ć‚¦ļ¼‰







怂2ē•Ŗē›®ć®ć‚¤ćƒ™ćƒ³ćƒˆćÆć€PKCS#12ć‚³ćƒ³ćƒ†ćƒŠćƒ¼ć®ćƒ‘ć‚¹ćƒÆćƒ¼ćƒ‰ć®å…„åŠ›ļ¼ˆć€ŒPKCS12ćƒ•ć‚”ć‚¤ćƒ«ć®ćƒ‘ć‚¹ćƒÆćƒ¼ćƒ‰ć®å…„åŠ›ć€ļ¼‰ć«é–¢é€£ć—ć¦ć„ć¾ć™ć€‚ē™ŗē”Ÿć™ć‚‹ćØć€PKCS#12ć‚³ćƒ³ćƒ†ćƒŠć‚’å«ć‚€ćƒ•ć‚”ć‚¤ćƒ«ć®ćƒ‘ć‚¹ćƒÆćƒ¼ćƒ‰ć‚’å…„åŠ›ć™ć‚‹ćŸć‚ć®ć‚¦ć‚£ćƒ³ćƒ‰ć‚¦ćŒē”»é¢ć«č”Øē¤ŗć•ć‚Œć¾ć™ļ¼ˆć‚¹ć‚ÆćƒŖćƒ¼ćƒ³ć‚·ćƒ§ćƒƒćƒˆć®å³å“ć®ć‚¦ć‚£ćƒ³ćƒ‰ć‚¦ļ¼‰ć€‚



3ē•Ŗē›®ć®ć‚¤ćƒ™ćƒ³ćƒˆćÆpk12utilćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ļ¼ˆpexpect.EOFļ¼‰ć®ēµ‚äŗ†ć«é–¢é€£ä»˜ć‘ć‚‰ć‚Œć€4ē•Ŗē›®ć®ć‚¤ćƒ™ćƒ³ćƒˆćÆć‚æć‚¤ćƒ ć‚¢ć‚¦ćƒˆļ¼ˆpexpect.TIMEOUTļ¼‰ć«ć‚ˆć‚‹ćƒ¦ćƒ¼ćƒ†ć‚£ćƒŖćƒ†ć‚£ć®ēµ‚äŗ†ć«é–¢é€£ä»˜ć‘ć‚‰ć‚Œć¾ć™ć€‚



guinsspyć®ć‚½ćƒ¼ć‚¹ć‚³ćƒ¼ćƒ‰ćÆć“ć“ć«ć‚ć‚Šć¾ć™ć€‚ Linux x86_64ćƒ—ćƒ©ćƒƒćƒˆćƒ•ć‚©ćƒ¼ćƒ ē”Øć®ćƒ­ć‚·ć‚¢ęš—å·åŒ–ć§PKCS#11ćƒˆćƒ¼ć‚Æćƒ³ć‚’ę“ä½œć™ć‚‹ćŸć‚ć®NSSćƒ‘ćƒƒć‚±ćƒ¼ć‚øć®é…åøƒć‚­ćƒƒćƒˆćŒćć“ć«ć‚ć‚Šć¾ć™ć€‚



ćƒ­ć‚·ć‚¢ć®ęš—å·ćƒˆćƒ¼ć‚Æćƒ³ć‚’ćƒ†ć‚¹ćƒˆć™ć‚‹ć«ćÆć€NSS_GOST_3.52.1_Linux_x86_64ćƒ•ć‚©ćƒ«ćƒ€ćƒ¼ć‚’ćƒ›ćƒ¼ćƒ ćƒ‡ć‚£ćƒ¬ć‚ÆćƒˆćƒŖć«ć‚³ćƒ”ćƒ¼ć—ć¾ć™ć€‚guinsspy_gost.shć‚¹ć‚ÆćƒŖćƒ—ćƒˆć‚’ä½œęˆć—ć¾ć™ć€‚



export LD_LIBRARY_PATH=~/NSS_GOST_3.52.1_Linux_x86_64:$LD_LIBRARY_PATH
export PATH=~/NSS_GOST_3.52.1_Linux_x86_64:$PATH
python3 guinsspy.py


ę¬”ć«ć€ć“ć®ć‚¹ć‚ÆćƒŖćƒ—ćƒˆć‚’å®Ÿč”Œć—ć¦ć€ćƒ­ć‚·ć‚¢ć®ćƒˆćƒ¼ć‚Æćƒ³ć‚’ę“ä½œć—ć¾ć™ć€‚

ćƒ­ć‚·ć‚¢ć®ęš—å·åŒ–ć‚’ä½æē”Øć—ćŸćƒˆćƒ¼ć‚Æćƒ³ćŒę‰‹å…ƒć«ćŖć„å “åˆćÆć€[ć‚½ćƒ•ćƒˆć‚¦ć‚§ć‚¢/ć‚Æćƒ©ć‚¦ćƒ‰ćƒˆćƒ¼ć‚Æćƒ³ć®ä½œęˆ]ć‚æćƒ–ć«ē§»å‹•ć—ć¾ć™ć€‚ć“ć®ć‚æćƒ–ć§ćÆć€ć‚³ćƒ³ćƒ”ćƒ„ćƒ¼ć‚æćƒ¼ć§ć‚½ćƒ•ćƒˆć‚¦ć‚§ć‚¢ćƒˆćƒ¼ć‚Æćƒ³ć‚’ä½œęˆć™ć‚‹ę–¹ę³•ć€ć¾ćŸćÆć‚Æćƒ©ć‚¦ćƒ‰ćƒˆćƒ¼ć‚Æćƒ³ć«ęŽ„ē¶šć™ć‚‹ę–¹ę³•ć‚’čŖ¬ę˜Žć—ć¾ć™ć€‚







ęœ€å¾Œć«ć€čØ¼ę˜Žę›ø







ćƒŖć‚Æć‚Øć‚¹ćƒˆć®ä½œęˆć®ć‚¹ć‚ÆćƒŖćƒ¼ćƒ³ć‚·ćƒ§ćƒƒćƒˆļ¼šå—äæ”ć—ćŸćƒŖć‚Æć‚Øć‚¹ćƒˆć™ć‚‹ć“ćØćŒć§ćCAFL63ć«č»¢é€ć—ć€ćć“ć«ćÆē§˜åÆ†éµćŒä½œęˆć•ć‚ŒćŸćƒˆćƒ¼ć‚Æćƒ³ć«ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ć•ć‚ŒćŸčØ¼ę˜Žę›øć€ē™ŗč”Œć—ć¾ć—ćŸć€‚ę¬”ć«ć€ć“ć®čØ¼ę˜Žę›øć‚’ä½æē”Øć—ć¦ć€ćŸćØćˆć°ć€ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆć«ē½²åć—ć¾ć™ć€‚



All Articles