本文整理汇总了Python中Message.Message.createFromValues方法的典型用法代码示例。如果您正苦于以下问题:Python Message.createFromValues方法的具体用法?Python Message.createFromValues怎么用?Python Message.createFromValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message.Message
的用法示例。
在下文中一共展示了Message.createFromValues方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createFromValues
# 需要导入模块: from Message import Message [as 别名]
# 或者: from Message.Message import createFromValues [as 别名]
def createFromValues(self, taskid, ts, hmac, certhash, trace):
# set message type and length (72B for taskid, ts, hmac and
# certhash plus length of traceroute)
Message.createFromValues(self, messageTypes["TASK_REPLY_KNOWN_CERT"], 72 + len(trace))
self.taskid = taskid
self.ts = ts
self.hmac = hmac
self.certhash = certhash
self.trace = trace
示例2: createFromValues
# 需要导入模块: from Message import Message [as 别名]
# 或者: from Message.Message import createFromValues [as 别名]
def createFromValues(self, taskid, ts, hmac, certchain, trace):
# Convert certs to DER
self.certchain = []
for cert in certchain[:min(255,len(certchain))]:
self.certchain.append(ssl.PEM_cert_to_DER_cert(cert))
certlength = sum(len(x) for x in self.certchain)
# set message type and length ( 41 Bytes for taskid, ts, hmac and number of certificates
# plus length of trace and length of cert chain.
Message.createFromValues(self, messageTypes['TASK_REPLY_NEW_CERT'], 41 + len(trace) + certlength)
self.taskid = taskid
self.ts = ts
self.hmac = hmac
self.trace = trace
示例3: createFromValues
# 需要导入模块: from Message import Message [as 别名]
# 或者: from Message.Message import createFromValues [as 别名]
def createFromValues(self, options, certs, hostname, ip, port):
self.certchain = []
chainlength = 0
for cert in certs:
derobj = ssl.PEM_cert_to_DER_cert(cert)
chainlength += len(derobj)
self.certchain.append(derobj)
Message.createFromValues(self, messageTypes['CERT_VERIFY_REQUEST'], 4 + chainlength + len(hostname) + len(ip) + len(str(port)))
self.options = options
self.hostname = hostname
self.ip = ip
self.port = port
示例4: createFromValues
# 需要导入模块: from Message import Message [as 别名]
# 或者: from Message.Message import createFromValues [as 别名]
def createFromValues(self, data):
Message.createFromValues(self, messageTypes["SIGNATURE"], len(data))
self.data = data