コード例 #1
0
ファイル: ztls_ka.go プロジェクト: aaspring/zgrab
func (ka *ecdheKeyAgreement) ECDHParams() *keys.ECDHParams {
	out := new(keys.ECDHParams)
	out.TLSCurveID = keys.TLSCurveID(ka.curveID)
	out.ServerPublic = &keys.ECPoint{}
	if ka.x != nil {
		out.ServerPublic.X = new(big.Int)
		out.ServerPublic.X.Set(ka.x)
	}
	if ka.y != nil {
		out.ServerPublic.Y = new(big.Int)
		out.ServerPublic.Y.Set(ka.y)
	}
	return out
}
コード例 #2
0
ファイル: ztls_ka.go プロジェクト: aaspring/zgrab
func (ka *ecdheKeyAgreement) ClientECDHParams() *keys.ECDHParams {
	out := new(keys.ECDHParams)
	out.TLSCurveID = keys.TLSCurveID(ka.curveID)
	out.ClientPublic = &keys.ECPoint{}
	if ka.x != nil {
		out.ClientPublic.X = new(big.Int)
		out.ClientPublic.X.Set(ka.clientX)
	}
	if ka.y != nil {
		out.ClientPublic.Y = new(big.Int)
		out.ClientPublic.Y.Set(ka.clientY)
	}

	out.ClientPrivate = new(keys.ECDHPrivateParams)
	out.ClientPrivate.Length = len(ka.clientPrivKey)
	out.ClientPrivate.Value = make([]byte, len(ka.clientPrivKey))
	copy(out.ClientPrivate.Value, ka.clientPrivKey)
	return out
}