pkcs12.pyi 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # This file is dual licensed under the terms of the Apache License, Version
  2. # 2.0, and the BSD License. See the LICENSE file in the root of this repository
  3. # for complete details.
  4. import typing
  5. from cryptography import x509
  6. from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes
  7. from cryptography.hazmat.primitives.serialization import (
  8. KeySerializationEncryption,
  9. )
  10. from cryptography.hazmat.primitives.serialization.pkcs12 import (
  11. PKCS12KeyAndCertificates,
  12. PKCS12PrivateKeyTypes,
  13. )
  14. class PKCS12Certificate:
  15. def __init__(
  16. self, cert: x509.Certificate, friendly_name: bytes | None
  17. ) -> None: ...
  18. @property
  19. def friendly_name(self) -> bytes | None: ...
  20. @property
  21. def certificate(self) -> x509.Certificate: ...
  22. def load_key_and_certificates(
  23. data: bytes,
  24. password: bytes | None,
  25. backend: typing.Any = None,
  26. ) -> tuple[
  27. PrivateKeyTypes | None,
  28. x509.Certificate | None,
  29. list[x509.Certificate],
  30. ]: ...
  31. def load_pkcs12(
  32. data: bytes,
  33. password: bytes | None,
  34. backend: typing.Any = None,
  35. ) -> PKCS12KeyAndCertificates: ...
  36. def serialize_key_and_certificates(
  37. name: bytes | None,
  38. key: PKCS12PrivateKeyTypes | None,
  39. cert: x509.Certificate | None,
  40. cas: typing.Iterable[x509.Certificate | PKCS12Certificate] | None,
  41. encryption_algorithm: KeySerializationEncryption,
  42. ) -> bytes: ...