You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • I just tested, and the example code I posted works (although uploading it is sometimes a pain). I also generated new keys using the exact code below, and that works too:

    // Steps taken from: 
    // https://engineering.circle.com/https-aut­horized-certs-with-node-js/
    
    wget https://raw.githubusercontent.com/anders­94/https-authorized-clients/master/keys/­ca.cnf  
    openssl req -new -x509 -days 9999 -config ca.cnf -keyout ca-key.pem -out ca-crt.pem  
    
    # Create a client key
    openssl genrsa -out client1-key.pem 4096  
    # get a config file
    wget https://raw.githubusercontent.com/anders­94/https-authorized-clients/master/keys/­client1.cnf  
    # Signing request
    openssl req -new -config client1.cnf -key client1-key.pem -out client1-csr.pem  
    # Sign
    openssl x509 -req -extfile client1.cnf -days 999 -passin "pass:password" -in client1-csr.pem -CA ca-crt.pem -CAkey ca-key.pem -CAcreateserial -out client1-crt.pem  
    # Verify
    openssl verify -CAfile ca-crt.pem client1-crt.pem  
    
    # Now get our keys into a format that can be used by Espruino.
    # The following commands just strip off the first and last lines
    # and remove all the carriage returns - this could be done by hand
    # if needed.
    
    sed '1d;$d' client1-key.pem | tr -d '\n'
    # Copy, and paste into the quotes for `okey = fwrite( atob("") );`
    
    sed '1d;$d' client1-crt.pem | tr -d '\n'
    # Copy, and paste into the quotes for `ocert = fwrite( atob("") );`
    
    sed '1d;$d' ca-crt.pem | tr -d '\n'
    # Copy, and paste into the quotes for `oca = fwrite( atob("") );`
    
About

Avatar for Gordon @Gordon started