Is there a HTML5 keygen example?

后端 未结 2 1656
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-01 22:30

I am having difficulty understanding how to use .

I could not find the demo for it, which is used for authentication. When I add the <

2条回答
  •  鱼传尺愫
    2021-02-01 23:25

    My explanations come from this PHP/Apache example. It's a simplified explanation, look at the original example for full details.

    The client generate a public key for the server and keep a private key.

    The public key is extracted by the server:

    $key = $_REQUEST['pubkey'];
    

    The server build a client certificate:

    $command = "/usr/bin/openssl ca -config ".$opensslconf." -days ".$days." -notext -batch -spkac ".$certfolder.$uniq.".spkac -out ".$certfolder.$uniq." -passin pass:'".$capw."' 2>&1";
    $output = shell_exec($command);
    

    and send it back to the client.

    You can then configure Apache to allow access to authentified clients:

    SSLEngine on
    SSLCipherSuite HIGH:MEDIUM
    SSLCertificateFile /etc/CA/certs-pub/domain.der
    SSLCertificateKeyFile /etc/CA/certs-priv/domain.pem
    SSLCACertificateFile /etc/CA/certs-pub/ca.pem
    SSLCARevocationFile /etc/CA/crl/cacrl.pem
    
      SSLVerifyClient require
      SSLVerifyDepth 1
    
    

提交回复
热议问题