(self, s, curve, pkalg, fingerprint)
| 1122 | del packet[0] |
| 1123 | |
| 1124 | def derive_key(self, s, curve, pkalg, fingerprint): |
| 1125 | # wrapper around the Concatenation KDF method provided by cryptography |
| 1126 | # assemble the additional data as defined in RFC 6637: |
| 1127 | # Param = curve_OID_len || curve_OID || public_key_alg_ID || 03 || 01 || KDF_hash_ID || KEK_alg_ID for AESKeyWrap || "Anonymous |
| 1128 | data = bytearray() |
| 1129 | data += encoder.encode(curve.value)[1:] |
| 1130 | data.append(pkalg) |
| 1131 | data += b'\x03\x01' |
| 1132 | data.append(self.halg) |
| 1133 | data.append(self.encalg) |
| 1134 | data += b'Anonymous Sender ' |
| 1135 | data += binascii.unhexlify(fingerprint.replace(' ', '')) |
| 1136 | |
| 1137 | ckdf = ConcatKDFHash(algorithm=getattr(hashes, self.halg.name)(), length=self.encalg.key_size // 8, otherinfo=bytes(data), backend=default_backend()) |
| 1138 | return ckdf.derive(s) |
| 1139 | |
| 1140 | |
| 1141 | class PrivKey(PubKey): |
no outgoing calls
no test coverage detected