android: Update app-specific/MIME type icons
[LibreOffice.git] / include / svl / PasswordHelper.hxx
blobaa7e55867343d8962fc554da7aa278e669e68eb3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVL_PASSWORDHELPER_HXX
21 #define INCLUDED_SVL_PASSWORDHELPER_HXX
23 #include <sal/config.h>
25 #include <string_view>
27 #include <svl/svldllapi.h>
28 #include <sal/types.h>
29 #include <com/sun/star/uno/Sequence.hxx>
31 class SvPasswordHelper
33 static void GetHashPasswordLittleEndian(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
34 static void GetHashPasswordBigEndian(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
36 public:
37 SVL_DLLPUBLIC static void GetHashPassword(css::uno::Sequence <sal_Int8>& rPassHash, const char* pPass, sal_uInt32 nLen);
39 SVL_DLLPUBLIC static void GetHashPassword(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
40 SVL_DLLPUBLIC static void GetHashPasswordSHA1UTF8(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
41 SVL_DLLPUBLIC static void GetHashPasswordSHA256(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
42 /**
43 Use this method to compare a given string with another given Hash value.
44 This is necessary, because in older versions exists different hashes of the same string. They were endian dependent.
45 We need this to handle old files. This method will compare against big and
46 little endian UTF-16.
47 tdf#115483: also check 2 different new ways of hashing that were added in
48 ODF 1.2, requiring UTF-8 encoding.
50 SVL_DLLPUBLIC static bool CompareHashPassword(const css::uno::Sequence<sal_Int8>& rOldPassHash, std::u16string_view sNewPass);
53 #endif
55 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */