1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_WEBCRYPTO_GENERATE_KEY_RESULT_H_
6 #define COMPONENTS_WEBCRYPTO_GENERATE_KEY_RESULT_H_
8 #include "third_party/WebKit/public/platform/WebCrypto.h"
12 // This is the result object when generating keys. It encapsulates either a
13 // secret key, or a public/private key pair.
14 class GenerateKeyResult
{
17 // An empty (or "null") result.
20 // The result is a secret key, accessible through secret_key()
23 // The result is a public/private key pair, accessible through public_key()
25 TYPE_PUBLIC_PRIVATE_KEY_PAIR
28 // Initializes a "null" instance.
33 const blink::WebCryptoKey
& secret_key() const;
34 const blink::WebCryptoKey
& public_key() const;
35 const blink::WebCryptoKey
& private_key() const;
37 void AssignSecretKey(const blink::WebCryptoKey
& key
);
38 void AssignKeyPair(const blink::WebCryptoKey
& public_key
,
39 const blink::WebCryptoKey
& private_key
);
41 // Sends the key(s) to the Blink result. Should not be called for "null"
43 void Complete(blink::WebCryptoResult
* out
) const;
48 blink::WebCryptoKey secret_key_
;
49 blink::WebCryptoKey public_key_
;
50 blink::WebCryptoKey private_key_
;
53 } // namespace webcrypto
55 #endif // COMPONENTS_WEBCRYPTO_GENERATE_KEY_RESULT_H_