...

Source file src/github.com/google/certificate-transparency-go/x509/curves.go

Documentation: github.com/google/certificate-transparency-go/x509

     1  // Copyright 2018 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 x509
     6  
     7  import (
     8  	"crypto/elliptic"
     9  	"math/big"
    10  	"sync"
    11  )
    12  
    13  // This file holds ECC curves that are not supported by the main Go crypto/elliptic
    14  // library, but which have been observed in certificates in the wild.
    15  
    16  var initonce sync.Once
    17  var p192r1 *elliptic.CurveParams
    18  
    19  func initAllCurves() {
    20  	initSECP192R1()
    21  }
    22  
    23  func initSECP192R1() {
    24  	// See SEC-2, section 2.2.2
    25  	p192r1 = &elliptic.CurveParams{Name: "P-192"}
    26  	p192r1.P, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF", 16)
    27  	p192r1.N, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831", 16)
    28  	p192r1.B, _ = new(big.Int).SetString("64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1", 16)
    29  	p192r1.Gx, _ = new(big.Int).SetString("188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012", 16)
    30  	p192r1.Gy, _ = new(big.Int).SetString("07192B95FFC8DA78631011ED6B24CDD573F977A11E794811", 16)
    31  	p192r1.BitSize = 192
    32  }
    33  
    34  func secp192r1() elliptic.Curve {
    35  	initonce.Do(initAllCurves)
    36  	return p192r1
    37  }
    38  

View as plain text