MCPcopy Create free account
hub / github.com/attermann/microReticulum / decrypt

Method decrypt

src/microReticulum/Destination.cpp:490–516  ·  view source on GitHub ↗

Decrypts information for ``RNS.Destination.SINGLE`` or ``RNS.Destination.GROUP`` type destination. :param ciphertext: *Bytes* containing the ciphertext to be decrypted. :raises: ``ValueError`` if destination does not hold a necessary key for decryption. */ virtual*/

Source from the content-addressed store, hash-verified

488:raises: ``ValueError`` if destination does not hold a necessary key for decryption.
489*/
490/*virtual*/ const Bytes Destination::decrypt(const Bytes& data) {
491 assert(_object);
492 TRACE("Destination::decrypt: decrypting data...");
493
494 if (_object->_type == PLAIN) {
495 return data;
496 }
497
498 if (_object->_type == SINGLE && _object->_identity) {
499 return _object->_identity.decrypt(data);
500 }
501
502/*
503 if (_object->_type == GROUP) {
504 if hasattr(self, "prv") and self.prv != None:
505 try:
506 return self.prv.decrypt(ciphertext)
507 except Exception as e:
508 RNS.log("The GROUP destination could not decrypt data", RNS.LOG_ERROR)
509 RNS.log("The contained exception was: "+str(e), RNS.LOG_ERROR)
510 else:
511 raise ValueError("No private key held by GROUP destination. Did you create or load one?")
512 }
513*/
514 // MOCK
515 return {Bytes::NONE};
516}
517
518/*
519Signs information for ``RNS.Destination.SINGLE`` type destination.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected