1 // Copyright 2017 Google Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 /////////////////////////////////////////////////////////////////////////////// 16 17 #ifndef TINK_SUBTLE_COMMON_ENUMS_H_ 18 #define TINK_SUBTLE_COMMON_ENUMS_H_ 19 20 #include <string> 21 22 namespace crypto { 23 namespace tink { 24 namespace subtle { 25 26 // Common enums used by classes in subtle. 27 enum EllipticCurveType { 28 UNKNOWN_CURVE = 0, 29 NIST_P256 = 2, 30 NIST_P384 = 3, 31 NIST_P521 = 4, 32 CURVE25519 = 5, 33 }; 34 35 enum EcPointFormat { 36 UNKNOWN_FORMAT = 0, 37 UNCOMPRESSED = 1, 38 COMPRESSED = 2, 39 // Like UNCOMPRESSED but without the \x04 prefix. Crunchy uses this format. 40 // DO NOT USE unless you are a Crunchy user moving to Tink. 41 DO_NOT_USE_CRUNCHY_UNCOMPRESSED = 3, 42 }; 43 44 enum HashType { 45 UNKNOWN_HASH = 0, 46 SHA1 = 1, // SHA1 for digital signature is deprecated but HMAC-SHA1 is fine. 47 SHA384 = 2, 48 SHA256 = 3, 49 SHA512 = 4, 50 SHA224 = 5, 51 }; 52 53 enum EcdsaSignatureEncoding { 54 UNKNOWN_ENCODING = 0, 55 IEEE_P1363 = 1, 56 DER = 2, 57 }; 58 59 std::string EnumToString(EllipticCurveType type); 60 std::string EnumToString(EcPointFormat format); 61 std::string EnumToString(HashType type); 62 63 } // namespace subtle 64 } // namespace tink 65 } // namespace crypto 66 67 #endif // TINK_SUBTLE_COMMON_ENUMS_H_ 68