<html><head></head><body><div class="ydpa7863b90yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div><div dir="ltr" data-setdir="false">Thanks, Dw.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Interesting. I think I misunderstood this explanation about the -signkey <file> option: "<span>This option causes the input file to be self signed using the supplied private key.</span>"</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Your input has me thinking that a certificate signing request is in fact self-signed like a self-signed certificate is self-signed. I think I mistakenly supposed any self-signing meant acting like a "mini CA". I shall give those two x509 options, '<span>-x509toreq' and '<span>-signkey</span>',</span> a try.<br></div><div><br></div><div class="ydpa7863b90signature"><div>Douglas Morris<br></div></div></div>
        <div><br></div><div><br></div>
        
        </div><div id="yahoo_quoted_0792770129" class="yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Thursday, January 30, 2020, 3:51:45 PM EST, Dirk-Willem van Gulik <dirkx@webweaving.org> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="yiv5474703350"><div><br class="yiv5474703350" clear="none"><div><br class="yiv5474703350" clear="none"><blockquote class="yiv5474703350" type="cite"><div class="yiv5474703350yqt8929485160" id="yiv5474703350yqtfd46163"><div class="yiv5474703350">On 30 Jan 2020, at 21:38, Douglas Morris via openssl-users <<a rel="nofollow" shape="rect" class="yiv5474703350" ymailto="mailto:openssl-users@openssl.org" target="_blank" href="mailto:openssl-users@openssl.org">openssl-users@openssl.org</a>> wrote:</div><br class="yiv5474703350Apple-interchange-newline" clear="none"><div class="yiv5474703350"><div class="yiv5474703350"><div class="yiv5474703350ydpc44dcd6dyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div class="yiv5474703350"><div class="yiv5474703350" dir="ltr">I am trying to implement automated domain certificate renewal. A certificate signing request is sent to an ACME server and on success a certificate is returned. I'd like to be able to call OpenSSL to make a new key and then make a new certificate signing request just like the old one except for the replacement key pair file.</div><div class="yiv5474703350" dir="ltr"><span class="yiv5474703350"><br class="yiv5474703350" clear="none"></span></div><div class="yiv5474703350" dir="ltr"><span class="yiv5474703350">I suppose the complete information beyond the new key data is available both in the old crs and 
the old certificate. I'm looking at the 
manpages of OpenSSL subcommands 'req' and 'x509'. The openssl x509 
option '<span class="yiv5474703350">-x509toreq</span>' gave me a momentary rush of hope, but then I read about the '<span class="yiv5474703350">-signkey</span>' option, which seems to be exclusively about self-signing.</span><br class="yiv5474703350" clear="none"></div><div class="yiv5474703350" dir="ltr"><br class="yiv5474703350" clear="none"></div><div class="yiv5474703350" dir="ltr">Is 'cloning' the csr or cert. information semantically logical? Is it possible with OpenSSL?<br class="yiv5474703350" clear="none"></div><div class="yiv5474703350" dir="ltr"><br class="yiv5474703350" clear="none"></div><div class="yiv5474703350" dir="ltr">If I can't reliably extract the relevant data from the old csr or old certification, I suppose I must do it as usual with a dedicated config file and the '-batch' option:</div><div class="yiv5474703350" dir="ltr">     openssl req -key <key> -<span class="yiv5474703350">new -config <config.ini> -outform PEM -out <outfile></span> -batch</div></div></div></div></div></div></blockquote><div><br class="yiv5474703350" clear="none"></div><div>openssl x509 -x509toreq should do the trick</div><div><br class="yiv5474703350" clear="none"></div><div>E.g.</div><div><br class="yiv5474703350" clear="none"></div><div><span class="yiv5474703350Apple-tab-span" style="white-space:pre;">             </span></div><div class="yiv5474703350" style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(12, 255, 0);background-color:rgba(255, 255, 255, 0.901961);"><span class="yiv5474703350" style=""><span class="yiv5474703350Apple-tab-span" style="white-space:pre;">    </span># generate test cert</span></div><div class="yiv5474703350" style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(12, 255, 0);background-color:rgba(255, 255, 255, 0.901961);"><span class="yiv5474703350" style=""><span class="yiv5474703350Apple-tab-span" style="white-space:pre;">   </span>openssl req -x509 -new -subj /CN=foo -nodes -keyout x.key > x.crt</span></div><div class="yiv5474703350" style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(12, 255, 0);background-color:rgba(255, 255, 255, 0.901961);"><span class="yiv5474703350" style=""><span class="yiv5474703350Apple-tab-span" style="white-space:pre;">   </span>openssl x509 -in x.crt -noout -text</span></div><div class="yiv5474703350" style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(12, 255, 0);background-color:rgba(255, 255, 255, 0.901961);"><span class="yiv5474703350" style=""><br class="yiv5474703350" clear="none"></span></div><div class="yiv5474703350" style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(12, 255, 0);background-color:rgba(255, 255, 255, 0.901961);"><span class="yiv5474703350Apple-tab-span" style="white-space:pre;">   </span># turn test cert in a request</div><div class="yiv5474703350" style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(12, 255, 0);background-color:rgba(255, 255, 255, 0.901961);"><span class="yiv5474703350" style=""><span class="yiv5474703350Apple-tab-span" style="white-space:pre;">       </span>openssl x509 -x509toreq -signkey x.key < x.crt</span></div><div><br class="yiv5474703350" clear="none"></div><div>Dw</div><div class="yiv5474703350yqt8929485160" id="yiv5474703350yqtfd87818"><div><br class="yiv5474703350" clear="none"></div></div></div></div></div></div>
            </div>
        </div></body></html>