MCPcopy
hub / github.com/borgbackup/borg / PlaintextKey

Class PlaintextKey

src/borg/crypto/key.py:247–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245
246
247class PlaintextKey(KeyBase):
248 TYPE = KeyType.PLAINTEXT
249 TYPES_ACCEPTABLE = {TYPE}
250 NAME = "plaintext"
251 ARG_NAME = "none"
252
253 chunk_seed = 0
254 crypt_key = b"" # makes .derive_key() work, nothing secret here
255 id_key = b"" # makes .derive_key() work, nothing secret here
256
257 logically_encrypted = False
258
259 @classmethod
260 def create(cls, repository, args, **kw):
261 logger.info('Encryption NOT enabled.\nUse the "--encryption=repokey|keyfile" to enable encryption.')
262 return cls(repository)
263
264 @classmethod
265 def detect(cls, repository, manifest_data, *, other=False):
266 return cls(repository)
267
268 def id_hash(self, data):
269 return sha256(data).digest()
270
271 def encrypt(self, id, data):
272 return b"".join([self.TYPE_STR, data])
273
274 def decrypt(self, id, data):
275 self.assert_type(data[0], id)
276 return memoryview(data)[1:]
277
278
279def random_blake2b_256_key():

Callers 5

test_timestamp_parsingFunction · 0.85
test_cache_chunk_bufferFunction · 0.85
keyFunction · 0.85

Calls

no outgoing calls

Tested by 5

test_timestamp_parsingFunction · 0.68
test_cache_chunk_bufferFunction · 0.68
keyFunction · 0.68