(self, oid)
| 1524 | self.chksum = bytearray(self.int_to_bytes(chs, 2)) |
| 1525 | |
| 1526 | def _generate(self, oid): |
| 1527 | if any(c != 0 for c in self): # pragma: no cover |
| 1528 | raise PGPError("Key is already populated!") |
| 1529 | |
| 1530 | self.oid = EllipticCurveOID(oid) |
| 1531 | |
| 1532 | if self.oid != EllipticCurveOID.Ed25519: |
| 1533 | raise ValueError("EdDSA only supported with {}".format(EllipticCurveOID.Ed25519)) |
| 1534 | |
| 1535 | pk = ed25519.Ed25519PrivateKey.generate() |
| 1536 | x = pk.public_key().public_bytes(encoding=serialization.Encoding.Raw, format=serialization.PublicFormat.Raw) |
| 1537 | self.p = ECPoint.from_values(self.oid.key_size, ECPointFormat.Native, x) |
| 1538 | self.s = MPI(self.bytes_to_int(pk.private_bytes( |
| 1539 | encoding=serialization.Encoding.Raw, |
| 1540 | format=serialization.PrivateFormat.Raw, |
| 1541 | encryption_algorithm=serialization.NoEncryption() |
| 1542 | ))) |
| 1543 | self._compute_chksum() |
| 1544 | |
| 1545 | def parse(self, packet): |
| 1546 | super(EdDSAPriv, self).parse(packet) |
nothing calls this directly
no test coverage detected