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 CONTENT_CHILD_WEBCRYPTO_GENERATE_KEY_RESULT_H_
6 #define CONTENT_CHILD_WEBCRYPTO_GENERATE_KEY_RESULT_H_
8 #include "content/common/content_export.h"
9 #include "third_party/WebKit/public/platform/WebCrypto.h"
15 // This is the result object when generating keys. It encapsulates either a
16 // secret key, or a public/private key pair.
17 class CONTENT_EXPORT GenerateKeyResult
{
20 // An empty (or "null") result.
23 // The result is a secret key, accessible through secret_key()
26 // The result is a public/private key pair, accessible through public_key()
28 TYPE_PUBLIC_PRIVATE_KEY_PAIR
31 // Initializes a "null" instance.
36 const blink::WebCryptoKey
& secret_key() const;
37 const blink::WebCryptoKey
& public_key() const;
38 const blink::WebCryptoKey
& private_key() const;
40 void AssignSecretKey(const blink::WebCryptoKey
& key
);
41 void AssignKeyPair(const blink::WebCryptoKey
& public_key
,
42 const blink::WebCryptoKey
& private_key
);
44 // Sends the key(s) to the Blink result. Should not be called for "null"
46 void Complete(blink::WebCryptoResult
* out
) const;
51 blink::WebCryptoKey secret_key_
;
52 blink::WebCryptoKey public_key_
;
53 blink::WebCryptoKey private_key_
;
56 } // namespace webcrypto
58 } // namespace content
60 #endif // CONTENT_CHILD_WEBCRYPTO_GENERATE_KEY_RESULT_H_