Context to temporarily set umask to its original value bitor 0o77. Useful when writing private keys to disk so that only the owner will be able to read them.
()
| 547 | @staticmethod |
| 548 | @contextlib.contextmanager |
| 549 | def umask_secret(): |
| 550 | """ |
| 551 | Context to temporarily set umask to its original value bitor 0o77. |
| 552 | Useful when writing private keys to disk so that only the owner |
| 553 | will be able to read them. |
| 554 | """ |
| 555 | original_umask = os.umask(0) |
| 556 | os.umask(original_umask | 0o77) |
| 557 | try: |
| 558 | yield |
| 559 | finally: |
| 560 | os.umask(original_umask) |
| 561 | |
| 562 | @staticmethod |
| 563 | def create_store( |
no outgoing calls