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

Side by Side Diff: Source/modules/crypto/NormalizeAlgorithm.cpp

Issue 109223002: [webcrypto] Add crypto.subtle.wrapKey() and crypto.subtle.unwrapKey() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase test expectations (to match latest changes I had made) Created 7 years 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 | « Source/modules/crypto/Key.cpp ('k') | Source/modules/crypto/SubtleCrypto.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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 {"SHA-512", blink::WebCryptoAlgorithmIdSha512}, 79 {"SHA-512", blink::WebCryptoAlgorithmIdSha512},
80 }; 80 };
81 81
82 // What operations each algorithm supports, and what parameters it expects. 82 // What operations each algorithm supports, and what parameters it expects.
83 const OperationParamsMapping operationParamsMappings[] = { 83 const OperationParamsMapping operationParamsMappings[] = {
84 // AES-CBC 84 // AES-CBC
85 {blink::WebCryptoAlgorithmIdAesCbc, Decrypt, blink::WebCryptoAlgorithmParams TypeAesCbcParams}, 85 {blink::WebCryptoAlgorithmIdAesCbc, Decrypt, blink::WebCryptoAlgorithmParams TypeAesCbcParams},
86 {blink::WebCryptoAlgorithmIdAesCbc, Encrypt, blink::WebCryptoAlgorithmParams TypeAesCbcParams}, 86 {blink::WebCryptoAlgorithmIdAesCbc, Encrypt, blink::WebCryptoAlgorithmParams TypeAesCbcParams},
87 {blink::WebCryptoAlgorithmIdAesCbc, GenerateKey, blink::WebCryptoAlgorithmPa ramsTypeAesKeyGenParams}, 87 {blink::WebCryptoAlgorithmIdAesCbc, GenerateKey, blink::WebCryptoAlgorithmPa ramsTypeAesKeyGenParams},
88 {blink::WebCryptoAlgorithmIdAesCbc, ImportKey, blink::WebCryptoAlgorithmPara msTypeNone}, 88 {blink::WebCryptoAlgorithmIdAesCbc, ImportKey, blink::WebCryptoAlgorithmPara msTypeNone},
89 {blink::WebCryptoAlgorithmIdAesCbc, UnwrapKey, blink::WebCryptoAlgorithmPara msTypeAesCbcParams},
90 {blink::WebCryptoAlgorithmIdAesCbc, WrapKey, blink::WebCryptoAlgorithmParams TypeAesCbcParams},
89 91
90 // AES-CTR 92 // AES-CTR
91 {blink::WebCryptoAlgorithmIdAesCtr, Decrypt, blink::WebCryptoAlgorithmParams TypeAesCtrParams}, 93 {blink::WebCryptoAlgorithmIdAesCtr, Decrypt, blink::WebCryptoAlgorithmParams TypeAesCtrParams},
92 {blink::WebCryptoAlgorithmIdAesCtr, Encrypt, blink::WebCryptoAlgorithmParams TypeAesCtrParams}, 94 {blink::WebCryptoAlgorithmIdAesCtr, Encrypt, blink::WebCryptoAlgorithmParams TypeAesCtrParams},
93 {blink::WebCryptoAlgorithmIdAesCtr, GenerateKey, blink::WebCryptoAlgorithmPa ramsTypeAesKeyGenParams}, 95 {blink::WebCryptoAlgorithmIdAesCtr, GenerateKey, blink::WebCryptoAlgorithmPa ramsTypeAesKeyGenParams},
94 {blink::WebCryptoAlgorithmIdAesCtr, ImportKey, blink::WebCryptoAlgorithmPara msTypeNone}, 96 {blink::WebCryptoAlgorithmIdAesCtr, ImportKey, blink::WebCryptoAlgorithmPara msTypeNone},
97 {blink::WebCryptoAlgorithmIdAesCtr, UnwrapKey, blink::WebCryptoAlgorithmPara msTypeAesCtrParams},
98 {blink::WebCryptoAlgorithmIdAesCtr, WrapKey, blink::WebCryptoAlgorithmParams TypeAesCtrParams},
95 99
96 // HMAC 100 // HMAC
97 {blink::WebCryptoAlgorithmIdHmac, Sign, blink::WebCryptoAlgorithmParamsTypeH macParams}, 101 {blink::WebCryptoAlgorithmIdHmac, Sign, blink::WebCryptoAlgorithmParamsTypeH macParams},
98 {blink::WebCryptoAlgorithmIdHmac, Verify, blink::WebCryptoAlgorithmParamsTyp eHmacParams}, 102 {blink::WebCryptoAlgorithmIdHmac, Verify, blink::WebCryptoAlgorithmParamsTyp eHmacParams},
99 {blink::WebCryptoAlgorithmIdHmac, GenerateKey, blink::WebCryptoAlgorithmPara msTypeHmacKeyParams}, 103 {blink::WebCryptoAlgorithmIdHmac, GenerateKey, blink::WebCryptoAlgorithmPara msTypeHmacKeyParams},
100 {blink::WebCryptoAlgorithmIdHmac, ImportKey, blink::WebCryptoAlgorithmParams TypeHmacParams}, 104 {blink::WebCryptoAlgorithmIdHmac, ImportKey, blink::WebCryptoAlgorithmParams TypeHmacParams},
101 105
102 // RSASSA-PKCS1-v1_5 106 // RSASSA-PKCS1-v1_5
103 {blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, Sign, blink::WebCryptoAlgorithm ParamsTypeRsaSsaParams}, 107 {blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, Sign, blink::WebCryptoAlgorithm ParamsTypeRsaSsaParams},
104 {blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, Verify, blink::WebCryptoAlgorit hmParamsTypeRsaSsaParams}, 108 {blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, Verify, blink::WebCryptoAlgorit hmParamsTypeRsaSsaParams},
105 {blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, GenerateKey, blink::WebCryptoAl gorithmParamsTypeRsaKeyGenParams}, 109 {blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, GenerateKey, blink::WebCryptoAl gorithmParamsTypeRsaKeyGenParams},
106 {blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, ImportKey, blink::WebCryptoAlgo rithmParamsTypeNone}, 110 {blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, ImportKey, blink::WebCryptoAlgo rithmParamsTypeNone},
107 111
108 // RSAES-PKCS1-v1_5 112 // RSAES-PKCS1-v1_5
109 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, Encrypt, blink::WebCryptoAlgorit hmParamsTypeNone}, 113 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, Encrypt, blink::WebCryptoAlgorit hmParamsTypeNone},
110 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, Decrypt, blink::WebCryptoAlgorit hmParamsTypeNone}, 114 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, Decrypt, blink::WebCryptoAlgorit hmParamsTypeNone},
111 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, GenerateKey, blink::WebCryptoAlg orithmParamsTypeRsaKeyGenParams}, 115 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, GenerateKey, blink::WebCryptoAlg orithmParamsTypeRsaKeyGenParams},
112 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, ImportKey, blink::WebCryptoAlgor ithmParamsTypeNone}, 116 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, ImportKey, blink::WebCryptoAlgor ithmParamsTypeNone},
117 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, WrapKey, blink::WebCryptoAlgorit hmParamsTypeNone},
118 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, UnwrapKey, blink::WebCryptoAlgor ithmParamsTypeNone},
113 119
114 // SHA-* 120 // SHA-*
115 {blink::WebCryptoAlgorithmIdSha1, Digest, blink::WebCryptoAlgorithmParamsTyp eNone}, 121 {blink::WebCryptoAlgorithmIdSha1, Digest, blink::WebCryptoAlgorithmParamsTyp eNone},
116 {blink::WebCryptoAlgorithmIdSha224, Digest, blink::WebCryptoAlgorithmParamsT ypeNone}, 122 {blink::WebCryptoAlgorithmIdSha224, Digest, blink::WebCryptoAlgorithmParamsT ypeNone},
117 {blink::WebCryptoAlgorithmIdSha256, Digest, blink::WebCryptoAlgorithmParamsT ypeNone}, 123 {blink::WebCryptoAlgorithmIdSha256, Digest, blink::WebCryptoAlgorithmParamsT ypeNone},
118 {blink::WebCryptoAlgorithmIdSha384, Digest, blink::WebCryptoAlgorithmParamsT ypeNone}, 124 {blink::WebCryptoAlgorithmIdSha384, Digest, blink::WebCryptoAlgorithmParamsT ypeNone},
119 {blink::WebCryptoAlgorithmIdSha512, Digest, blink::WebCryptoAlgorithmParamsT ypeNone}, 125 {blink::WebCryptoAlgorithmIdSha512, Digest, blink::WebCryptoAlgorithmParamsT ypeNone},
120 }; 126 };
121 127
122 // This structure describes an algorithm and its supported operations. 128 // This structure describes an algorithm and its supported operations.
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 { 543 {
538 return normalizeAlgorithm(raw, op, algorithm, ExceptionContext(op), exceptio nState); 544 return normalizeAlgorithm(raw, op, algorithm, ExceptionContext(op), exceptio nState);
539 } 545 }
540 546
541 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id) 547 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id)
542 { 548 {
543 return AlgorithmRegistry::instance().lookupAlgorithmById(id)->algorithmName; 549 return AlgorithmRegistry::instance().lookupAlgorithmById(id)->algorithmName;
544 } 550 }
545 551
546 } // namespace WebCore 552 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/crypto/Key.cpp ('k') | Source/modules/crypto/SubtleCrypto.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698