Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding support for TLS #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sagar-sandbhor
Copy link

Script to test the changes required:

package main
import (
        "database/sql"
        "fmt"
        "os"
        _ "github.com/IBM/nzgo/v12"
)
func main() {
        host := "localhost"
        password := "password"
        securityLevel := "0"
        sslmode := "disable"        if(len(os.Args) >= 2){
            host = os.Args[1]
            password = os.Args[2]
            securityLevel = os.Args[3]
            sslmode = os.Args[4]
        }
        var connstring string =
                "user=admin " +
                "port=5480 " +
                "password=" + password + " " +
                "dbname=system " +
                "host="+ host + " " +
                "securityLevel=" + securityLevel + " " +
                "sslmode=" + sslmode + " " +
                "logLevel=info " +
                //"logPath= /tmp/ +
                "additionalLogFile=stdout"
				db, err := sql.Open("nzgo", connstring)
        if err != nil {
                fmt.Println(err)
                return
        }
        defer db.Close()
        rows, err := db.Query("select count(*) from _t_object")
        if err != nil {
                fmt.Println("Error: ", err)
                return
        }
        var count int
        for rows.Next() {
                _ = rows.Scan(&count)
                fmt.Println("object count : ", count)
        }
}

Output:

readHandshakeClientPacket ssl request=0
Attempting SSL_accept()
secure connection: protocol = TLSv1.2
SSL_accept succeeded with cipher = ECDHE-ECDSA-AES256-GCM-SHA384
connection: host=127.0.0.1 user=ADMIN database=SYSTEM remotepid=952420 fetype=12 conn=T
Session id is 17849

@sagar-sandbhor sagar-sandbhor changed the title adding support for new SSL adding support for TLS Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant