db_connect. Database helper for connecting to or initializing the SQLite database. This docstring was expanded to make future maintenance easier. Returns: Varies.
()
| 648 | |
| 649 | This docstring was expanded to make future maintenance easier. |
| 650 | |
| 651 | Args: |
| 652 | src_path: Parameter. |
| 653 | |
| 654 | Returns: |
| 655 | Varies. |
| 656 | """ |
| 657 | with open(src_path, "rb") as f: |
| 658 | hdr = f.read(HDR_LEN) |
| 659 | if len(hdr) != HDR_LEN or hdr[:len(MAGIC)] != MAGIC: |
| 660 | raise ValueError("Not an encrypted ButSystem blob.") |
| 661 | nonce = hdr[len(MAGIC):len(MAGIC)+NONCE_LEN] |
| 662 | tag = hdr[len(MAGIC)+NONCE_LEN:HDR_LEN] |
| 663 | |
| 664 | cipher = Cipher(algorithms.AES(MASTER_KEY), modes.GCM(nonce, tag)) |
| 665 | decryptor = cipher.decryptor() |
| 666 |
no outgoing calls
no test coverage detected