| OLD | NEW |
| 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 29 matching lines...) Expand all Loading... |
| 40 WebCryptoKeyTypeSecret, | 40 WebCryptoKeyTypeSecret, |
| 41 WebCryptoKeyTypePublic, | 41 WebCryptoKeyTypePublic, |
| 42 WebCryptoKeyTypePrivate, | 42 WebCryptoKeyTypePrivate, |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 enum WebCryptoKeyUsage { | 45 enum WebCryptoKeyUsage { |
| 46 WebCryptoKeyUsageEncrypt = 1 << 0, | 46 WebCryptoKeyUsageEncrypt = 1 << 0, |
| 47 WebCryptoKeyUsageDecrypt = 1 << 1, | 47 WebCryptoKeyUsageDecrypt = 1 << 1, |
| 48 WebCryptoKeyUsageSign = 1 << 2, | 48 WebCryptoKeyUsageSign = 1 << 2, |
| 49 WebCryptoKeyUsageVerify = 1 << 3, | 49 WebCryptoKeyUsageVerify = 1 << 3, |
| 50 WebCryptoKeyUsageDerive = 1 << 4, | 50 WebCryptoKeyUsageDeriveKey = 1 << 4, |
| 51 WebCryptoKeyUsageWrap = 1 << 5, | 51 WebCryptoKeyUsageWrapKey = 1 << 5, |
| 52 WebCryptoKeyUsageUnwrap = 1 << 6, | 52 WebCryptoKeyUsageUnwrapKey = 1 << 6, |
| 53 #if WEBKIT_IMPLEMENTATION | 53 #if WEBKIT_IMPLEMENTATION |
| 54 EndOfWebCryptoKeyUsage, | 54 EndOfWebCryptoKeyUsage, |
| 55 #endif | 55 #endif |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // A bitfield of WebCryptoKeyUsage | 58 // A bitfield of WebCryptoKeyUsage |
| 59 typedef int WebCryptoKeyUsageMask; | 59 typedef int WebCryptoKeyUsageMask; |
| 60 | 60 |
| 61 class WebCryptoAlgorithm; | 61 class WebCryptoAlgorithm; |
| 62 class WebCryptoKeyPrivate; | 62 class WebCryptoKeyPrivate; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 WEBKIT_EXPORT static WebCryptoKey create(WebCryptoKeyHandle*, WebCryptoKeyTy
pe, bool extractable, const WebCryptoAlgorithm&, WebCryptoKeyUsageMask); | 99 WEBKIT_EXPORT static WebCryptoKey create(WebCryptoKeyHandle*, WebCryptoKeyTy
pe, bool extractable, const WebCryptoAlgorithm&, WebCryptoKeyUsageMask); |
| 100 | 100 |
| 101 // Returns the opaque key handle that was set by the embedder. | 101 // Returns the opaque key handle that was set by the embedder. |
| 102 // * Safe to downcast to known type (since embedder creates all the keys) | 102 // * Safe to downcast to known type (since embedder creates all the keys) |
| 103 // * Returned pointer's lifetime is bound to |this| | 103 // * Returned pointer's lifetime is bound to |this| |
| 104 WEBKIT_EXPORT WebCryptoKeyHandle* handle() const; | 104 WEBKIT_EXPORT WebCryptoKeyHandle* handle() const; |
| 105 | 105 |
| 106 WEBKIT_EXPORT WebCryptoKeyType type() const; | 106 WEBKIT_EXPORT WebCryptoKeyType type() const; |
| 107 WEBKIT_EXPORT bool extractable() const; | 107 WEBKIT_EXPORT bool extractable() const; |
| 108 WEBKIT_EXPORT const WebCryptoAlgorithm& algorithm() const; | 108 WEBKIT_EXPORT const WebCryptoAlgorithm& algorithm() const; |
| 109 WEBKIT_EXPORT WebCryptoKeyUsageMask keyUsage() const; | 109 WEBKIT_EXPORT WebCryptoKeyUsageMask usages() const; |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 WebCryptoKey() { } | 112 WebCryptoKey() { } |
| 113 WEBKIT_EXPORT void assign(const WebCryptoKey& other); | 113 WEBKIT_EXPORT void assign(const WebCryptoKey& other); |
| 114 WEBKIT_EXPORT void reset(); | 114 WEBKIT_EXPORT void reset(); |
| 115 | 115 |
| 116 WebPrivatePtr<WebCryptoKeyPrivate> m_private; | 116 WebPrivatePtr<WebCryptoKeyPrivate> m_private; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 // Base class for the embedder to define its own opaque key handle. The lifetime | 119 // Base class for the embedder to define its own opaque key handle. The lifetime |
| 120 // of this object is controlled by WebCryptoKey using reference counting. | 120 // of this object is controlled by WebCryptoKey using reference counting. |
| 121 class WebCryptoKeyHandle { | 121 class WebCryptoKeyHandle { |
| 122 public: | 122 public: |
| 123 virtual ~WebCryptoKeyHandle() { } | 123 virtual ~WebCryptoKeyHandle() { } |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 } // namespace WebKit | 126 } // namespace WebKit |
| 127 | 127 |
| 128 #endif | 128 #endif |
| OLD | NEW |