Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: public/platform/WebCryptoKey.h

Issue 179353002: [webcrypto] Add the KeyAlgorithm interface. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase yet again (another conflict) Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « public/platform/WebCryptoAlgorithmParams.h ('k') | public/platform/WebCryptoKeyAlgorithm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // A bitfield of WebCryptoKeyUsage 58 // A bitfield of WebCryptoKeyUsage
59 typedef int WebCryptoKeyUsageMask; 59 typedef int WebCryptoKeyUsageMask;
60 60
61 enum WebCryptoKeyFormat { 61 enum WebCryptoKeyFormat {
62 WebCryptoKeyFormatRaw, 62 WebCryptoKeyFormatRaw,
63 WebCryptoKeyFormatPkcs8, 63 WebCryptoKeyFormatPkcs8,
64 WebCryptoKeyFormatSpki, 64 WebCryptoKeyFormatSpki,
65 WebCryptoKeyFormatJwk, 65 WebCryptoKeyFormatJwk,
66 }; 66 };
67 67
68 class WebCryptoAlgorithm; 68 class WebCryptoKeyAlgorithm;
69 class WebCryptoKeyPrivate; 69 class WebCryptoKeyPrivate;
70 class WebCryptoKeyHandle; 70 class WebCryptoKeyHandle;
71 71
72 // The WebCryptoKey represents a key from the Web Crypto API: 72 // The WebCryptoKey represents a key from the Web Crypto API:
73 // 73 //
74 // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#key-inte rface 74 // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#key-inte rface
75 // 75 //
76 // WebCryptoKey is just a reference-counted wrapper that manages the lifetime of 76 // WebCryptoKey is just a reference-counted wrapper that manages the lifetime of
77 // a "WebCryptoKeyHandle*". 77 // a "WebCryptoKeyHandle*".
78 // 78 //
(...skipping 20 matching lines...) Expand all
99 WebCryptoKey& operator=(const WebCryptoKey& other) 99 WebCryptoKey& operator=(const WebCryptoKey& other)
100 { 100 {
101 assign(other); 101 assign(other);
102 return *this; 102 return *this;
103 } 103 }
104 104
105 // For an explanation of these parameters see: 105 // For an explanation of these parameters see:
106 // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#key- interface-members 106 // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#key- interface-members
107 // 107 //
108 // Note that the caller is passing ownership of the WebCryptoKeyHandle*. 108 // Note that the caller is passing ownership of the WebCryptoKeyHandle*.
109 BLINK_PLATFORM_EXPORT static WebCryptoKey create(WebCryptoKeyHandle*, WebCry ptoKeyType, bool extractable, const WebCryptoAlgorithm&, WebCryptoKeyUsageMask); 109 BLINK_PLATFORM_EXPORT static WebCryptoKey create(WebCryptoKeyHandle*, WebCry ptoKeyType, bool extractable, const WebCryptoKeyAlgorithm&, WebCryptoKeyUsageMas k);
110 110
111 BLINK_PLATFORM_EXPORT static WebCryptoKey createNull(); 111 BLINK_PLATFORM_EXPORT static WebCryptoKey createNull();
112 112
113 // Returns the opaque key handle that was set by the embedder. 113 // Returns the opaque key handle that was set by the embedder.
114 // * Safe to downcast to known type (since embedder creates all the keys) 114 // * Safe to downcast to known type (since embedder creates all the keys)
115 // * Returned pointer's lifetime is bound to |this| 115 // * Returned pointer's lifetime is bound to |this|
116 BLINK_PLATFORM_EXPORT WebCryptoKeyHandle* handle() const; 116 BLINK_PLATFORM_EXPORT WebCryptoKeyHandle* handle() const;
117 117
118 BLINK_PLATFORM_EXPORT WebCryptoKeyType type() const; 118 BLINK_PLATFORM_EXPORT WebCryptoKeyType type() const;
119 BLINK_PLATFORM_EXPORT bool extractable() const; 119 BLINK_PLATFORM_EXPORT bool extractable() const;
120 BLINK_PLATFORM_EXPORT const WebCryptoAlgorithm& algorithm() const; 120 BLINK_PLATFORM_EXPORT const WebCryptoKeyAlgorithm& algorithm() const;
121 BLINK_PLATFORM_EXPORT WebCryptoKeyUsageMask usages() const; 121 BLINK_PLATFORM_EXPORT WebCryptoKeyUsageMask usages() const;
122 122
123 BLINK_PLATFORM_EXPORT bool isNull() const; 123 BLINK_PLATFORM_EXPORT bool isNull() const;
124 124
125 private: 125 private:
126 WebCryptoKey() { } 126 WebCryptoKey() { }
127 BLINK_PLATFORM_EXPORT void assign(const WebCryptoKey& other); 127 BLINK_PLATFORM_EXPORT void assign(const WebCryptoKey& other);
128 BLINK_PLATFORM_EXPORT void reset(); 128 BLINK_PLATFORM_EXPORT void reset();
129 129
130 WebPrivatePtr<WebCryptoKeyPrivate> m_private; 130 WebPrivatePtr<WebCryptoKeyPrivate> m_private;
131 }; 131 };
132 132
133 // Base class for the embedder to define its own opaque key handle. The lifetime 133 // Base class for the embedder to define its own opaque key handle. The lifetime
134 // of this object is controlled by WebCryptoKey using reference counting. 134 // of this object is controlled by WebCryptoKey using reference counting.
135 class WebCryptoKeyHandle { 135 class WebCryptoKeyHandle {
136 public: 136 public:
137 virtual ~WebCryptoKeyHandle() { } 137 virtual ~WebCryptoKeyHandle() { }
138 }; 138 };
139 139
140 } // namespace blink 140 } // namespace blink
141 141
142 #endif 142 #endif
OLDNEW
« no previous file with comments | « public/platform/WebCryptoAlgorithmParams.h ('k') | public/platform/WebCryptoKeyAlgorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698