github.com/xmplusdev/xray-core@v1.8.10/common/protocol/tls/cert/privateKey.go (about)

     1  package cert
     2  
     3  import (
     4  	"crypto/x509/pkix"
     5  	"encoding/asn1"
     6  	"math/big"
     7  )
     8  
     9  type ecPrivateKey struct {
    10  	Version       int
    11  	PrivateKey    []byte
    12  	NamedCurveOID asn1.ObjectIdentifier `asn1:"optional,explicit,tag:0"`
    13  	PublicKey     asn1.BitString        `asn1:"optional,explicit,tag:1"`
    14  }
    15  
    16  type pkcs8 struct {
    17  	Version    int
    18  	Algo       pkix.AlgorithmIdentifier
    19  	PrivateKey []byte
    20  	// Optional attributes omitted.
    21  }
    22  
    23  type pkcs1AdditionalRSAPrime struct {
    24  	Prime *big.Int
    25  
    26  	// We ignore these values because rsa will calculate them.
    27  	Exp   *big.Int
    28  	Coeff *big.Int
    29  }
    30  
    31  type pkcs1PrivateKey struct {
    32  	Version int
    33  	N       *big.Int
    34  	E       int
    35  	D       *big.Int
    36  	P       *big.Int
    37  	Q       *big.Int
    38  	// We ignore these values, if present, because rsa will calculate them.
    39  	Dp   *big.Int `asn1:"optional"`
    40  	Dq   *big.Int `asn1:"optional"`
    41  	Qinv *big.Int `asn1:"optional"`
    42  
    43  	AdditionalPrimes []pkcs1AdditionalRSAPrime `asn1:"optional,omitempty"`
    44  }