<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # package dsa `import "crypto/dsa"` dsa包實現FIPS 186-3定義的數字簽名算法(Digital Signature Algorithm),即DSA算法。 ## Index * [Variables](#pkg-variables) * [type ParameterSizes](#ParameterSizes) * [type Parameters](#Parameters) * [type PublicKey](#PublicKey) * [type PrivateKey](#PrivateKey) * [func GenerateParameters(params \*Parameters, rand io.Reader, sizes ParameterSizes) (err error)](#GenerateParameters) * [func GenerateKey(priv \*PrivateKey, rand io.Reader) error](#GenerateKey) * [func Sign(rand io.Reader, priv \*PrivateKey, hash []byte) (r, s \*big.Int, err error)](#Sign) * [func Verify(pub \*PublicKey, hash []byte, r, s \*big.Int) bool](#Verify) ## Variables ``` var ErrInvalidPublicKey = errors.New("crypto/dsa: invalid public key") ``` 非法公鑰,FIPS標準的公鑰格式是很嚴格的,但有些實現沒這么嚴格,使用這些實現的公鑰時,就會導致這個錯誤。 ## type [ParameterSizes](https://github.com/golang/go/blob/master/src/crypto/dsa/dsa.go#L40 "View Source") ``` type ParameterSizes int ``` 是DSA參數中的質數可以接受的字位長度的枚舉,參見FIPS 186-3 section 4.2。 ``` const ( L1024N160 ParameterSizes = iota L2048N224 L2048N256 L3072N256 ) ``` ## type [Parameters](https://github.com/golang/go/blob/master/src/crypto/dsa/dsa.go#L16 "View Source") ``` type Parameters struct { P, Q, G *big.Int } ``` Parameters代表密鑰的域參數,這些參數可以被一組密鑰共享,Q的字位長度必須是8的倍數。 ## type [PublicKey](https://github.com/golang/go/blob/master/src/crypto/dsa/dsa.go#L21 "View Source") ``` type PublicKey struct { Parameters Y *big.Int } ``` PublicKey代表一個DSA公鑰。 ## type [PrivateKey](https://github.com/golang/go/blob/master/src/crypto/dsa/dsa.go#L27 "View Source") ``` type PrivateKey struct { PublicKey X *big.Int } ``` PrivateKey代表一個DSA私鑰。 ## func [GenerateKey](https://github.com/golang/go/blob/master/src/crypto/dsa/dsa.go#L151 "View Source") ## func [GenerateParameters](https://github.com/golang/go/blob/master/src/crypto/dsa/dsa.go#L55 "View Source") ``` func GenerateParameters(params *Parameters, rand io.Reader, sizes ParameterSizes) (err error) ``` GenerateParameters函數隨機設置合法的參數到params。即使機器很快,函數也可能會花費很多時間來生成參數。 ``` func GenerateKey(priv *PrivateKey, rand io.Reader) error ``` GenerateKey生成一對公鑰和私鑰;priv.PublicKey.Parameters字段必須已經(被GenerateParameters函數)設置了合法的參數。 ## func [Sign](https://github.com/golang/go/blob/master/src/crypto/dsa/dsa.go#L194 "View Source") ``` func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err error) ``` 使用私鑰對任意長度的hash值(必須是較大信息的hash結果)進行簽名,返回簽名結果(一對大整數)。私鑰的安全性取決于密碼讀取器的熵度(隨機程度)。 注意根據FIPS 186-3 section 4.6的規定,hash必須被截斷到亞組的長度,本函數是不會自己截斷的。 ## func [Verify](https://github.com/golang/go/blob/master/src/crypto/dsa/dsa.go#L249 "View Source") ``` func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool ``` 使用公鑰認證hash和兩個大整數r、s構成的簽名,報告簽名是否合法。 注意根據FIPS 186-3 section 4.6的規定,hash必須被截斷到亞組的長度,本函數是不會自己截斷的。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看