Skip to content

Commit ddbe1ed

Browse files
authored
[Key Vault] Remove x509_thumbprint_string property (#34386)
1 parent d3dcf0d commit ddbe1ed

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

sdk/keyvault/azure-keyvault-certificates/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
- Added support for service API version `7.5`
77

88
### Breaking Changes
9+
> These changes do not impact the API of stable versions such as 4.7.0. Only code written against a beta version such as 4.8.0b2 may be affected.
10+
- Removed `CertificateProperties.x509_thumbprint_string`. To get the certificate's thumbprint in hex, use
11+
`CertificateProperties.x509_thumbprint.hex()` or print the `CertificateProperties` instance.
912

1013
### Bugs Fixed
1114

sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_models.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def __init__(self, **kwargs: Any) -> None:
144144
self._tags = kwargs.pop("tags", None)
145145

146146
def __repr__(self) -> str:
147-
return f"<CertificateProperties [{self.id}]>"[:1024]
147+
return f"<CertificateProperties [{self._x509_thumbprint.hex().upper()}]>"[:1024]
148148

149149
@classmethod
150150
def _from_certificate_item(
@@ -254,22 +254,13 @@ def vault_url(self) -> str:
254254
def x509_thumbprint(self) -> bytes:
255255
"""The certificate's thumbprint, in bytes.
256256
257+
To get the thumbprint as a hexadecimal string, call ``.hex()`` on this property.
258+
257259
:return: The certificate's thumbprint, in bytes.
258260
:rtype: bytes
259261
"""
260262
return self._x509_thumbprint
261263

262-
@property
263-
def x509_thumbprint_string(self) -> str:
264-
"""The certificate's thumbprint, as a hexadecimal string.
265-
266-
The thumbprint is formatted without colon delimiters; e.g. 76E1819FADF06A55EF4B126A2EF743C2BAE8A151.
267-
268-
:return: The certificate's thumbprint, as a hexadecimal string.
269-
:rtype: str
270-
"""
271-
return self._x509_thumbprint.hex().upper()
272-
273264
@property
274265
def tags(self) -> Optional[Dict[str, str]]:
275266
"""Application specific metadata in the form of key-value pairs.

sdk/keyvault/azure-keyvault-certificates/tests/test_certificates_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,9 +774,9 @@ def test_case_insensitive_key_type():
774774

775775

776776
def test_thumbprint_hex():
777-
"""Ensure the `CertificateProperties.x509_thumbprint_string` property correctly converts a thumbprint to hex."""
777+
"""Ensure `CertificateProperties.__repr__()` correctly displays the cert's thumbprint as hex."""
778778
properties = CertificateProperties(
779779
cert_id="https://vaultname.vault.azure.net/certificates/certname/version",
780780
x509_thumbprint=b"v\xe1\x81\x9f\xad\xf0jU\xefK\x12j.\xf7C\xc2\xba\xe8\xa1Q",
781781
)
782-
assert properties.x509_thumbprint_string == "76E1819FADF06A55EF4B126A2EF743C2BAE8A151"
782+
assert "76E1819FADF06A55EF4B126A2EF743C2BAE8A151" in str(properties)

0 commit comments

Comments
 (0)