code: def verify(self):
          
          if not self.public_key:
              self.fetch_public_key()
          data = self.doc.find(".//{http://salmon-protocol.org/ns/magic-env}data").text
          sig = self.doc.find(".//{http://salmon-protocol.org/ns/magic-env}sig").text
          sig_contents = '.'.join([
              data,
              b64encode(b"application/xml").decode("ascii"),
              b64encode(b"base64url").decode("ascii"),
              b64encode(b"RSA-SHA256").decode("ascii")
          ])
          sig_hash = SHA256.new(sig_contents.encode("ascii"))
          cipher = PKCS1_v1_5.new(RSA.importKey(self.public_key))
          if not cipher.verify(sig_hash, urlsafe_b64decode(sig)):
              raise SignatureVerificationError("Signature cannot be verified using the given public key")
docs: Verify Magic Envelope document against public key.