ev.go 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * ZLint Copyright 2021 Regents of the University of Michigan
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy
  6. * of the License at http://www.apache.org/licenses/LICENSE-2.0
  7. *
  8. * Unless required by applicable law or agreed to in writing, software
  9. * distributed under the License is distributed on an "AS IS" BASIS,
  10. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  11. * implied. See the License for the specific language governing
  12. * permissions and limitations under the License.
  13. */
  14. package util
  15. import (
  16. "encoding/asn1"
  17. )
  18. var evoids = map[string]bool{
  19. "1.3.159.1.17.1": true,
  20. "1.3.6.1.4.1.34697.2.1": true,
  21. "1.3.6.1.4.1.34697.2.2": true,
  22. "1.3.6.1.4.1.34697.2.3": true,
  23. "1.3.6.1.4.1.34697.2.4": true,
  24. "1.2.40.0.17.1.22": true,
  25. "2.16.578.1.26.1.3.3": true,
  26. "1.3.6.1.4.1.17326.10.14.2.1.2": true,
  27. "1.3.6.1.4.1.17326.10.8.2.1.2": true,
  28. "1.3.6.1.4.1.6449.1.2.1.5.1": true,
  29. "2.16.840.1.114412.2.1": true,
  30. "2.16.840.1.114412.1.3.0.2": true,
  31. "2.16.528.1.1001.1.1.1.12.6.1.1.1": true,
  32. "2.16.792.3.0.4.1.1.4": true,
  33. "2.16.840.1.114028.10.1.2": true,
  34. "0.4.0.2042.1.4": true,
  35. "0.4.0.2042.1.5": true,
  36. "1.3.6.1.4.1.13177.10.1.3.10": true,
  37. "1.3.6.1.4.1.14370.1.6": true,
  38. "1.3.6.1.4.1.4146.1.1": true,
  39. "2.16.840.1.114413.1.7.23.3": true,
  40. "1.3.6.1.4.1.14777.6.1.1": true,
  41. "2.16.792.1.2.1.1.5.7.1.9": true,
  42. "1.3.6.1.4.1.782.1.2.1.8.1": true,
  43. "1.3.6.1.4.1.22234.2.5.2.3.1": true,
  44. "1.3.6.1.4.1.8024.0.2.100.1.2": true,
  45. "1.2.392.200091.100.721.1": true,
  46. "2.16.840.1.114414.1.7.23.3": true,
  47. "1.3.6.1.4.1.23223.2": true,
  48. "1.3.6.1.4.1.23223.1.1.1": true,
  49. "2.16.756.1.83.21.0": true,
  50. "2.16.756.1.89.1.2.1.1": true,
  51. "1.3.6.1.4.1.7879.13.24.1": true,
  52. "2.16.840.1.113733.1.7.48.1": true,
  53. "2.16.840.1.114404.1.1.2.4.1": true,
  54. "2.16.840.1.113733.1.7.23.6": true,
  55. "1.3.6.1.4.1.6334.1.100.1": true,
  56. "2.16.840.1.114171.500.9": true,
  57. "1.3.6.1.4.1.36305.2": true,
  58. }
  59. // IsEV returns true if the input is a known Extended Validation OID.
  60. func IsEV(in []asn1.ObjectIdentifier) bool {
  61. for _, oid := range in {
  62. if _, ok := evoids[oid.String()]; ok {
  63. return true
  64. }
  65. }
  66. return false
  67. }
  68. const OnionTLD = ".onion"