(self, key, password=None)
| 13 | """Represents a private key.""" |
| 14 | |
| 15 | def __init__(self, key, password=None): |
| 16 | with reraise_errors( |
| 17 | 'Invalid private key: {0!r}', errors=(ValueError,) |
| 18 | ): |
| 19 | self._key = serialization.load_pem_private_key( |
| 20 | ensure_bytes(key), |
| 21 | password=ensure_bytes(password), |
| 22 | backend=default_backend()) |
| 23 | |
| 24 | if not isinstance(self._key, rsa.RSAPrivateKey): |
| 25 | raise ValueError("Non-RSA keys are not supported.") |
| 26 | |
| 27 | def sign(self, data, digest): |
| 28 | """Sign string containing data.""" |
nothing calls this directly
no test coverage detected