@@ -242,22 +242,22 @@ def __init__(self, kty="", alg="", use="", kid="", key=None, x5c=None,
242242 if isinstance (kty , six .string_types ):
243243 self .kty = kty
244244 else :
245- self .kty = kty . decode ( "utf8" )
245+ self .kty = as_unicode ( kty )
246246
247247 if isinstance (alg , six .string_types ):
248248 self .alg = alg
249249 else :
250- self .alg = alg . decode ( "utf8" )
250+ self .alg = as_unicode ( alg )
251251
252252 if isinstance (use , six .string_types ):
253253 self .use = use
254254 else :
255- self .use = use . decode ( "utf8" )
255+ self .use = as_unicode ( use )
256256
257257 if isinstance (kid , six .string_types ):
258258 self .kid = kid
259259 else :
260- self .kid = kid . decode ( "utf8" )
260+ self .kid = as_unicode ( kid )
261261
262262 self .x5c = x5c or []
263263 self .x5t = x5t
@@ -412,6 +412,8 @@ def __init__(self, kty="RSA", alg="", use="", kid="", key=None,
412412 self .deserialize ()
413413 elif self .key and not (self .n and self .e ):
414414 self ._split ()
415+ elif not self .key and not (self .n and self .e ):
416+ raise DeSerializationNotPossible ('Missing required parameter' )
415417
416418 def deserialize (self ):
417419 if self .n and self .e :
@@ -550,8 +552,12 @@ def __init__(self, kty="EC", alg="", use="", kid="", key=None,
550552 if self .crv and not self .curve :
551553 self .verify ()
552554 self .deserialize ()
553- elif self .key and (not self .crv and not self .curve ):
554- self .load_key (key )
555+ elif self .key :
556+ if not self .crv and not self .curve :
557+ self .load_key (key )
558+ else :
559+ if not (self .x and self .y and self .crv ):
560+ raise DeSerializationNotPossible ('Missing required parameter' )
555561
556562 def deserialize (self ):
557563 """
0 commit comments