# Path: gmeutils/password.py
# def pw_verify(password,pwhash,parent=None):
# 	"""
# 	compares the password with an already hashed password
# 	returns True if password is correct, else False
# 	"""
# 	result=False
# 
# 	try:
# 		result=pwd_context.verify(password,pwhash)
# 	except:
# 
# 		if parent:
# 			parent.log("pw_verify error","e")
# 			parent.log_traceback()
# 
# 	return result
# 
# def _deprecated_get_hash(txt):
# 	i=0
# 	r=txt
# 
# 	while i<=1000:
# 		r=hashlib.sha512(r.encode("UTF-8",unicodeerror)).hexdigest()
# 		i+=1
# 
# 	return r


import asynchat
import asyncore
import binascii
import datetime
import inspect
import os
import select
import smtpd
import socket
import ssl
import sys
from	.version		import *
from .password        import pw_verify,_deprecated_get_hash
							data):
		self.parent.debug("_gpgmailencryptserver "
						"from '%s' to '%s'"%(mailfrom,recipient),filename=__file__,lineno=inspect.currentframe().f_lineno)

		try:
			self.parent.send_mails(data,recipient)
		except:
			self.parent.log("Bug:Exception!",filename=__file__,lineno=inspect.currentframe().f_lineno)
			self.parent.log_traceback()

		return


	#############
	#authenticate
	#############

	def authenticate(  self,
					user,
					password):
		"checks user authentication against a password file"
		self.parent.debug("authenticate",filename=__file__,lineno=inspect.currentframe().f_lineno)
		pw=self.parent.adm_get_pwhash(user)

		if pw==_deprecated_get_hash(password):

			self.parent.debug("mailencryptserver: User '%s' with deprecated password hash algorithm authenticated"%user,filename=__file__,lineno=inspect.currentframe().f_lineno)
			self.parent.adm_set_user(user,password)
			pw=self.parent.adm_get_pwhash(user)


# Path: gmeutils/password.py
# def pw_verify(password,pwhash,parent=None):
# 	"""
# 	compares the password with an already hashed password
# 	returns True if password is correct, else False
# 	"""
# 	result=False
# 
# 	try:
# 		result=pwd_context.verify(password,pwhash)
# 	except:
# 
# 		if parent:
# 			parent.log("pw_verify error","e")
# 			parent.log_traceback()
# 
# 	return result
# 
# def _deprecated_get_hash(txt):
# 	i=0
# 	r=txt
# 
# 	while i<=1000:
# 		r=hashlib.sha512(r.encode("UTF-8",unicodeerror)).hexdigest()
# 		i+=1
# 
# 	return r


# Path: gmeutils/gpgmailserver.py
import asynchat
import asyncore
import binascii
import datetime
import inspect
import os
import select
import smtpd
import socket
import ssl
import sys
from	.version		import *
from .password        import pw_verify,_deprecated_get_hash

							data):
		self.parent.debug("_gpgmailencryptserver "
						"from '%s' to '%s'"%(mailfrom,recipient),filename=__file__,lineno=inspect.currentframe().f_lineno)

		try:
			self.parent.send_mails(data,recipient)
		except:
			self.parent.log("Bug:Exception!",filename=__file__,lineno=inspect.currentframe().f_lineno)
			self.parent.log_traceback()

		return


	#############
	#authenticate
	#############

	def authenticate(  self,
					user,
					password):
		"checks user authentication against a password file"
		self.parent.debug("authenticate",filename=__file__,lineno=inspect.currentframe().f_lineno)
		pw=self.parent.adm_get_pwhash(user)

		if pw==_deprecated_get_hash(password):

			self.parent.debug("mailencryptserver: User '%s' with deprecated password hash algorithm authenticated"%user,filename=__file__,lineno=inspect.currentframe().f_lineno)
			self.parent.adm_set_user(user,password)
			pw=self.parent.adm_get_pwhash(user)


		if pw_verify(password,pw,parent=self.parent):