privateKey.go 939 B

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