1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <svl/svldllapi.h>
24 #include <sal/types.h>
25 #include <com/sun/star/uno/Sequence.hxx>
27 class SvPasswordHelper
29 static void GetHashPasswordLittleEndian(css::uno::Sequence
<sal_Int8
>& rPassHash
, const OUString
& sPass
);
30 static void GetHashPasswordBigEndian(css::uno::Sequence
<sal_Int8
>& rPassHash
, const OUString
& sPass
);
33 SVL_DLLPUBLIC
static void GetHashPassword(css::uno::Sequence
<sal_Int8
>& rPassHash
, const sal_Char
* pPass
, sal_uInt32 nLen
);
35 SVL_DLLPUBLIC
static void GetHashPassword(css::uno::Sequence
<sal_Int8
>& rPassHash
, const OUString
& sPass
);
36 SVL_DLLPUBLIC
static void GetHashPasswordSHA1UTF8(css::uno::Sequence
<sal_Int8
>& rPassHash
, const OUString
& sPass
);
37 SVL_DLLPUBLIC
static void GetHashPasswordSHA256(css::uno::Sequence
<sal_Int8
>& rPassHash
, const OUString
& sPass
);
39 Use this method to compare a given string with another given Hash value.
40 This is necessary, because in older versions exists different hashes of the same string. They were endian dependent.
41 We need this to handle old files. This method will compare against big and
43 tdf#115483: also check 2 different new ways of hashing that were added in
44 ODF 1.2, requiring UTF-8 encoding.
46 SVL_DLLPUBLIC
static bool CompareHashPassword(const css::uno::Sequence
<sal_Int8
>& rOldPassHash
, const OUString
& sNewPass
);
51 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */