def dePem(s, name):
 prefix = ('-----BEGIN %s-----' % name)
 postfix = ('-----END %s-----' % name)
 start = s.find(prefix)
 if (start == (-1)):
  raise SyntaxError('Missing PEM prefix')
 end = s.find(postfix, (start + len(prefix)))
 if (end == (-1)):
  raise SyntaxError('Missing PEM postfix')
 s = s[(start + len(('-----BEGIN %s-----' % name))):end]
 retBytes = a2b_base64(s)
 return retBytes

def dePem ( s , name ) : prefix = ( '-----BEGIN %s-----' % name ) postfix = ( '-----END %s-----' % name ) start = s . find ( prefix ) if ( start == ( - 1 ) ) : raise SyntaxError ( 'Missing PEM prefix' ) end = s . find ( postfix , ( start + len ( prefix ) ) ) if ( end == ( - 1 ) ) : raise SyntaxError ( 'Missing PEM postfix' ) s = s [ ( start + len ( ( '-----BEGIN %s-----' % name ) ) ) : end ] retBytes = a2b_base64 ( s ) return retBytes
decode a pem string into a bytearray of its payload .