I have a expect.pm script that is supposed to ssh to remote host and change my password on a Sparc Solaris 10 server. #!/usr/bin/perl use strict; use Expect; my $ssh = Expect->new('ssh mylogin at remotehost'); $ssh->debug(0); $ssh->expect("Password:\n"); $ssh->send("mycurrentpassword\n"); $ssh->expect('$'); $ssh->send("su - root\n"); $ssh->expect("Password:"); $ssh->send("myrootpassword\n"); $ssh->expect('#'); $ssh->send("passwd mylogin\n"); $ssh->expect("New Password:\n"); $ssh->send("mynewpassword\n"); $ssh->expect("Re-enter new Password:\n"); $ssh->send("mynewpassword\n"); #$ssh->expect #$ssh->close(); //SIGNED// Andy Maga?a UNIX Systems Administrator Diligent Contractor, 72nd Air Base Wing Tinker Air Force Base, Oklahoma Commercial: (405) 734-0341 -----Original Message----- From: openssl-users [mailto:openssl-users-bounces@xxxxxxxxxxx] On Behalf Of openssl-users-request at openssl.org Sent: Wednesday, March 18, 2015 12:36 PM To: openssl-users at openssl.org Subject: openssl-users Digest, Vol 4, Issue 23 Send openssl-users mailing list submissions to openssl-users at openssl.org To subscribe or unsubscribe via the World Wide Web, visit https://mta.openssl.org/mailman/listinfo/openssl-users or, via email, send a message with subject or body 'help' to openssl-users-request at openssl.org You can reach the person managing the list at openssl-users-owner at openssl.org When replying, please edit your Subject line so it is more specific than "Re: Contents of openssl-users digest..." Today's Topics: 1. Re: base64 decode in C (Jakob Bohm) 2. Re: base64 decode in C (Walter H.) 3. Re: [openssl-announce] Forthcoming OpenSSL releases (Dr. Matthias St. Pierre) 4. Re: base64 decode in C (Scott Neugroschl) ---------------------------------------------------------------------- Message: 1 Date: Wed, 18 Mar 2015 17:33:41 +0100 From: Jakob Bohm <jb-openssl@xxxxxxxxxx> To: openssl-users at openssl.org Subject: Re: base64 decode in C Message-ID: <5509A8E5.1060104 at wisemo.com> Content-Type: text/plain; charset=windows-1252; format=flowed Please refer to Dave Thompson's answer, it describes your problem. On 18/03/2015 16:08, Prashant Bapat wrote: > Hi Dave and Walter, > > Thanks for our reply. > > I'm not doing anything different for the ssh pubkey. I'm able to > decode it using the "openssl enc -base64 -d -A" command. But not using > the C program. > > Attaching my entire code here. After getting the base64 decoded I'm > calculating the MD5 sum and printing it. This works for a regular > string but not for SSH pubkey. > > Thanks again. > > --Prashant > Enjoy Jakob -- Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com Transformervej 29, 2860 S?borg, Denmark. Direct +45 31 13 16 10 This public discussion message is non-binding and may contain errors. WiseMo - Remote Service Management for PCs, Phones and Embedded ------------------------------ Message: 2 Date: Wed, 18 Mar 2015 17:40:06 +0100 From: "Walter H." <Walter.H@xxxxxxxxxxxxxxxxx> To: openssl-users at openssl.org Subject: Re: base64 decode in C Message-ID: <5509AA66.4070504 at mathemainzel.info> Content-Type: text/plain; charset="utf-8"; Format="flowed" On 18.03.2015 16:08, Prashant Bapat wrote: > printf("Base64 decoded string is : %s\n", b64_decode(str, strlen(str))); // This should print binary for a ssh key. not really, because the return of b64_decode is not a C string; and the format specfier %s expects a C string; -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5971 bytes Desc: S/MIME Cryptographic Signature URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/f066e41 6/attachment-0001.bin> ------------------------------ Message: 3 Date: Wed, 18 Mar 2015 17:59:59 +0100 From: "Dr. Matthias St. Pierre" <Matthias.St.Pierre@xxxxxxxxx> To: <openssl-users at openssl.org> Subject: Re: [openssl-announce] Forthcoming OpenSSL releases Message-ID: <5509AF0F.7060900 at ncp-e.com> Content-Type: text/plain; charset="windows-1252" Thanks for the three line upgracde recipe in https://wiki.openssl.org/index.php/Code_reformatting It's as simple as you stated, indeed. The reformatting was a good thing to do. Also, it makes sense to me to apply it to all stable branches uniformly, in order to simplify cross-branch merging. msp On 03/18/2015 04:32 PM, Salz, Rich wrote: >> The extra work is also documented (in a place not linked from the wiki) for >> those who maintain a git fork of the OpenSSL repository. > > I just tossed together https://wiki.openssl.org/index.php/Code_reformatting > Found off the main page, https://wiki.openssl.org/index.php/Main_Page#Internals_and_Development > >> But I have not yet seen a meaningful recipe for those of us who maintain a >> traditional set of feature patches against the released tarballs, nicely >> organized for future contribution. > > Folks had months of warning that this was going to happen. And, frankly, patches did not come flooding into the team. > > But I hope the above link helps. > > /r$ > > _______________________________________________ > openssl-users mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users > ------------------------------ Message: 4 Date: Wed, 18 Mar 2015 17:26:39 +0000 From: Scott Neugroschl <scott_n@xxxxxxxxx> To: "openssl-users at openssl.org" <openssl-users at openssl.org> Subject: Re: base64 decode in C Message-ID: <D358E5B1511A314F8160ADC6F3754987069FD9F8 at XYSVEX01.XYPRO-23.LOCAL> Content-Type: text/plain; charset="utf-8" I believe the SSH pubkey is binary data, not ASCII, so strlen() will not work on it if it has embedded NUL chars. As Dave Thompson suggested, instead of strlen(), use the length returned from BIO_read. From: openssl-users [mailto:openssl-users-bounces@xxxxxxxxxxx] On Behalf Of Prashant Bapat Sent: Wednesday, March 18, 2015 8:08 AM To: openssl-users Subject: Re: base64 decode in C Hi Dave and Walter, Thanks for our reply. I'm not doing anything different for the ssh pubkey. I'm able to decode it using the "openssl enc -base64 -d -A" command. But not using the C program. Attaching my entire code here. After getting the base64 decoded I'm calculating the MD5 sum and printing it. This works for a regular string but not for SSH pubkey. Thanks again. --Prashant On 18 March 2015 at 18:04, Walter H. <Walter.H at mathemainzel.info<mailto:Walter.H at mathemainzel.info>> wrote: Hi, before calling this function, remove any whitespace; Walter _______________________________________________ openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150318/a6cff62 3/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ openssl-users mailing list openssl-users at openssl.org https://mta.openssl.org/mailman/listinfo/openssl-users ------------------------------ End of openssl-users Digest, Vol 4, Issue 23 ******************************************** -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3357 bytes Desc: not available URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150331/d879da74/attachment-0001.bin>