Lines Matching full:line
55 for line in vector_data:
56 line = line.strip()
59 if not line or line.startswith("#") or (line.startswith("[") and
60 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")
111 raise ValueError("Invalid line in file '{}'".format(line))
121 for line in vector_data:
122 line = line.strip()
124 if not line or line.startswith("#") or line.startswith("["):
127 if line.startswith("Len"):
128 length = int(line.split(" = ")[1])
129 elif line.startswith("Key"):
131 key = line.split(" = ")[1].encode("ascii")
132 elif line.startswith("Msg"):
136 msg = line.split(" = ")[1].encode("ascii") if length > 0 else b""
137 elif line.startswith("MD") or line.startswith("Output"):
138 md = line.split(" = ")[1]
150 raise ValueError("Unknown line in hash vector")
165 for line in vector_data:
167 line.startswith("# PSS Example") or
168 line.startswith("# OAEP Example") or
169 line.startswith("# PKCS#1 v1.5")
180 if line.startswith("# Message"):
183 elif line.startswith("# Salt"):
186 elif line.startswith("# Seed"):
189 elif line.startswith("# Signature"):
192 elif line.startswith("# Encryption"):
197 line.startswith("# =============================================")
205 elif example_vector and line.startswith("#"):
209 example_vector[attr].append(line.strip())
213 line.startswith("# Example") or
214 line.startswith("# =============================================")
256 if line.startswith("# Private key"):
258 elif line.startswith("# Public key"):
260 elif line.startswith("# Modulus:"):
262 elif line.startswith("# Public exponent:"):
264 elif line.startswith("# Exponent:"):
270 elif line.startswith("# Prime 1:"):
272 elif line.startswith("# Prime 2:"):
274 elif line.startswith("# Prime exponent 1:"):
276 elif line.startswith("# Prime exponent 2:"):
278 elif line.startswith("# Coefficient:"):
280 elif line.startswith("#"):
284 key[attr].append(line.strip())
294 for line in vector_data:
295 line = line.strip()
298 if not line or line.startswith("["):
301 if line.startswith("# Salt len:"):
302 salt_length = int(line.split(":")[1].strip())
304 elif line.startswith("#"):
308 name, value = [c.strip() for c in line.split("=")]
356 for line in vector_data:
357 line = line.strip()
359 if not line or line.startswith("#") or line.startswith("[mod"):
362 if line.startswith("P"):
363 vectors.append({'p': int(line.split("=")[1], 16)})
364 elif line.startswith("Q"):
365 vectors[-1]['q'] = int(line.split("=")[1], 16)
366 elif line.startswith("G"):
367 vectors[-1]['g'] = int(line.split("=")[1], 16)
368 elif line.startswith("X") and 'x' not in vectors[-1]:
369 vectors[-1]['x'] = int(line.split("=")[1], 16)
370 elif line.startswith("X") and 'x' in vectors[-1]:
374 'x': int(line.split("=")[1], 16)
376 elif line.startswith("Y"):
377 vectors[-1]['y'] = int(line.split("=")[1], 16)
391 for line in vector_data:
392 line = line.strip()
394 if not line or line.startswith("#"):
397 sha_match = sha_regex.match(line)
401 if line.startswith("[mod"):
404 name, value = [c.strip() for c in line.split("=")]
467 for line in vector_data:
468 line = line.strip()
470 if not line or line.startswith("#"):
473 if line[1:-1] in _ECDSA_CURVE_NAMES:
474 curve_name = _ECDSA_CURVE_NAMES[line[1:-1]]
476 elif line.startswith("d = "):
482 "d": int(line.split("=")[1], 16)
486 if line.startswith("Qx = "):
487 key_data["x"] = int(line.split("=")[1], 16)
488 elif line.startswith("Qy = "):
489 key_data["y"] = int(line.split("=")[1], 16)
508 for line in vector_data:
509 line = line.strip()
511 curve_match = curve_rx.match(line)
516 elif line.startswith("Msg = "):
520 hexmsg = line.split("=")[1].strip().encode("ascii")
529 if line.startswith("Qx = "):
530 data["x"] = int(line.split("=")[1], 16)
531 elif line.startswith("Qy = "):
532 data["y"] = int(line.split("=")[1], 16)
533 elif line.startswith("R = "):
534 data["r"] = int(line.split("=")[1], 16)
535 elif line.startswith("S = "):
536 data["s"] = int(line.split("=")[1], 16)
537 elif line.startswith("d = "):
538 data["d"] = int(line.split("=")[1], 16)
539 elif line.startswith("Result = "):
540 data["fail"] = line.split("=")[1].strip()[0] == "F"
560 for line in vector_data:
561 line = line.strip()
563 if not line or line.startswith("#"):
566 if line.startswith("P = "):
567 data["p"] = int(line.split("=")[1], 16)
568 elif line.startswith("Q = "):
569 data["q"] = int(line.split("=")[1], 16)
570 elif line.startswith("G = "):
571 data["g"] = int(line.split("=")[1], 16)
572 elif line.startswith("Z = "):
573 z_hex = line.split("=")[1].strip().encode("ascii")
575 elif line.startswith("XstatCAVS = "):
576 data["x1"] = int(line.split("=")[1], 16)
577 elif line.startswith("YstatCAVS = "):
578 data["y1"] = int(line.split("=")[1], 16)
579 elif line.startswith("XstatIUT = "):
580 data["x2"] = int(line.split("=")[1], 16)
581 elif line.startswith("YstatIUT = "):
582 data["y2"] = int(line.split("=")[1], 16)
583 elif line.startswith("Result = "):
584 result_str = line.split("=")[1].strip()
626 for line in vector_data:
627 line = line.strip()
629 if line.startswith("#"):
630 parm = line.split("Parameter set(s) supported:")
640 for line in vector_data:
641 line = line.strip()
643 if not line or line.startswith("#"):
646 if line in tags:
647 tag = line
649 elif line.startswith("[Curve selected:"):
650 curve = curve_name_map[line.split(':')[1].strip()[:-1]]
664 for line in vector_data:
665 line = line.strip()
667 if not line or line.startswith("#"):
670 if line.startswith("["):
671 tag = line.split()[0][1:]
672 elif line.startswith("COUNT = "):
673 data["COUNT"] = int(line.split("=")[1])
674 elif line.startswith("dsCAVS = "):
675 data["CAVS"]["d"] = int(line.split("=")[1], 16)
676 elif line.startswith("QsCAVSx = "):
677 data["CAVS"]["x"] = int(line.split("=")[1], 16)
678 elif line.startswith("QsCAVSy = "):
679 data["CAVS"]["y"] = int(line.split("=")[1], 16)
680 elif line.startswith("dsIUT = "):
681 data["IUT"]["d"] = int(line.split("=")[1], 16)
682 elif line.startswith("QsIUTx = "):
683 data["IUT"]["x"] = int(line.split("=")[1], 16)
684 elif line.startswith("QsIUTy = "):
685 data["IUT"]["y"] = int(line.split("=")[1], 16)
686 elif line.startswith("OI = "):
687 data["OI"] = int(line.split("=")[1], 16)
688 elif line.startswith("Z = "):
689 data["Z"] = int(line.split("=")[1], 16)
690 elif line.startswith("DKM = "):
691 data["DKM"] = int(line.split("=")[1], 16)
692 elif line.startswith("Result = "):
693 result_str = line.split("=")[1].strip()
724 for line in vector_data:
725 line = line.strip()
727 if line.startswith("[SHA"):
728 hashname = line[1:-1]
732 elif line.startswith("[shared secret length"):
733 shared_secret_len = int(line[1:-1].split("=")[1].strip())
734 elif line.startswith("[SharedInfo length"):
735 shared_info_len = int(line[1:-1].split("=")[1].strip())
736 elif line.startswith("[key data length"):
737 key_data_len = int(line[1:-1].split("=")[1].strip())
738 elif line.startswith("COUNT"):
739 count = int(line.split("=")[1].strip())
745 elif line.startswith("Z"):
746 vector["Z"] = line.split("=")[1].strip()
748 elif line.startswith("SharedInfo"):
750 vector["sharedinfo"] = line.split("=")[1].strip()
753 elif line.startswith("key_data"):
754 vector["key_data"] = line.split("=")[1].strip()
770 for line in vector_data:
771 line = line.strip()
773 if not line or line.startswith("#"):
776 if line.startswith("[") and line.endswith("]"):
777 tag_data = line[1:-1]
785 elif line.startswith("COUNT="):
789 elif line.startswith("L"):
790 name, value = [c.strip() for c in line.split("=")]
793 name, value = [c.strip() for c in line.split("=")]
801 for line in vector_data:
802 secret_key, public_key, message, signature, _ = line.split(':')
823 for line in vector_data:
824 line = line.strip()
827 if not line or line.startswith("#"):
832 if line.startswith(("Alen", "Plen", "Nlen", "Tlen")):
833 name, value = [c.strip() for c in line.split("=")]
838 if line.startswith("["):
841 section = line[1:-1]
848 name, value = [c.strip() for c in line.split("=")]