Example #1
0
File: ctx.go Project: Machyne/mongo
// NewCtxWithVersion creates an SSL context that is specific to the provided
// SSL version. See http://www.openssl.org/docs/ssl/SSL_CTX_new.html for more.
func NewCtxWithVersion(version SSLVersion) (*Ctx, error) {
	var method *C.SSL_METHOD
	switch version {
	case TLSv1:
		method = C.TLSv1_method()
	case AnyVersion:
		method = C.SSLv23_method()
	}
	if method == nil {
		return nil, errors.New("unknown ssl/tls version")
	}
	return newCtx(method)
}
Example #2
0
// TLSv1.0
func TLSv1Method() *METHOD {
	return &METHOD{C.TLSv1_method()}
}