OIDFromBytes converts a byte slice containing an object ID in binary format into an `OID`.
(oidBytes []byte)
| 17 | // OIDFromBytes converts a byte slice containing an object ID in |
| 18 | // binary format into an `OID`. |
| 19 | func OIDFromBytes(oidBytes []byte) (OID, error) { |
| 20 | var oid OID |
| 21 | if len(oidBytes) != len(oid.v) { |
| 22 | return OID{}, errors.New("bytes oid has the wrong length") |
| 23 | } |
| 24 | copy(oid.v[0:20], oidBytes) |
| 25 | return oid, nil |
| 26 | } |
| 27 | |
| 28 | // NewOID converts an object ID in hex format (i.e., `[0-9a-f]{40}`) |
| 29 | // into an `OID`. |