CT: extensions -> extension_bytes (#7238)

Signed-off-by: William Woodruff <william@trailofbits.com>
This commit is contained in:
William Woodruff 2022-05-19 17:48:41 -04:00 committed by GitHub
parent e087b3e33c
commit e2ef761b4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View file

@ -76,7 +76,7 @@ issued.
The raw bytes of the signatures embedded in the SCT.
.. attribute:: extensions
.. attribute:: extension_bytes
.. versionadded:: 38.0

View file

@ -79,7 +79,7 @@ class SignedCertificateTimestamp(metaclass=abc.ABCMeta):
"""
@abc.abstractproperty
def extensions(self) -> bytes:
def extension_bytes(self) -> bytes:
"""
Returns the raw bytes of any extensions for this SCT.
"""

View file

@ -137,7 +137,7 @@ pub(crate) struct Sct {
signature_algorithm: SignatureAlgorithm,
// TODO: These could be 'self references back into sct_data with ouroboros.
signature: Vec<u8>,
extensions: Vec<u8>,
extension_bytes: Vec<u8>,
pub(crate) sct_data: Vec<u8>,
}
@ -202,8 +202,8 @@ impl Sct {
}
#[getter]
fn extensions(&self) -> &[u8] {
&self.extensions
fn extension_bytes(&self) -> &[u8] {
&self.extension_bytes
}
}
@ -249,7 +249,7 @@ pub(crate) fn parse_scts(
}
let log_id = sct_data.read_exact(32)?.try_into().unwrap();
let timestamp = u64::from_be_bytes(sct_data.read_exact(8)?.try_into().unwrap());
let extensions = sct_data.read_length_prefixed()?.data.to_vec();
let extension_bytes = sct_data.read_length_prefixed()?.data.to_vec();
let hash_algorithm = sct_data.read_byte()?.try_into()?;
let signature_algorithm = sct_data.read_byte()?.try_into()?;
@ -262,7 +262,7 @@ pub(crate) fn parse_scts(
hash_algorithm,
signature_algorithm,
signature,
extensions,
extension_bytes,
sct_data: raw_sct_data,
};
py_scts.append(pyo3::PyCell::new(py, sct)?)?;

View file

@ -6060,7 +6060,7 @@ class TestPrecertificateSignedCertificateTimestampsExtension:
b"\x67\xB2\x07\xE1\x8F\x6D\xAD\xD1\x04\x4A\x5E\xB3\x89\xEF\x7C\x60"
b"\xC2\x68\x53\xF9\x3D\x1F\x6D"
)
assert sct.extensions == b""
assert sct.extension_bytes == b""
def test_generate(self, backend):
cert = _load_cert(