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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 }; | 67 }; |
68 | 68 |
69 const AlgorithmNameMapping algorithmNameMappings[] = { | 69 const AlgorithmNameMapping algorithmNameMappings[] = { |
70 {"AES-CBC", blink::WebCryptoAlgorithmIdAesCbc}, | 70 {"AES-CBC", blink::WebCryptoAlgorithmIdAesCbc}, |
71 {"AES-CTR", blink::WebCryptoAlgorithmIdAesCtr}, | 71 {"AES-CTR", blink::WebCryptoAlgorithmIdAesCtr}, |
72 {"AES-GCM", blink::WebCryptoAlgorithmIdAesGcm}, | 72 {"AES-GCM", blink::WebCryptoAlgorithmIdAesGcm}, |
73 {"HMAC", blink::WebCryptoAlgorithmIdHmac}, | 73 {"HMAC", blink::WebCryptoAlgorithmIdHmac}, |
74 {"RSASSA-PKCS1-v1_5", blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5}, | 74 {"RSASSA-PKCS1-v1_5", blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5}, |
75 {"RSAES-PKCS1-v1_5", blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5}, | 75 {"RSAES-PKCS1-v1_5", blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5}, |
76 {"SHA-1", blink::WebCryptoAlgorithmIdSha1}, | 76 {"SHA-1", blink::WebCryptoAlgorithmIdSha1}, |
77 {"SHA-224", blink::WebCryptoAlgorithmIdSha224}, | |
78 {"SHA-256", blink::WebCryptoAlgorithmIdSha256}, | 77 {"SHA-256", blink::WebCryptoAlgorithmIdSha256}, |
79 {"SHA-384", blink::WebCryptoAlgorithmIdSha384}, | 78 {"SHA-384", blink::WebCryptoAlgorithmIdSha384}, |
80 {"SHA-512", blink::WebCryptoAlgorithmIdSha512}, | 79 {"SHA-512", blink::WebCryptoAlgorithmIdSha512}, |
81 {"AES-KW", blink::WebCryptoAlgorithmIdAesKw}, | 80 {"AES-KW", blink::WebCryptoAlgorithmIdAesKw}, |
82 }; | 81 }; |
83 | 82 |
84 // What operations each algorithm supports, and what parameters it expects. | 83 // What operations each algorithm supports, and what parameters it expects. |
85 const OperationParamsMapping operationParamsMappings[] = { | 84 const OperationParamsMapping operationParamsMappings[] = { |
86 // AES-CBC | 85 // AES-CBC |
87 {blink::WebCryptoAlgorithmIdAesCbc, Decrypt, blink::WebCryptoAlgorithmParams
TypeAesCbcParams}, | 86 {blink::WebCryptoAlgorithmIdAesCbc, Decrypt, blink::WebCryptoAlgorithmParams
TypeAesCbcParams}, |
(...skipping 26 matching lines...) Expand all Loading... |
114 // RSAES-PKCS1-v1_5 | 113 // RSAES-PKCS1-v1_5 |
115 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, Encrypt, blink::WebCryptoAlgorit
hmParamsTypeNone}, | 114 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, Encrypt, blink::WebCryptoAlgorit
hmParamsTypeNone}, |
116 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, Decrypt, blink::WebCryptoAlgorit
hmParamsTypeNone}, | 115 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, Decrypt, blink::WebCryptoAlgorit
hmParamsTypeNone}, |
117 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, GenerateKey, blink::WebCryptoAlg
orithmParamsTypeRsaKeyGenParams}, | 116 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, GenerateKey, blink::WebCryptoAlg
orithmParamsTypeRsaKeyGenParams}, |
118 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, ImportKey, blink::WebCryptoAlgor
ithmParamsTypeNone}, | 117 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, ImportKey, blink::WebCryptoAlgor
ithmParamsTypeNone}, |
119 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, WrapKey, blink::WebCryptoAlgorit
hmParamsTypeNone}, | 118 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, WrapKey, blink::WebCryptoAlgorit
hmParamsTypeNone}, |
120 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, UnwrapKey, blink::WebCryptoAlgor
ithmParamsTypeNone}, | 119 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, UnwrapKey, blink::WebCryptoAlgor
ithmParamsTypeNone}, |
121 | 120 |
122 // SHA-* | 121 // SHA-* |
123 {blink::WebCryptoAlgorithmIdSha1, Digest, blink::WebCryptoAlgorithmParamsTyp
eNone}, | 122 {blink::WebCryptoAlgorithmIdSha1, Digest, blink::WebCryptoAlgorithmParamsTyp
eNone}, |
124 {blink::WebCryptoAlgorithmIdSha224, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, | |
125 {blink::WebCryptoAlgorithmIdSha256, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, | 123 {blink::WebCryptoAlgorithmIdSha256, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, |
126 {blink::WebCryptoAlgorithmIdSha384, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, | 124 {blink::WebCryptoAlgorithmIdSha384, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, |
127 {blink::WebCryptoAlgorithmIdSha512, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, | 125 {blink::WebCryptoAlgorithmIdSha512, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, |
128 | 126 |
129 // AES-KW | 127 // AES-KW |
130 {blink::WebCryptoAlgorithmIdAesKw, GenerateKey, blink::WebCryptoAlgorithmPar
amsTypeAesKeyGenParams}, | 128 {blink::WebCryptoAlgorithmIdAesKw, GenerateKey, blink::WebCryptoAlgorithmPar
amsTypeAesKeyGenParams}, |
131 {blink::WebCryptoAlgorithmIdAesKw, ImportKey, blink::WebCryptoAlgorithmParam
sTypeNone}, | 129 {blink::WebCryptoAlgorithmIdAesKw, ImportKey, blink::WebCryptoAlgorithmParam
sTypeNone}, |
132 {blink::WebCryptoAlgorithmIdAesKw, UnwrapKey, blink::WebCryptoAlgorithmParam
sTypeNone}, | 130 {blink::WebCryptoAlgorithmIdAesKw, UnwrapKey, blink::WebCryptoAlgorithmParam
sTypeNone}, |
133 {blink::WebCryptoAlgorithmIdAesKw, WrapKey, blink::WebCryptoAlgorithmParamsT
ypeNone}, | 131 {blink::WebCryptoAlgorithmIdAesKw, WrapKey, blink::WebCryptoAlgorithmParamsT
ypeNone}, |
134 | 132 |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 } | 700 } |
703 return true; | 701 return true; |
704 } | 702 } |
705 | 703 |
706 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id) | 704 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id) |
707 { | 705 { |
708 return AlgorithmRegistry::instance().lookupAlgorithmById(id)->algorithmName; | 706 return AlgorithmRegistry::instance().lookupAlgorithmById(id)->algorithmName; |
709 } | 707 } |
710 | 708 |
711 } // namespace WebCore | 709 } // namespace WebCore |
OLD | NEW |