Lines Matching full:line
52 for line in vector_data:
53 line = line.strip()
57 not line
58 or line.startswith("#")
59 or (line.startswith("[") and line.endswith("]"))
63 if line.strip() == "FAIL":
68 name, value = [c.strip() for c in line.split("=")]
90 for line in vector_data:
91 line = line.strip()
94 if not line or line.startswith("#"):
97 if line.startswith("K"):
98 key = line.split(" : ")[1].replace(" ", "").encode("ascii")
99 elif line.startswith("P"):
100 pt = line.split(" : ")[1].replace(" ", "").encode("ascii")
101 elif line.startswith("C"):
102 ct = line.split(" : ")[1].replace(" ", "").encode("ascii")
109 raise ValueError("Invalid line in file '{}'".format(line))
119 for line in vector_data:
120 line = line.strip()
122 if not line or line.startswith("#") or line.startswith("["):
125 if line.startswith("Len"):
126 length = int(line.split(" = ")[1])
127 elif line.startswith("Key"):
129 key = line.split(" = ")[1].encode("ascii")
130 elif line.startswith("Msg"):
134 msg = line.split(" = ")[1].encode("ascii") if length > 0 else b""
135 elif line.startswith("MD") or line.startswith("Output"):
136 md = line.split(" = ")[1]
148 raise ValueError("Unknown line in hash vector")
163 for line in vector_data:
165 line.startswith("# PSS Example")
166 or line.startswith("# OAEP Example")
167 or line.startswith("# PKCS#1 v1.5")
178 if line.startswith("# Message"):
181 elif line.startswith("# Salt"):
184 elif line.startswith("# Seed"):
187 elif line.startswith("# Signature"):
190 elif line.startswith("# Encryption"):
193 elif example_vector and line.startswith(
202 elif example_vector and line.startswith("#"):
206 example_vector[attr].append(line.strip())
209 if line.startswith("# Example") or line.startswith(
250 if line.startswith("# Private key"):
252 elif line.startswith("# Public key"):
254 elif line.startswith("# Modulus:"):
256 elif line.startswith("# Public exponent:"):
258 elif line.startswith("# Exponent:"):
264 elif line.startswith("# Prime 1:"):
266 elif line.startswith("# Prime 2:"):
268 elif line.startswith("# Prime exponent 1:"):
270 elif line.startswith("# Prime exponent 2:"):
272 elif line.startswith("# Coefficient:"):
274 elif line.startswith("#"):
278 key[attr].append(line.strip())
288 for line in vector_data:
289 line = line.strip()
292 if not line or line.startswith("["):
295 if line.startswith("# Salt len:"):
296 salt_length = int(line.split(":")[1].strip())
298 elif line.startswith("#"):
302 name, value = [c.strip() for c in line.split("=")]
345 for line in vector_data:
346 line = line.strip()
348 if not line or line.startswith("#") or line.startswith("[mod"):
351 if line.startswith("P"):
352 vectors.append({"p": int(line.split("=")[1], 16)})
353 elif line.startswith("Q"):
354 vectors[-1]["q"] = int(line.split("=")[1], 16)
355 elif line.startswith("G"):
356 vectors[-1]["g"] = int(line.split("=")[1], 16)
357 elif line.startswith("X") and "x" not in vectors[-1]:
358 vectors[-1]["x"] = int(line.split("=")[1], 16)
359 elif line.startswith("X") and "x" in vectors[-1]:
365 "x": int(line.split("=")[1], 16),
368 elif line.startswith("Y"):
369 vectors[-1]["y"] = int(line.split("=")[1], 16)
383 for line in vector_data:
384 line = line.strip()
386 if not line or line.startswith("#"):
389 sha_match = sha_regex.match(line)
393 if line.startswith("[mod"):
396 name, value = [c.strip() for c in line.split("=")]
461 for line in vector_data:
462 line = line.strip()
464 if not line or line.startswith("#"):
467 if line[1:-1] in _ECDSA_CURVE_NAMES:
468 curve_name = _ECDSA_CURVE_NAMES[line[1:-1]]
470 elif line.startswith("d = "):
474 key_data = {"curve": curve_name, "d": int(line.split("=")[1], 16)}
477 if line.startswith("Qx = "):
478 key_data["x"] = int(line.split("=")[1], 16)
479 elif line.startswith("Qy = "):
480 key_data["y"] = int(line.split("=")[1], 16)
499 for line in vector_data:
500 line = line.strip()
502 curve_match = curve_rx.match(line)
507 elif line.startswith("Msg = "):
511 hexmsg = line.split("=")[1].strip().encode("ascii")
520 if line.startswith("Qx = "):
521 data["x"] = int(line.split("=")[1], 16)
522 elif line.startswith("Qy = "):
523 data["y"] = int(line.split("=")[1], 16)
524 elif line.startswith("R = "):
525 data["r"] = int(line.split("=")[1], 16)
526 elif line.startswith("S = "):
527 data["s"] = int(line.split("=")[1], 16)
528 elif line.startswith("d = "):
529 data["d"] = int(line.split("=")[1], 16)
530 elif line.startswith("Result = "):
531 data["fail"] = line.split("=")[1].strip()[0] == "F"
548 for line in vector_data:
549 line = line.strip()
551 if not line or line.startswith("#"):
554 if line.startswith("P = "):
555 data["p"] = int(line.split("=")[1], 16)
556 elif line.startswith("Q = "):
557 data["q"] = int(line.split("=")[1], 16)
558 elif line.startswith("G = "):
559 data["g"] = int(line.split("=")[1], 16)
560 elif line.startswith("Z = "):
561 z_hex = line.split("=")[1].strip().encode("ascii")
563 elif line.startswith("XstatCAVS = "):
564 data["x1"] = int(line.split("=")[1], 16)
565 elif line.startswith("YstatCAVS = "):
566 data["y1"] = int(line.split("=")[1], 16)
567 elif line.startswith("XstatIUT = "):
568 data["x2"] = int(line.split("=")[1], 16)
569 elif line.startswith("YstatIUT = "):
570 data["y2"] = int(line.split("=")[1], 16)
571 elif line.startswith("Result = "):
572 result_str = line.split("=")[1].strip()
614 for line in vector_data:
615 line = line.strip()
617 if line.startswith("#"):
618 parm = line.split("Parameter set(s) supported:")
628 for line in vector_data:
629 line = line.strip()
631 if not line or line.startswith("#"):
634 if line in tags:
635 tag = line
637 elif line.startswith("[Curve selected:"):
638 curve = curve_name_map[line.split(":")[1].strip()[:-1]]
652 for line in vector_data:
653 line = line.strip()
655 if not line or line.startswith("#"):
658 if line.startswith("["):
659 tag = line.split()[0][1:]
660 elif line.startswith("COUNT = "):
661 data["COUNT"] = int(line.split("=")[1])
662 elif line.startswith("dsCAVS = "):
663 data["CAVS"]["d"] = int(line.split("=")[1], 16)
664 elif line.startswith("QsCAVSx = "):
665 data["CAVS"]["x"] = int(line.split("=")[1], 16)
666 elif line.startswith("QsCAVSy = "):
667 data["CAVS"]["y"] = int(line.split("=")[1], 16)
668 elif line.startswith("dsIUT = "):
669 data["IUT"]["d"] = int(line.split("=")[1], 16)
670 elif line.startswith("QsIUTx = "):
671 data["IUT"]["x"] = int(line.split("=")[1], 16)
672 elif line.startswith("QsIUTy = "):
673 data["IUT"]["y"] = int(line.split("=")[1], 16)
674 elif line.startswith("OI = "):
675 data["OI"] = int(line.split("=")[1], 16)
676 elif line.startswith("Z = "):
677 data["Z"] = int(line.split("=")[1], 16)
678 elif line.startswith("DKM = "):
679 data["DKM"] = int(line.split("=")[1], 16)
680 elif line.startswith("Result = "):
681 result_str = line.split("=")[1].strip()
712 for line in vector_data:
713 line = line.strip()
715 if line.startswith("[SHA"):
716 hashname = line[1:-1]
720 elif line.startswith("[shared secret length"):
721 shared_secret_len = int(line[1:-1].split("=")[1].strip())
722 elif line.startswith("[SharedInfo length"):
723 shared_info_len = int(line[1:-1].split("=")[1].strip())
724 elif line.startswith("[key data length"):
725 key_data_len = int(line[1:-1].split("=")[1].strip())
726 elif line.startswith("COUNT"):
727 count = int(line.split("=")[1].strip())
733 elif line.startswith("Z"):
734 vector["Z"] = line.split("=")[1].strip()
736 elif line.startswith("SharedInfo"):
738 vector["sharedinfo"] = line.split("=")[1].strip()
741 elif line.startswith("key_data"):
742 vector["key_data"] = line.split("=")[1].strip()
758 for line in vector_data:
759 line = line.strip()
761 if not line or line.startswith("#"):
764 if line.startswith("[") and line.endswith("]"):
765 tag_data = line[1:-1]
773 elif line.startswith("COUNT="):
777 elif line.startswith("L"):
778 name, value = [c.strip() for c in line.split("=")]
781 name, value = [c.strip() for c in line.split("=")]
789 for line in vector_data:
790 secret_key, public_key, message, signature, _ = line.split(":")
813 for line in vector_data:
814 line = line.strip()
817 if not line or line.startswith("#"):
822 if line.startswith(("Alen", "Plen", "Nlen", "Tlen")):
823 name, value = [c.strip() for c in line.split("=")]
828 if line.startswith("["):
831 section = line[1:-1]
838 name, value = [c.strip() for c in line.split("=")]