MCPcopy Create free account
hub / github.com/secdev/scapy / encrypt

Method encrypt

scapy/layers/kerberos.py:465–480  ·  view source on GitHub ↗

Encrypt text and set it into cipher. :param key: the key to use for encryption :param text: the bytes value to encode :param confounder: (optional) specify the confounder bytes. Random otherwise :param key_usage_number: (optional) specify the key usage numbe

(self, key, text, confounder=None, key_usage_number=None)

Source from the content-addressed store, hash-verified

463 return d
464
465 def encrypt(self, key, text, confounder=None, key_usage_number=None):
466 """
467 Encrypt text and set it into cipher.
468
469 :param key: the key to use for encryption
470 :param text: the bytes value to encode
471 :param confounder: (optional) specify the confounder bytes. Random otherwise
472 :param key_usage_number: (optional) specify the key usage number.
473 Guessed otherwise
474 """
475 if key_usage_number is None:
476 key_usage_number = self.get_usage()[0]
477 self.etype = key.etype
478 self.cipher = ASN1_STRING(
479 key.encrypt(key_usage_number, text, confounder=confounder)
480 )
481
482
483class EncryptionKey(ASN1_Packet):

Callers 7

_fast_wrapMethod · 0.45
as_reqMethod · 0.45
tgs_reqMethod · 0.45
kpasswdFunction · 0.45
GSS_WrapExMethod · 0.45
GSS_Init_sec_contextMethod · 0.45

Calls 2

get_usageMethod · 0.95
ASN1_STRINGClass · 0.90

Tested by

no test coverage detected