| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 // JsonWebKey dictionary, throw a TypeError. | 450 // JsonWebKey dictionary, throw a TypeError. |
| 451 // | 451 // |
| 452 // (2) Let keyData be the result of getting a copy of the bytes held by | 452 // (2) Let keyData be the result of getting a copy of the bytes held by |
| 453 // the keyData parameter passed to the importKey method. | 453 // the keyData parameter passed to the importKey method. |
| 454 case kWebCryptoKeyFormatRaw: | 454 case kWebCryptoKeyFormatRaw: |
| 455 case kWebCryptoKeyFormatPkcs8: | 455 case kWebCryptoKeyFormatPkcs8: |
| 456 case kWebCryptoKeyFormatSpki: | 456 case kWebCryptoKeyFormatSpki: |
| 457 if (raw_key_data.isArrayBuffer()) { | 457 if (raw_key_data.isArrayBuffer()) { |
| 458 key_data = CopyBytes(raw_key_data.getAsArrayBuffer()); | 458 key_data = CopyBytes(raw_key_data.getAsArrayBuffer()); |
| 459 } else if (raw_key_data.isArrayBufferView()) { | 459 } else if (raw_key_data.isArrayBufferView()) { |
| 460 key_data = CopyBytes(raw_key_data.getAsArrayBufferView().View()); | 460 key_data = CopyBytes(raw_key_data.getAsArrayBufferView()); |
| 461 } else { | 461 } else { |
| 462 result->CompleteWithError( | 462 result->CompleteWithError( |
| 463 kWebCryptoErrorTypeType, | 463 kWebCryptoErrorTypeType, |
| 464 "Key data must be a BufferSource for non-JWK formats"); | 464 "Key data must be a BufferSource for non-JWK formats"); |
| 465 return promise; | 465 return promise; |
| 466 } | 466 } |
| 467 break; | 467 break; |
| 468 // 14.3.9.2: If format is equal to the string "jwk": | 468 // 14.3.9.2: If format is equal to the string "jwk": |
| 469 // | 469 // |
| 470 // (1) If the keyData parameter passed to the importKey method is not a | 470 // (1) If the keyData parameter passed to the importKey method is not a |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 normalized_algorithm, base_key->Key()); | 776 normalized_algorithm, base_key->Key()); |
| 777 HistogramAlgorithm(script_state->GetExecutionContext(), | 777 HistogramAlgorithm(script_state->GetExecutionContext(), |
| 778 normalized_derived_key_algorithm); | 778 normalized_derived_key_algorithm); |
| 779 Platform::Current()->Crypto()->DeriveKey( | 779 Platform::Current()->Crypto()->DeriveKey( |
| 780 normalized_algorithm, base_key->Key(), normalized_derived_key_algorithm, | 780 normalized_algorithm, base_key->Key(), normalized_derived_key_algorithm, |
| 781 key_length_algorithm, extractable, key_usages, result->Result()); | 781 key_length_algorithm, extractable, key_usages, result->Result()); |
| 782 return promise; | 782 return promise; |
| 783 } | 783 } |
| 784 | 784 |
| 785 } // namespace blink | 785 } // namespace blink |
| OLD | NEW |