def get_boulder_header(key_bytes):
 (pub_hex, pub_exp) = re.search('modulus:\\n\\s+00:([a-f0-9\\:\\s]+?)\\npublicExponent: ([0-9]+)', key_bytes.decode('utf8'), (re.MULTILINE | re.DOTALL)).groups()
 pub_exp = '{0:x}'.format(int(pub_exp))
 pub_exp = ('0{0}'.format(pub_exp) if (len(pub_exp) % 2) else pub_exp)
 header = {'alg': 'RS256', 'jwk': {'e': _b64(binascii.unhexlify(pub_exp.encode('utf-8'))), 'kty': 'RSA', 'n': _b64(binascii.unhexlify(re.sub('(\\s|:)', '', pub_hex).encode('utf-8')))}}
 return header

def get_boulder_header ( key_bytes ) : ( pub_hex , pub_exp ) = re . search ( 'modulus:\\n\\s+00:([a-f0-9\\:\\s]+?)\\npublicExponent: ([0-9]+)' , key_bytes . decode ( 'utf8' ) , ( re . MULTILINE | re . DOTALL ) ) . groups ( ) pub_exp = '{0:x}' . format ( int ( pub_exp ) ) pub_exp = ( '0{0}' . format ( pub_exp ) if ( len ( pub_exp ) % 2 ) else pub_exp ) header = { 'alg' : 'RS256' , 'jwk' : { 'e' : _b64 ( binascii . unhexlify ( pub_exp . encode ( 'utf-8' ) ) ) , 'kty' : 'RSA' , 'n' : _b64 ( binascii . unhexlify ( re . sub ( '(\\s|:)' , '' , pub_hex ) . encode ( 'utf-8' ) ) ) } } return header
use regular expressions to find crypto values from parsed account key .