ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Using TLS protocol in a program on a IBM iSeries

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using TLS protocol in a program on a IBM iSeries

    I code on an iSeries with CL/RPGLE. Our email program needs to connect and send mail using MS O365 accounts and the TLS protocol for security reasons with port 587.
    Our email program needs to connect and send mail using MS O365 accounts and the TLS protocol for security reasons with port 587. For testing, I used TELNET to the O365 STMP server using port 587, the EHLO command and starting TLS using the STARTTLS command but that is far as I can get. After that, anything I do just sits there and no more responses from the server. I am trying to figure login commands at this point, which I researched from Google but didn't seem to work, much less anything else. A set of connection rules I found about TLS here on Code Project is the list below. Please see screenshots links at the bottom of post of what the TELNET session looks like. Any help would be very appreciated. Thanks!

    1. The client connects to the server using TCP.
    2. The server sends a welcome message using the un-encrypted connection to the client.
    3. The client sends a EHLO command using the un-encrypted connection to the server.
    4. The server responds to the EHLO command using the un-encrypted connection.
    5. The client sends a STARTTLS command using the un-encrypted connection to the server.
    6. The server responds to the STARTTLS command using the un-encrypted connection.
    7. The client negotiates an encrypted connection with the server.
    8. The client sends a EHLO command using the encrypted connection to the server.
    9. The server responds to the EHLO command using the encrypted connection.

    A) This first image is how I TELNET to email server for testing purposes. In the program, we use SMTP sockets to do the same thing:
    Click image for larger version

Name:	Telnet O365_port587.jpg
Views:	465
Size:	47.0 KB
ID:	151682
    B) This next one is a normal SMTP screen using port 25 (NO TLS) and connects successfully: Click image for larger version

Name:	SMTP port 25_NOTLS2.jpg
Views:	453
Size:	113.1 KB
ID:	151683
    C) Last screenshot is my TELNET attempt to TLS protocol in which I am stuck on what to do next after successfully starting the TLS sever: Click image for larger version

Name:	TLS protocol.jpg
Views:	440
Size:	42.5 KB
ID:	151684

  • #2
    After the STARTTLS you need to upgrade the connection to use TLS. You won't be able to do that in a Telnet session (which has no notion of starting TLS in the middle) but you can do it with socket programming.

    The reason it "sits there an no more responses from the server" is because its waiting for you to negotiate TLS. i.e. do the handshake, negotiate keys and certificates, and all of the other cryptographic stuff needed to establish a TLS connection.

    Comment


    • Lance Scott
      Lance Scott commented
      Editing a comment
      Thank you Scott for your reply! I was wondering about Telnet and it did cross my mind as this might be a testing issue. I guess what I need is some info on how to code the "upgrade to a TLS connection". I have protocol coded for the SMTP sockets already for port 25 with no encrypted login that works successfully. I just needed to add how to handshake and send email through a secure TLS connection using O365 SMTP address: smtp.office356.com.

      Do you know have any info on that or know where I could find some?

  • #3
    Upgrade it to a secure socket. I use the Global Secure Toolkit (GSKit) that IBM provides for this sort of thing.

    Comment

    Working...
    X