Debian Codegraph @

tls/tls_ka.go

raw symbols SCIP
1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package tlsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/
6
7 import (
8 "encoding/jsonscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/"
9 "math/bigscip-go gomod github.com/golang/go/src go1.16 `math/big`/"
10 "regexpscip-go gomod github.com/golang/go/src go1.16 regexp/"
11 "strconvscip-go gomod github.com/golang/go/src go1.16 strconv/"
12
13 jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ "github.com/zmap/zcrypto/jsonscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/"
14 )
15
16 // SignatureAndHash is a SigAndHash that implements json.Marshaler and
17 // json.Unmarshaler
18 type SignatureAndHashscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/SignatureAndHash# SigAndHashscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/SigAndHash#
19
20 type auxSignatureAndHashscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/auxSignatureAndHash# struct {
21 SignatureAlgorithmscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/auxSignatureAndHash#SignatureAlgorithm. string `json:"signature_algorithm"`
22 HashAlgorithmscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/auxSignatureAndHash#HashAlgorithm. string `json:"hash_algorithm"`
23 }
24
25 // MarshalJSON implements the json.Marshaler interface
26 func (sh *SignatureAndHashscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/SignatureAndHash#) MarshalJSONscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/SignatureAndHash#MarshalJSON().() ([]byte, error) {
27 aux := auxSignatureAndHashscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/auxSignatureAndHash#{
28 SignatureAlgorithmscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/auxSignatureAndHash#SignatureAlgorithm.: nameForSignaturescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/nameForSignature().(sh.Signaturescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/SigAndHash#Signature.),
29 HashAlgorithmscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/auxSignatureAndHash#HashAlgorithm.: nameForHashscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/nameForHash().(sh.Hashscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/SigAndHash#Hash.),
30 }
31 return jsonscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/Marshal().(&aux)
32 }
33
34 var unknownAlgorithmRegexscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/unknownAlgorithmRegex. = regexpscip-go gomod github.com/golang/go/src go1.16 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.16 regexp/MustCompile().(`unknown\.(\d+)`)
35
36 // UnmarshalJSON implements the json.Unmarshaler interface
37 func (sh *SignatureAndHashscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/SignatureAndHash#) UnmarshalJSONscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/SignatureAndHash#UnmarshalJSON().(b []byte) error {
38 aux := new(auxSignatureAndHashscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/auxSignatureAndHash#)
39 if err := jsonscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/Unmarshal().(b, aux); err != nil {
40 return err
41 }
42 sh.Signaturescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/SigAndHash#Signature. = signatureToNamescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signatureToName().(aux.SignatureAlgorithmscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/auxSignatureAndHash#SignatureAlgorithm.)
43 sh.Hashscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/SigAndHash#Hash. = hashToNamescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/hashToName().(aux.HashAlgorithmscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/auxSignatureAndHash#HashAlgorithm.)
44 return nil
45 }
46
47 func (ka *rsaKeyAgreementscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/rsaKeyAgreement#) RSAParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/rsaKeyAgreement#RSAParams().() *jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.RSAPublicKeyscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/RSAPublicKey# {
48 out := new(jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.RSAPublicKeyscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/RSAPublicKey#)
49 out.PublicKeyscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/RSAPublicKey#PublicKey. = ka.publicKeyscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/rsaKeyAgreement#publicKey.
50 return out
51 }
52
53 func (ka *ecdheKeyAgreementscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#) ECDHParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#ECDHParams().() *jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.ECDHParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams# {
54 out := new(jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.ECDHParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#)
55 out.TLSCurveIDscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#TLSCurveID. = jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.TLSCurveIDscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/TLSCurveID#(ka.curveIDscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#curveID.)
56 out.ServerPublicscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ServerPublic. = &jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.ECPointscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECPoint#{}
57 if ka.xscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#x. != nil {
58 out.ServerPublicscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ServerPublic..Xscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECPoint#X. = new(bigscip-go gomod github.com/golang/go/src go1.16 `math/big`/.Intscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#)
59 out.ServerPublicscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ServerPublic..Xscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECPoint#X..Setscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Set().(ka.xscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#x.)
60 }
61 if ka.yscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#y. != nil {
62 out.ServerPublicscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ServerPublic..Yscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECPoint#Y. = new(bigscip-go gomod github.com/golang/go/src go1.16 `math/big`/.Intscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#)
63 out.ServerPublicscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ServerPublic..Yscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECPoint#Y..Setscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Set().(ka.yscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#y.)
64 }
65 if len(ka.serverPrivKeyscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#serverPrivKey.) > 0 {
66 out.ServerPrivatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ServerPrivate. = new(jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.ECDHPrivateParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHPrivateParams#)
67 out.ServerPrivatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ServerPrivate..Lengthscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHPrivateParams#Length. = len(ka.serverPrivKeyscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#serverPrivKey.)
68 out.ServerPrivatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ServerPrivate..Valuescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHPrivateParams#Value. = make([]byte, len(ka.serverPrivKeyscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#serverPrivKey.))
69 copy(out.ServerPrivatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ServerPrivate..Valuescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHPrivateParams#Value., ka.serverPrivKeyscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#serverPrivKey.)
70 }
71 return out
72 }
73
74 func (ka *ecdheKeyAgreementscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#) ClientECDHParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#ClientECDHParams().() *jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.ECDHParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams# {
75 out := new(jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.ECDHParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#)
76 out.TLSCurveIDscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#TLSCurveID. = jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.TLSCurveIDscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/TLSCurveID#(ka.curveIDscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#curveID.)
77 out.ClientPublicscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ClientPublic. = &jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.ECPointscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECPoint#{}
78 if ka.clientXscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#clientX. != nil {
79 out.ClientPublicscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ClientPublic..Xscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECPoint#X. = new(bigscip-go gomod github.com/golang/go/src go1.16 `math/big`/.Intscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#)
80 out.ClientPublicscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ClientPublic..Xscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECPoint#X..Setscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Set().(ka.clientXscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#clientX.)
81 }
82 if ka.clientYscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#clientY. != nil {
83 out.ClientPublicscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ClientPublic..Yscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECPoint#Y. = new(bigscip-go gomod github.com/golang/go/src go1.16 `math/big`/.Intscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#)
84 out.ClientPublicscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ClientPublic..Yscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECPoint#Y..Setscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Set().(ka.clientYscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#clientY.)
85 }
86
87 if len(ka.clientPrivKeyscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#clientPrivKey.) > 0 {
88 out.ClientPrivatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ClientPrivate. = new(jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.ECDHPrivateParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHPrivateParams#)
89 out.ClientPrivatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ClientPrivate..Lengthscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHPrivateParams#Length. = len(ka.clientPrivKeyscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#clientPrivKey.)
90 out.ClientPrivatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ClientPrivate..Valuescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHPrivateParams#Value. = make([]byte, len(ka.clientPrivKeyscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#clientPrivKey.))
91 copy(out.ClientPrivatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHParams#ClientPrivate..Valuescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/ECDHPrivateParams#Value., ka.clientPrivKeyscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ecdheKeyAgreement#clientPrivKey.)
92 }
93 return out
94 }
95
96 func (ka *dheKeyAgreementscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#) DHParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#DHParams().() *jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.DHParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/DHParams# {
97 out := new(jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.DHParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/DHParams#)
98 if ka.pscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#p. != nil {
99 out.Primescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/DHParams#Prime. = new(bigscip-go gomod github.com/golang/go/src go1.16 `math/big`/.Intscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#).Setscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Set().(ka.pscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#p.)
100 }
101 if ka.gscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#g. != nil {
102 out.Generatorscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/DHParams#Generator. = new(bigscip-go gomod github.com/golang/go/src go1.16 `math/big`/.Intscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#).Setscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Set().(ka.gscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#g.)
103 }
104 if ka.yServerscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#yServer. != nil {
105 out.ServerPublicscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/DHParams#ServerPublic. = new(bigscip-go gomod github.com/golang/go/src go1.16 `math/big`/.Intscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#).Setscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Set().(ka.yServerscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#yServer.)
106 if ka.yOursscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#yOurs. != nil && ka.xOursscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#xOurs. != nil && ka.yServerscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#yServer..Cmpscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Cmp().(ka.yOursscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#yOurs.) == 0 {
107 out.ServerPrivatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/DHParams#ServerPrivate. = new(bigscip-go gomod github.com/golang/go/src go1.16 `math/big`/.Intscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#).Setscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Set().(ka.xOursscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#xOurs.)
108 }
109 }
110 return out
111 }
112
113 func (ka *dheKeyAgreementscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#) ClientDHParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#ClientDHParams().() *jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.DHParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/DHParams# {
114 out := new(jsonKeysscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/.DHParamsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/DHParams#)
115 if ka.pscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#p. != nil {
116 out.Primescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/DHParams#Prime. = new(bigscip-go gomod github.com/golang/go/src go1.16 `math/big`/.Intscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#).Setscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Set().(ka.pscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#p.)
117 }
118 if ka.gscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#g. != nil {
119 out.Generatorscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/DHParams#Generator. = new(bigscip-go gomod github.com/golang/go/src go1.16 `math/big`/.Intscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#).Setscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Set().(ka.gscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#g.)
120 }
121 if ka.yClientscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#yClient. != nil {
122 out.ClientPublicscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/DHParams#ClientPublic. = new(bigscip-go gomod github.com/golang/go/src go1.16 `math/big`/.Intscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#).Setscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Set().(ka.yClientscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#yClient.)
123 if ka.yOursscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#yOurs. != nil && ka.xOursscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#xOurs. != nil && ka.yClientscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#yClient..Cmpscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Cmp().(ka.yOursscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#yOurs.) == 0 {
124 out.ClientPrivatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/json`/DHParams#ClientPrivate. = new(bigscip-go gomod github.com/golang/go/src go1.16 `math/big`/.Intscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#).Setscip-go gomod github.com/golang/go/src go1.16 `math/big`/Int#Set().(ka.xOursscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/dheKeyAgreement#xOurs.)
125 }
126 }
127 return out
128 }
129
130 // DigitalSignature represents a signature for a digitally-signed-struct in the
131 // TLS record protocol. It is dependent on the version of TLS in use. In TLS
132 // 1.2, the first two bytes of the signature specify the signature and hash
133 // algorithms. These are contained the TLSSignature.Raw field, but also parsed
134 // out into TLSSignature.SigHashExtension. In older versions of TLS, the
135 // signature and hash extension is not used, and so
136 // TLSSignature.SigHashExtension will be empty. The version string is stored in
137 // TLSSignature.TLSVersion.
138 type DigitalSignaturescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature# struct {
139 Rawscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature#Raw. []byte `json:"raw"`
140 Typescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature#Type. string `json:"type,omitempty"`
141 Validscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature#Valid. bool `json:"valid"`
142 SigHashExtensionscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature#SigHashExtension. *SignatureAndHashscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/SignatureAndHash# `json:"signature_and_hash_type,omitempty"`
143 Versionscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature#Version. TLSVersionscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/TLSVersion# `json:"tls_version"`
144 }
145
146 func signatureTypeToNamescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signatureTypeToName().(sigType uint8) string {
147 switch sigType {
148 case signatureRSAscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signatureRSA.:
149 return "rsa"
150 case signatureDSAscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signatureDSA.:
151 return "dsa"
152 case signatureECDSAscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signatureECDSA.:
153 return "ecdsa"
154 default:
155 break
156 }
157 return "unknown." + strconvscip-go gomod github.com/golang/go/src go1.16 strconv/.Itoascip-go gomod github.com/golang/go/src go1.16 strconv/Itoa().(int(sigType))
158 }
159
160 func (ka *signedKeyAgreementscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signedKeyAgreement#) Signaturescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signedKeyAgreement#Signature().() *DigitalSignaturescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature# {
161 out := DigitalSignaturescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature#{
162 Rawscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature#Raw.: ka.rawscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signedKeyAgreement#raw.,
163 Typescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature#Type.: signatureTypeToNamescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signatureTypeToName().(ka.sigTypescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signedKeyAgreement#sigType.),
164 Validscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature#Valid.: ka.validscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signedKeyAgreement#valid.,
165 Versionscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature#Version.: TLSVersionscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/TLSVersion#(ka.versionscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signedKeyAgreement#version.),
166 }
167 if ka.versionscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signedKeyAgreement#version. >= VersionTLS12scip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/VersionTLS12. {
168 out.SigHashExtensionscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature#SigHashExtension. = new(SignatureAndHashscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/SignatureAndHash#)
169 *out.SigHashExtensionscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/DigitalSignature#SigHashExtension. = SignatureAndHashscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/SignatureAndHash#(ka.shscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/signedKeyAgreement#sh.)
170 }
171 return &out
172 }