#NEWLINE# def do_key_rollover( self , jwks , kid_template ) : #NEWLINE# #INDENT# '\n        Handle key roll-over by importing new keys and inactivating the\n        ones in the keyjar that are of the same type and usage.\n\n        :param jwks: A JWKS\n        :param kid_template: Key ID template\n        ' #NEWLINE# kb = KeyBundle ( ) #NEWLINE# kb . do_keys ( jwks [ 'keys' ] ) #NEWLINE# kid = 0 #NEWLINE# for k in kb . keys ( ) : #NEWLINE# #INDENT# if ( not kid . kid ) : #NEWLINE# #INDENT# k . kid = ( kid_template % kid ) #NEWLINE# kid += 1 #NEWLINE# #UNINDENT# self . kid [ k . use ] [ k . kty ] = k . kid #NEWLINE# for _kb in self . keyjar . issuer_keys [ '' ] : #NEWLINE# #INDENT# for key in _kb . keys ( ) : #NEWLINE# #INDENT# if ( ( key . kty == k . kty ) and ( key . use == k . use ) ) : #NEWLINE# #INDENT# if ( k . kty == 'EC' ) : #NEWLINE# #INDENT# if ( key . crv == k . crv ) : #NEWLINE# #INDENT# key . inactive_since = time . time ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# key . inactive_since = time . time ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# self . keyjar . add_kb ( '' , kb ) #NEWLINE# if self . jwks_name : #NEWLINE# #INDENT# dump_jwks ( self . keyjar [ '' ] , self . jwks_name )