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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 enum AlgorithmOperation { | 45 enum AlgorithmOperation { |
46 Encrypt, | 46 Encrypt, |
47 Decrypt, | 47 Decrypt, |
48 Sign, | 48 Sign, |
49 Verify, | 49 Verify, |
50 Digest, | 50 Digest, |
51 GenerateKey, | 51 GenerateKey, |
52 ImportKey, | 52 ImportKey, |
53 DeriveKey, | 53 DeriveKey, |
| 54 DeriveBits, |
54 WrapKey, | 55 WrapKey, |
55 UnwrapKey, | 56 UnwrapKey, |
56 // <---- End of list (keep this up-to-date) | 57 // <---- End of list (keep this up-to-date) |
57 LastAlgorithmOperation = UnwrapKey, | 58 LastAlgorithmOperation = UnwrapKey, |
58 }; | 59 }; |
59 | 60 |
60 // Converts a javascript Dictionary to a WebCryptoAlgorithm object. | 61 // Converts a javascript Dictionary to a WebCryptoAlgorithm object. |
61 // | 62 // |
62 // This corresponds with "normalizing" [1] the algorithm, and then validating | 63 // This corresponds with "normalizing" [1] the algorithm, and then validating |
63 // the expected parameters for the algorithm/operation combination. | 64 // the expected parameters for the algorithm/operation combination. |
64 // | 65 // |
65 // On success returns true and sets the WebCryptoAlgorithm. | 66 // On success returns true and sets the WebCryptoAlgorithm. |
66 // | 67 // |
67 // On failure parseAlgorithm returns false and completes the CryptoResult | 68 // On failure parseAlgorithm returns false and completes the CryptoResult |
68 // with a (non-localized) debug string. | 69 // with a (non-localized) debug string. |
69 // | 70 // |
70 // [1] http://www.w3.org/TR/WebCryptoAPI/#algorithm-normalizing-rules | 71 // [1] http://www.w3.org/TR/WebCryptoAPI/#algorithm-normalizing-rules |
71 bool parseAlgorithm(const Dictionary&, AlgorithmOperation, blink::WebCryptoAlgor
ithm&, CryptoResult*) WARN_UNUSED_RETURN; | 72 bool parseAlgorithm(const Dictionary&, AlgorithmOperation, blink::WebCryptoAlgor
ithm&, CryptoResult*) WARN_UNUSED_RETURN; |
72 | 73 |
73 // Returns a null-terminated C-string literal. Caller can assume the pointer | 74 // Returns a null-terminated C-string literal. Caller can assume the pointer |
74 // will be valid for the program's entire runtime. | 75 // will be valid for the program's entire runtime. |
75 const char* algorithmIdToName(blink::WebCryptoAlgorithmId); | 76 const char* algorithmIdToName(blink::WebCryptoAlgorithmId); |
76 | 77 |
77 } // namespace WebCore | 78 } // namespace WebCore |
78 | 79 |
79 #endif | 80 #endif |
OLD | NEW |