OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "bindings/modules/v8/serialization/V8ScriptValueDeserializerForModules.
h" | 5 #include "bindings/modules/v8/serialization/V8ScriptValueDeserializerForModules.
h" |
6 | 6 |
7 #include "bindings/modules/v8/serialization/WebCryptoSubTags.h" | 7 #include "bindings/modules/v8/serialization/WebCryptoSubTags.h" |
8 #include "modules/crypto/CryptoKey.h" | 8 #include "modules/crypto/CryptoKey.h" |
9 #include "modules/peerconnection/RTCCertificate.h" | 9 #include "modules/peerconnection/RTCCertificate.h" |
10 #include "public/platform/Platform.h" | 10 #include "public/platform/Platform.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 return readCryptoKey(); | 27 return readCryptoKey(); |
28 case RTCCertificateTag: { | 28 case RTCCertificateTag: { |
29 String pemPrivateKey; | 29 String pemPrivateKey; |
30 String pemCertificate; | 30 String pemCertificate; |
31 if (!readUTF8String(&pemPrivateKey) || !readUTF8String(&pemCertificate)) | 31 if (!readUTF8String(&pemPrivateKey) || !readUTF8String(&pemCertificate)) |
32 return nullptr; | 32 return nullptr; |
33 std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator( | 33 std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator( |
34 Platform::current()->createRTCCertificateGenerator()); | 34 Platform::current()->createRTCCertificateGenerator()); |
35 std::unique_ptr<WebRTCCertificate> certificate = | 35 std::unique_ptr<WebRTCCertificate> certificate = |
36 certificateGenerator->fromPEM(pemPrivateKey, pemCertificate); | 36 certificateGenerator->fromPEM(pemPrivateKey, pemCertificate); |
| 37 if (!certificate) |
| 38 return nullptr; |
37 return new RTCCertificate(std::move(certificate)); | 39 return new RTCCertificate(std::move(certificate)); |
38 } | 40 } |
39 default: | 41 default: |
40 break; | 42 break; |
41 } | 43 } |
42 return nullptr; | 44 return nullptr; |
43 } | 45 } |
44 | 46 |
45 namespace { | 47 namespace { |
46 | 48 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 WebCryptoKey key = WebCryptoKey::createNull(); | 262 WebCryptoKey key = WebCryptoKey::createNull(); |
261 if (!Platform::current()->crypto()->deserializeKeyForClone( | 263 if (!Platform::current()->crypto()->deserializeKeyForClone( |
262 algorithm, keyType, extractable, usages, | 264 algorithm, keyType, extractable, usages, |
263 reinterpret_cast<const unsigned char*>(keyData), keyDataLength, key)) | 265 reinterpret_cast<const unsigned char*>(keyData), keyDataLength, key)) |
264 return nullptr; | 266 return nullptr; |
265 | 267 |
266 return CryptoKey::create(key); | 268 return CryptoKey::create(key); |
267 } | 269 } |
268 | 270 |
269 } // namespace blink | 271 } // namespace blink |
OLD | NEW |