(
zelf: &Py<Self>,
other: &PyObject,
op: PyComparisonOp,
vm: &VirtualMachine,
)
| 107 | |
| 108 | impl Comparable for PySSLCertificate { |
| 109 | fn cmp( |
| 110 | zelf: &Py<Self>, |
| 111 | other: &PyObject, |
| 112 | op: PyComparisonOp, |
| 113 | vm: &VirtualMachine, |
| 114 | ) -> PyResult<PyComparisonValue> { |
| 115 | let other = class_or_notimplemented!(Self, other); |
| 116 | |
| 117 | // Only support equality comparison |
| 118 | if !matches!(op, PyComparisonOp::Eq | PyComparisonOp::Ne) { |
| 119 | return Ok(PyComparisonValue::NotImplemented); |
| 120 | } |
| 121 | |
| 122 | // Compare DER encodings |
| 123 | let self_der = zelf |
| 124 | .cert |
| 125 | .to_der() |
| 126 | .map_err(|e| convert_openssl_error(vm, e))?; |
| 127 | let other_der = other |
| 128 | .cert |
| 129 | .to_der() |
| 130 | .map_err(|e| convert_openssl_error(vm, e))?; |
| 131 | |
| 132 | let eq = self_der == other_der; |
| 133 | Ok(op.eval_ord(eq.cmp(&true)).into()) |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | impl Hashable for PySSLCertificate { |
nothing calls this directly
no test coverage detected