| 1 | /* |
| 2 | Copyright 2024 The Kubernetes Authors. |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package asn1 |
| 18 | |
| 19 | import "encoding/asn1" |
| 20 | |
| 21 | // These constants store suffixes for use with the CNCF Private Enterprise Number allocated to Kubernetes: |
| 22 | // https://www.iana.org/assignments/enterprise-numbers.txt |
| 23 | // |
| 24 | // Root: 1.3.6.1.4.1.57683 |
| 25 | // |
| 26 | // Cloud Native Computing Foundation |
| 27 | const ( |
| 28 | // single-value, string value |
| 29 | x509UIDSuffix = 2 |
| 30 | ) |
| 31 | |
| 32 | func makeOID(suffix int) asn1.ObjectIdentifier { |
| 33 | return asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 57683, suffix} |
| 34 | } |
| 35 | |
| 36 | // X509UID returns an OID (1.3.6.1.4.1.57683.2) for an element of an x509 distinguished name representing a user UID. |
| 37 | // The UID is a unique value for a particular user that will change if the user is removed from the system |
| 38 | // and another user is added with the same username. |
| 39 | // |
| 40 | // This element must not appear more than once in a distinguished name, and the value must be a string |
| 41 | func X509UID() asn1.ObjectIdentifier { |
| 42 | return makeOID(x509UIDSuffix) |
| 43 | } |