| Index: content/child/webcrypto/generate_key_result.h
|
| diff --git a/content/child/webcrypto/generate_key_result.h b/content/child/webcrypto/generate_key_result.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fcc13f808555c3086d4cf7f0d0331cb418475710
|
| --- /dev/null
|
| +++ b/content/child/webcrypto/generate_key_result.h
|
| @@ -0,0 +1,60 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_CHILD_WEBCRYPTO_GENERATE_KEY_RESULT_H_
|
| +#define CONTENT_CHILD_WEBCRYPTO_GENERATE_KEY_RESULT_H_
|
| +
|
| +#include "content/common/content_export.h"
|
| +#include "third_party/WebKit/public/platform/WebCrypto.h"
|
| +
|
| +namespace content {
|
| +
|
| +namespace webcrypto {
|
| +
|
| +// This is the result object when generating keys. It encapsulates either a
|
| +// secret key, or a public/private key pair.
|
| +class CONTENT_EXPORT GenerateKeyResult {
|
| + public:
|
| + enum Type {
|
| + // An empty (or "null") result.
|
| + TYPE_NULL,
|
| +
|
| + // The result is a secret key, accessible through secret_key()
|
| + TYPE_SECRET_KEY,
|
| +
|
| + // The result is a public/private key pair, accessible through public_key()
|
| + // and private_key()
|
| + TYPE_PUBLIC_PRIVATE_KEY_PAIR
|
| + };
|
| +
|
| + // Initializes a "null" instance.
|
| + GenerateKeyResult();
|
| +
|
| + Type type() const;
|
| +
|
| + const blink::WebCryptoKey& secret_key() const;
|
| + const blink::WebCryptoKey& public_key() const;
|
| + const blink::WebCryptoKey& private_key() const;
|
| +
|
| + void AssignSecretKey(const blink::WebCryptoKey& key);
|
| + void AssignKeyPair(const blink::WebCryptoKey& public_key,
|
| + const blink::WebCryptoKey& private_key);
|
| +
|
| + // Sends the key(s) to the Blink result. Should not be called for "null"
|
| + // results.
|
| + void Complete(blink::WebCryptoResult* out) const;
|
| +
|
| + private:
|
| + Type type_;
|
| +
|
| + blink::WebCryptoKey secret_key_;
|
| + blink::WebCryptoKey public_key_;
|
| + blink::WebCryptoKey private_key_;
|
| +};
|
| +
|
| +} // namespace webcrypto
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_CHILD_WEBCRYPTO_GENERATE_KEY_RESULT_H_
|
|
|