@@ -2359,7 +2359,20 @@ public ResponseAPDU importWrappedKey() {
23592359 (short ) wrappingKeyBlob .length )); // Wrapping Key KeyBlob
23602360 KMArray .cast (arr ).add ((short ) 2 , KMByteBlob .instance (maskingKey , (short ) 0 ,
23612361 (short ) maskingKey .length )); // Masking Key
2362- KMArray .cast (arr ).add ((short ) 3 , nullParams ); // unwrapping params
2362+ // RSA OAEP Padding
2363+ short paddingBlob = KMByteBlob .instance ((short ) 1 );
2364+ KMByteBlob .cast (paddingBlob ).add ((short ) 0 , KMType .RSA_OAEP );
2365+ short padding = KMEnumArrayTag .instance (KMType .PADDING , paddingBlob );
2366+ // Unwrapping params should have Digest: SHA256 and padding as RSA_OAEP
2367+ short unwrappingParamsArr = KMArray .instance ((short ) 2 );
2368+ // SHA256 digest
2369+ short digestBlob = KMByteBlob .instance ((short ) 1 );
2370+ KMByteBlob .cast (digestBlob ).add ((short ) 0 , KMType .SHA2_256 );
2371+ short digest = KMEnumArrayTag .instance (KMType .DIGEST , digestBlob );
2372+ KMArray .cast (unwrappingParamsArr ).add ((short ) 0 , padding );
2373+ KMArray .cast (unwrappingParamsArr ).add ((short ) 1 , digest );
2374+ short unwrappingParams = KMKeyParameters .instance (unwrappingParamsArr );
2375+ KMArray .cast (arr ).add ((short ) 3 , unwrappingParams ); // unwrapping params
23632376 CommandAPDU apdu = KMTestUtils .encodeApdu (encoder , (byte ) INS_BEGIN_IMPORT_WRAPPED_KEY_CMD ,
23642377 arr );
23652378 ResponseAPDU response = simulator .transmitCommand (apdu );
0 commit comments