MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / _write_key

Function _write_key

tests/certs/gen.py:151–163  ·  view source on GitHub ↗
(path, private_key, password=None)

Source from the content-addressed store, hash-verified

149
150
151def _write_key(path, private_key, password=None):
152 if password:
153 encryption = serialization.BestAvailableEncryption(password)
154 else:
155 encryption = serialization.NoEncryption()
156 with open(path, "wb") as f:
157 f.write(
158 private_key.private_bytes(
159 encoding=serialization.Encoding.PEM,
160 format=serialization.PrivateFormat.TraditionalOpenSSL,
161 encryption_algorithm=encryption,
162 )
163 )
164
165
166def _load_key(path, password=None):

Callers 2

_write_certFunction · 0.85
mainFunction · 0.85

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected