def unbase(self, p): contents = base64.decode(p.readp(0)) extracted = procmempe(contents, detect_image=True) self.push_procmem(extracted) return {"base64": True}
def parse_base64(cls, b64: str) -> "RsaKey": """ Parse raw base64 key (used by danabot for example) """ blob = base64.decode(b64) key = rsa.import_key(blob) return cls.parse_pem(key)
def test_base64(): assert base64("aGVsbG8=") == b"hello" assert base64("aGVsbG8=") == base64.decode("aGVsbG8=") assert base64.encode(b"hello") == b"aGVsbG8="