[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/monich/harbour-foilauth.git</param>
<param name="branch">master</param>
- <param name="revision">0298040</param>
+ <param name="revision">74284aa</param>
</service>
</services>
\ No newline at end of file
|
|
Deleted |
_service:tar_git:harbour-foilauth-1.0.18.tar.gz/qml/images/sailotp.png
^
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/app.pro
^
|
@@ -9,7 +9,7 @@
TARGET = $${PREFIX}-$${NAME}
CONFIG += sailfishapp link_pkgconfig
-PKGCONFIG += sailfishapp mlite5 glib-2.0 gobject-2.0 libcrypto
+PKGCONFIG += sailfishapp mlite5 glib-2.0 gobject-2.0
QT += qml sql quick dbus multimedia concurrent
QMAKE_CXXFLAGS += -Wno-unused-parameter -Wno-psabi
@@ -22,6 +22,13 @@
TRANSLATIONS_PATH = /usr/share/$${TARGET}/translations
}
+openssl_static {
+ LIBS += $$[QT_INSTALL_LIBS]/libcrypto.a $$[QT_INSTALL_LIBS]/libssl.a
+ PKGCONFIG += zlib
+} else {
+ PKGCONFIG += libcrypto
+}
+
CONFIG(debug, debug|release) {
DEFINES += DEBUG HARBOUR_DEBUG
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/libfoil/Makefile
^
|
@@ -10,7 +10,31 @@
IMPL = openssl
IMPL_PKG = libcrypto
-PKGS = $(IMPL_PKG) libglibutil glib-2.0 gobject-2.0
+PKGS = $(IMPL_PKG) glib-2.0 gobject-2.0
+
+ifeq ($(LIBGLIBUTIL_PATH),)
+
+# Assume that libglibutil devel package is installed
+PKGS += libglibutil
+
+else
+
+# Side-by-side build
+INCLUDES += -I$(LIBGLIBUTIL_PATH)/include
+DEBUG_LIBS = -L$(LIBGLIBUTIL_PATH)/build/debug -lglibutil
+RELEASE_LIBS = -L$(LIBGLIBUTIL_PATH)/build/release -lglibutil
+DEBUG_DEPS = libglibutil_debug
+RELEASE_DEPS = libglibutil_release
+
+.PHONY: libglibutil_debug libglibutil_release
+
+libglibutil_debug:
+ $(MAKE) -C $(LIBGLIBUTIL_PATH) debug
+
+libglibutil_release:
+ $(MAKE) -C $(LIBGLIBUTIL_PATH) release
+
+endif
#
# Default target
@@ -121,7 +145,7 @@
CC ?= $(CROSS_COMPILE)gcc
LD = $(CC)
WARNINGS = -Wall
-INCLUDES = -I$(INCLUDE_DIR) -I$(SRC_DIR)
+INCLUDES += -I$(INCLUDE_DIR) -I$(SRC_DIR)
BASE_FLAGS = -fPIC
FULL_CFLAGS = $(BASE_FLAGS) $(CFLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) \
-MMD -MP $(shell pkg-config --cflags $(PKGS))
@@ -136,8 +160,8 @@
RELEASE_FLAGS += -g
endif
-DEBUG_LDFLAGS = $(FULL_LDFLAGS) $(DEBUG_FLAGS)
-RELEASE_LDFLAGS = $(FULL_LDFLAGS) $(RELEASE_FLAGS)
+DEBUG_LDFLAGS = $(DEBUG_FLAGS) $(DEBUG_LIBS) $(FULL_LDFLAGS)
+RELEASE_LDFLAGS = $(RELEASE_FLAGS) $(RELEASE_LIBS) $(FULL_LDFLAGS)
DEBUG_CFLAGS = $(FULL_CFLAGS) $(DEBUG_FLAGS) -DDEBUG
RELEASE_CFLAGS = $(FULL_CFLAGS) $(RELEASE_FLAGS) -O2
@@ -159,6 +183,14 @@
RELEASE_OBJS = $(BASE_RELEASE_OBJS) $(IMPL_RELEASE_OBJS)
COVERAGE_OBJS = $(BASE_COVERAGE_OBJS) $(IMPL_COVERAGE_OBJS)
+DEBUG_SO = $(DEBUG_BUILD_DIR)/$(LIB_SO)
+DEBUG_LIB = $(DEBUG_BUILD_DIR)/$(LIB)
+RELEASE_SO = $(RELEASE_BUILD_DIR)/$(LIB_SO)
+RELEASE_LIB = $(RELEASE_BUILD_DIR)/$(LIB)
+COVERAGE_LIB = $(COVERAGE_BUILD_DIR)/$(LIB)
+DEBUG_LINK = $(DEBUG_BUILD_DIR)/$(LIB_SYMLINK1)
+RELEASE_LINK = $(RELEASE_BUILD_DIR)/$(LIB_SYMLINK1)
+
#
# Dependencies
#
@@ -171,6 +203,8 @@
endif
$(PKGCONFIG): | $(BUILD_DIR)
+$(DEBUG_SO): | $(DEBUG_DEPS)
+$(RELEASE_SO): | $(RELEASE_DEPS)
$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
$(COVERAGE_OBJS): | $(COVERAGE_BUILD_DIR)
@@ -182,14 +216,6 @@
# Rules
#
-DEBUG_SO = $(DEBUG_BUILD_DIR)/$(LIB_SO)
-DEBUG_LIB = $(DEBUG_BUILD_DIR)/$(LIB)
-RELEASE_SO = $(RELEASE_BUILD_DIR)/$(LIB_SO)
-RELEASE_LIB = $(RELEASE_BUILD_DIR)/$(LIB)
-COVERAGE_LIB = $(COVERAGE_BUILD_DIR)/$(LIB)
-DEBUG_LINK = $(DEBUG_BUILD_DIR)/$(LIB_SYMLINK1)
-RELEASE_LINK = $(RELEASE_BUILD_DIR)/$(LIB_SYMLINK1)
-
debug: $(DEBUG_LIB) $(DEBUG_SO) $(DEBUG_LINK)
release: $(RELEASE_LIB) $(RELEASE_SO) $(RELEASE_LINK)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/libfoil/include/foil_asn1.h
^
|
@@ -1,26 +1,31 @@
/*
- * Copyright (C) 2016-2018 by Slava Monich
+ * Copyright (C) 2016-2021 by Slava Monich <slava@monich.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
- * 1.Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2.Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING
- * IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
@@ -40,78 +45,78 @@
gboolean
foil_asn1_is_block_header(
- const FoilParsePos* pos,
+ const GUtilRange* pos,
guint32* total_len);
gboolean
foil_asn1_is_sequence(
- const FoilParsePos* pos);
+ const GUtilRange* pos);
gboolean
foil_asn1_is_integer(
- const FoilParsePos* pos);
+ const GUtilRange* pos);
/* Since 1.0.7 */
gboolean
foil_asn1_is_bit_string(
- const FoilParsePos* pos);
+ const GUtilRange* pos);
gboolean
foil_asn1_is_octet_string(
- const FoilParsePos* pos);
+ const GUtilRange* pos);
gboolean
foil_asn1_is_ia5_string(
- const FoilParsePos* pos);
+ const GUtilRange* pos);
gboolean
foil_asn1_parse_skip_sequence_header(
- FoilParsePos* pos,
+ GUtilRange* pos,
guint32* len);
gboolean
foil_asn1_parse_start_sequence(
- FoilParsePos* pos,
+ GUtilRange* pos,
guint32* len);
/* Since 1.0.7 */
gboolean
foil_asn1_parse_start_bit_string(
- FoilParsePos* pos,
+ GUtilRange* pos,
guint32* num_bytes,
guint8* unused_bits);
gboolean
foil_asn1_parse_integer_bytes(
- FoilParsePos* pos,
+ GUtilRange* pos,
FoilBytes* bytes);
gboolean
foil_asn1_parse_int32(
- FoilParsePos* pos,
+ GUtilRange* pos,
gint32* value);
/* Since 1.0.7 */
gboolean
foil_asn1_parse_bit_string(
- FoilParsePos* pos,
+ GUtilRange* pos,
FoilBytes* bytes,
guint8* unused_bits);
/* Since 1.0.8 */
gboolean
foil_asn1_parse_object_id(
- FoilParsePos* pos,
+ GUtilRange* pos,
FoilBytes* oid_bytes);
gboolean
foil_asn1_parse_octet_string(
- FoilParsePos* pos,
+ GUtilRange* pos,
FoilBytes* bytes);
gboolean
foil_asn1_parse_ia5_string(
- FoilParsePos* pos,
+ GUtilRange* pos,
FoilBytes* bytes);
gsize
@@ -124,7 +129,7 @@
gboolean
foil_asn1_parse_len(
- FoilParsePos* pos,
+ GUtilRange* pos,
guint32* len,
gboolean* def);
@@ -233,6 +238,13 @@
foil_asn1_encode_ia5_string_bytes(
const char* str);
+/* Since 1.0.23 */
+gboolean
+foil_asn1_parse_tag(
+ GUtilRange* pos,
+ guint8* tag_id, /* Full tag or just leading octet for multi-byte tags */
+ guint32* tag_num);
+
G_END_DECLS
#endif /* FOIL_ASN1_H */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/libfoil/include/foil_types.h
^
|
@@ -1,26 +1,31 @@
/*
- * Copyright (C) 2016-2019 by Slava Monich
+ * Copyright (C) 2016-2021 by Slava Monich <slava@monich.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
- * 1.Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2.Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING
- * IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
@@ -49,10 +54,7 @@
gsize len;
} FoilBytes;
-typedef struct foil_parse_pos {
- const guint8* ptr;
- const guint8* end;
-} FoilParsePos;
+#define FoilParsePos GUtilRange
#define FOIL_ERROR (foil_error_quark())
GQuark foil_error_quark(void);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/libfoil/include/foil_util.h
^
|
@@ -1,26 +1,31 @@
/*
- * Copyright (C) 2016 by Slava Monich
+ * Copyright (C) 2016-2021 by Slava Monich <slava@monich.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
- * 1.Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2.Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING
- * IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
@@ -51,16 +56,16 @@
void
foil_parse_skip_spaces(
- FoilParsePos* pos);
+ GUtilRange* pos);
gboolean
foil_parse_skip_bytes(
- FoilParsePos* pos,
+ GUtilRange* pos,
const FoilBytes* bytes);
GBytes*
foil_parse_base64(
- FoilParsePos* pos,
+ GUtilRange* pos,
guint flags);
G_END_DECLS
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/libfoil/src/foil_asn1.c
^
|
@@ -5,22 +5,27 @@
* modification, are permitted provided that the following conditions
* are met:
*
- * 1.Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2.Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING
- * IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
@@ -38,7 +43,7 @@
*/
gboolean
foil_asn1_parse_len(
- FoilParsePos* pos,
+ GUtilRange* pos,
guint32* len,
gboolean* def)
{
@@ -90,7 +95,7 @@
const unsigned int n = x & 0x7f;
ptr = foil_input_peek(in, off+n+1, &available);
if (available >= (off+n+1)) {
- FoilParsePos pos;
+ GUtilRange pos;
pos.ptr = ptr + off;
pos.end = pos.ptr + available - off;
if (foil_asn1_parse_len(&pos, len, def)) {
@@ -129,11 +134,11 @@
*/
gboolean
foil_asn1_is_block_header(
- const FoilParsePos* pos,
+ const GUtilRange* pos,
guint32* total_len)
{
if (pos->ptr < pos->end) {
- FoilParsePos tmp = *pos;
+ GUtilRange tmp = *pos;
guint32 data_len;
gboolean def;
tmp.ptr++;
@@ -151,7 +156,7 @@
gboolean
foil_asn1_is_sequence(
- const FoilParsePos* pos)
+ const GUtilRange* pos)
{
return pos->ptr < pos->end &&
(pos->ptr[0] & (~ASN1_CLASS_MASK)) ==
@@ -160,7 +165,7 @@
gboolean
foil_asn1_is_integer(
- const FoilParsePos* pos)
+ const GUtilRange* pos)
{
return pos->ptr < pos->end &&
(pos->ptr[0] & (~ASN1_CLASS_MASK)) == ASN1_TAG_INTEGER;
@@ -168,7 +173,7 @@
gboolean
foil_asn1_is_bit_string(
- const FoilParsePos* pos)
+ const GUtilRange* pos)
{
return pos->ptr < pos->end &&
(pos->ptr[0] & (~ASN1_CLASS_MASK)) == ASN1_TAG_BIT_STRING;
@@ -176,7 +181,7 @@
gboolean
foil_asn1_is_octet_string(
- const FoilParsePos* pos)
+ const GUtilRange* pos)
{
return pos->ptr < pos->end &&
(pos->ptr[0] & (~ASN1_CLASS_MASK)) == ASN1_TAG_OCTET_STRING;
@@ -184,7 +189,7 @@
gboolean
foil_asn1_is_ia5_string(
- const FoilParsePos* pos)
+ const GUtilRange* pos)
{
return pos->ptr < pos->end &&
(pos->ptr[0] & (~ASN1_CLASS_MASK)) == ASN1_TAG_IA5_STRING;
@@ -193,10 +198,10 @@
static
gboolean
foil_asn1_parse_skip_header(
- FoilParsePos* pos,
+ GUtilRange* pos,
guint32* len)
{
- FoilParsePos tmp = *pos;
+ GUtilRange tmp = *pos;
guint32 seq_len;
gboolean def;
tmp.ptr++;
@@ -210,7 +215,7 @@
gboolean
foil_asn1_parse_skip_sequence_header(
- FoilParsePos* pos,
+ GUtilRange* pos,
guint32* len)
{
return foil_asn1_is_sequence(pos) &&
@@ -219,11 +224,11 @@
gboolean
foil_asn1_parse_start_sequence(
- FoilParsePos* pos,
+ GUtilRange* pos,
guint32* len)
{
guint32 seq_len;
- FoilParsePos tmp = *pos;
+ GUtilRange tmp = *pos;
if (foil_asn1_parse_skip_sequence_header(&tmp, &seq_len) &&
/* Overflow can occur on 32-bit systems */
tmp.ptr + seq_len >= tmp.ptr &&
@@ -237,12 +242,12 @@
gboolean
foil_asn1_parse_start_bit_string(
- FoilParsePos* pos,
+ GUtilRange* pos,
guint32* num_bytes,
guint8* unused_bits)
{
if (foil_asn1_is_bit_string(pos)) {
- FoilParsePos tmp = *pos;
+ GUtilRange tmp = *pos;
guint32 len;
if (foil_asn1_parse_skip_header(&tmp, &len) &&
/* Overflow can occur on 32-bit systems */
@@ -392,11 +397,11 @@
gboolean
foil_asn1_parse_integer_bytes(
- FoilParsePos* pos,
+ GUtilRange* pos,
FoilBytes* bytes)
{
if (foil_asn1_is_integer(pos)) {
- FoilParsePos tmp = *pos;
+ GUtilRange tmp = *pos;
guint32 len;
tmp.ptr++;
/*
@@ -419,11 +424,11 @@
gboolean
foil_asn1_parse_int32(
- FoilParsePos* pos,
+ GUtilRange* pos,
gint32* value)
{
FoilBytes bytes;
- FoilParsePos tmp = *pos;
+ GUtilRange tmp = *pos;
if (foil_asn1_parse_integer_bytes(&tmp, &bytes) && bytes.len <= 4) {
if (value) {
*value = foil_asn1_decode_int32(&bytes);
@@ -437,13 +442,13 @@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/libfoil/src/foil_asn1_p.h
^
|
@@ -1,26 +1,31 @@
/*
- * Copyright (C) 2018 by Slava Monich
+ * Copyright (C) 2016-2021 by Slava Monich
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
- * 1.Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2.Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING
- * IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
@@ -59,6 +64,7 @@
#define ASN1_TAG_GENERAL_STRING (0x1B)
#define ASN1_TAG_UNIVERSAL_STRING (0x1C)
#define ASN1_TAG_BMP_STRING (0x1E)
+#define ASN1_TAG_NUMBER_MASK (0x1F)
#endif /* FOIL_ASN1_P_H */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/libfoil/src/foil_key.c
^
|
@@ -1,29 +1,31 @@
/*
- * Copyright (C) 2016-2020 by Slava Monich
+ * Copyright (C) 2016-2021 by Slava Monich <slava@monich.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING
- * IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
@@ -327,7 +329,7 @@
GError** error)
{
GBytes* bytes;
- FoilParsePos pos;
+ GUtilRange pos;
GString* buf = NULL;
FoilKey* key = NULL;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/libfoil/src/foil_key_aes.c
^
|
@@ -37,8 +37,6 @@
#include "foil_input.h"
#include "foil_util.h"
-#include <ctype.h>
-
/* Logging */
#define GLOG_MODULE_NAME foil_log_key
#include "foil_log_p.h"
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/libfoil/src/foil_key_rsa_private.c
^
|
@@ -1,26 +1,31 @@
/*
- * Copyright (C) 2016-2019 by Slava Monich
+ * Copyright (C) 2016-2021 by Slava Monich <slava@monich.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
- * 1.Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2.Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING
- * IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
@@ -44,8 +49,6 @@
#include <gutil_strv.h>
#include <gutil_misc.h>
-#include <ctype.h>
-
/* Logging */
#define GLOG_MODULE_NAME foil_log_key
#include "foil_log_p.h"
@@ -205,12 +208,12 @@
static
gboolean
foil_key_rsa_private_parse_aid(
- FoilParsePos* pos,
+ GUtilRange* pos,
FoilBytes* oid,
FoilBytes* params)
{
guint32 len;
- FoilParsePos parse = *pos;
+ GUtilRange parse = *pos;
if (foil_asn1_parse_start_sequence(&parse, &len)) {
parse.end = parse.ptr + len;
if (foil_asn1_parse_object_id(&parse, oid)) {
@@ -248,7 +251,7 @@
const FoilBytes* data)
{
guint32 len;
- FoilParsePos pos;
+ GUtilRange pos;
foil_parse_init_data(&pos, data);
if (foil_asn1_parse_start_sequence(&pos, &len)) {
gint32 version;
@@ -290,7 +293,7 @@
static const guint8 oid_rsa_bytes[] = { ASN1_OID_RSA_BYTES };
static const FoilBytes oid_rsa = { oid_rsa_bytes, sizeof(oid_rsa_bytes) };
guint32 len;
- FoilParsePos pos;
+ GUtilRange pos;
foil_parse_init_data(&pos, data);
/* PrivateKeyInfo */
if (foil_asn1_parse_start_sequence(&pos, &len)) {
@@ -535,7 +538,7 @@
GBytes* decrypted = NULL;
guint32 len;
- FoilParsePos pos;
+ GUtilRange pos;
foil_parse_init_data(&pos, params);
if (foil_asn1_parse_start_sequence(&pos, &len)) {
FoilBytes kdf, kdf_param, alg, alg_param;
@@ -652,7 +655,7 @@
OID_PBES2, sizeof(OID_PBES2)
};
guint32 len;
- FoilParsePos pos;
+ GUtilRange pos;
foil_parse_init_bytes(&pos, bytes);
if (foil_asn1_parse_start_sequence(&pos, &len)) {
FoilBytes oid;
@@ -694,7 +697,7 @@
const guint8* start = foil_memmem(data, prefix);
if (start && data->len > (prefix->len + suffix->len)) {
GBytes* decoded;
- FoilParsePos pos;
+ GUtilRange pos;
GHashTable* headers;
/* Parse the header tags */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/libfoil/src/foil_key_rsa_public.c
^
|
@@ -1,26 +1,31 @@
/*
- * Copyright (C) 2016-2019 by Slava Monich
+ * Copyright (C) 2016-2021 by Slava Monich <slava@monich.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
- * 1.Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2.Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING
- * IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
@@ -129,7 +134,7 @@
static
gboolean
foil_key_rsa_public_parse_len(
- FoilParsePos* pos,
+ GUtilRange* pos,
guint32* len)
{
if ((pos->ptr + 4) <= pos->end) {
@@ -205,7 +210,7 @@
if (FOIL_KEY_RSA_PUBLIC_HAS_PREFIX(data->val, data->len,
rsa_public_binary_prefix)) {
guint32 len;
- FoilParsePos pos;
+ GUtilRange pos;
pos.ptr = data->val + G_N_ELEMENTS(rsa_public_binary_prefix);
pos.end = data->val + data->len;
if (foil_key_rsa_public_parse_len(&pos, &len) &&
@@ -233,7 +238,7 @@
{
gboolean ok = FALSE;
if (FOIL_KEY_RSA_PUBLIC_HAS_TEXT_PREFIX(data, ssh_rsa_text_prefix)) {
- FoilParsePos pos;
+ GUtilRange pos;
pos.ptr = data->val + G_N_ELEMENTS(ssh_rsa_text_prefix);
pos.end = data->val + data->len;
if (pos.ptr < pos.end && isspace(*pos.ptr)) {
@@ -269,7 +274,7 @@
const FoilBytes* bytes)
{
guint32 len;
- FoilParsePos pos;
+ GUtilRange pos;
foil_parse_init_data(&pos, bytes);
if (foil_asn1_parse_start_sequence(&pos, &len)) {
pos.end = pos.ptr + len;
@@ -326,10 +331,10 @@
static const FoilBytes oid_rsa = { oid_rsa_bytes, sizeof(oid_rsa_bytes) };
gboolean ok = FALSE;
guint32 len;
- FoilParsePos pos;
+ GUtilRange pos;
foil_parse_init_data(&pos, data);
if (foil_asn1_parse_start_sequence(&pos, &len)) {
- FoilParsePos aid;
+ GUtilRange aid;
pos.end = pos.ptr + len;
aid = pos;
/* Check AlgorithmIdentifier */
@@ -356,7 +361,7 @@
{
gboolean ok = FALSE;
if (FOIL_KEY_RSA_PUBLIC_HAS_TEXT_PREFIX(data, rsa_public_pkcs8_prefix)) {
- FoilParsePos pos;
+ GUtilRange pos;
pos.ptr = data->val + G_N_ELEMENTS(rsa_public_pkcs8_prefix);
pos.end = data->val + data->len;
if (foil_parse_skip_to_next_line(&pos, TRUE) && (pos.ptr < pos.end) &&
@@ -391,7 +396,7 @@
{
gboolean ok = FALSE;
if (FOIL_KEY_RSA_PUBLIC_HAS_TEXT_PREFIX(data, rsa_public_rfc4716_prefix)) {
- FoilParsePos pos;
+ GUtilRange pos;
pos.ptr = data->val + G_N_ELEMENTS(rsa_public_rfc4716_prefix);
pos.end = data->val + data->len;
if (foil_parse_skip_to_next_line(&pos, TRUE)) {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/libfoil/src/foil_util.c
^
|
@@ -1,26 +1,31 @@
/*
- * Copyright (C) 2016-2019 by Slava Monich
+ * Copyright (C) 2016-2021 by Slava Monich <slava@monich.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
- * 1.Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2.Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING
- * IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
@@ -168,7 +173,7 @@
gsize
foil_parse_init_data(
- FoilParsePos* pos,
+ GUtilRange* pos,
const FoilBytes* data)
{
if (data) {
@@ -182,7 +187,7 @@
gsize
foil_parse_init_bytes(
- FoilParsePos* pos,
+ GUtilRange* pos,
GBytes* bytes)
{
if (bytes) {
@@ -198,7 +203,7 @@
gsize
foil_parse_init_string(
- FoilParsePos* pos,
+ GUtilRange* pos,
const char* str)
{
if (pos) {
@@ -216,7 +221,7 @@
void
foil_parse_skip_spaces(
- FoilParsePos* pos)
+ GUtilRange* pos)
{
while (pos->ptr < pos->end && isspace(pos->ptr[0])) {
pos->ptr++;
@@ -226,7 +231,7 @@
static
char
foil_parse_skip_to_next_line2(
- FoilParsePos* pos)
+ GUtilRange* pos)
{
char last = 0;
while (pos->ptr < pos->end && *pos->ptr != '\r' && *pos->ptr != '\n') {
@@ -241,7 +246,7 @@
gboolean
foil_parse_skip_to_next_line(
- FoilParsePos* pos,
+ GUtilRange* pos,
gboolean continued)
{
char last = foil_parse_skip_to_next_line2(pos);
@@ -255,7 +260,7 @@
gboolean
foil_parse_skip_bytes(
- FoilParsePos* pos,
+ GUtilRange* pos,
const FoilBytes* bytes)
{
if (pos->end >= pos->ptr + bytes->len &&
@@ -269,7 +274,7 @@
static
char
foil_parse_read_line2(
- FoilParsePos* pos,
+ GUtilRange* pos,
GString* buf,
gboolean skip_spaces)
{
@@ -294,7 +299,7 @@
static
gsize
foil_parse_read_line(
- FoilParsePos* pos,
+ GUtilRange* pos,
GString* buf)
{
char last;
@@ -312,7 +317,7 @@
static
gsize
foil_parse_read_tag_line(
- FoilParsePos* pos,
+ GUtilRange* pos,
GString* buf)
{
/* Skip empty lines */
@@ -337,7 +342,7 @@
GHashTable*
foil_parse_headers(
- FoilParsePos* pos,
+ GUtilRange* pos,
GString* buf)
{
GHashTable* headers = NULL;
@@ -448,7 +453,7 @@
GBytes*
foil_parse_base64(
- FoilParsePos* pos,
+ GUtilRange* pos,
guint flags)
{
FoilInput* mem = foil_input_mem_new_static(pos->ptr, pos->end - pos->ptr);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/libfoil/src/foil_util_p.h
^
|
@@ -1,26 +1,31 @@
/*
- * Copyright (C) 2016-2019 by Slava Monich
+ * Copyright (C) 2016-2021 by Slava Monich <slava@monich.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
- * 1.Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2.Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING
- * IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
@@ -56,27 +61,27 @@
gsize
foil_parse_init_data(
- FoilParsePos* pos,
+ GUtilRange* pos,
const FoilBytes* data);
gsize
foil_parse_init_bytes(
- FoilParsePos* pos,
+ GUtilRange* pos,
GBytes* bytes);
gsize
foil_parse_init_string(
- FoilParsePos* pos,
+ GUtilRange* pos,
const char* str);
gboolean
foil_parse_skip_to_next_line(
- FoilParsePos* pos,
+ GUtilRange* pos,
gboolean continued);
GHashTable*
foil_parse_headers(
- FoilParsePos* pos,
+ GUtilRange* pos,
GString* buf);
char*
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/libfoilmsg/src/foilmsg_decrypt.c
^
|
@@ -1,29 +1,31 @@
/*
- * Copyright (C) 2016-2021 by Slava Monich
+ * Copyright (C) 2016-2021 by Slava Monich <slava@monich.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
- * 1.Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2.Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING
- * IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
@@ -144,12 +146,12 @@
static
gboolean
foilmsg_decode_tagged_data(
- FoilParsePos* pos,
+ GUtilRange* pos,
FoilMsgTaggedData* block)
{
guint32 len;
if (foil_asn1_parse_start_sequence(pos, &len)) {
- FoilParsePos seq;
+ GUtilRange seq;
seq.ptr = pos->ptr;
seq.end = pos->ptr + len;
if (foil_asn1_parse_int32(&seq, &block->tag) &&
@@ -186,13 +188,13 @@
static
FoilMsgInfo*
foilmsg_parse_encrypted_keys(
- FoilParsePos* pos)
+ GUtilRange* pos)
{
FoilMsgInfo* msg = NULL;
guint32 len;
if (foil_asn1_parse_start_sequence(pos, &len)) {
gint32 key_format;
- FoilParsePos seq;
+ GUtilRange seq;
seq.ptr = pos->ptr;
seq.end = pos->ptr + len;
if (foil_asn1_parse_int32(&seq, &key_format)) {
@@ -200,7 +202,7 @@
GSList* keys = NULL;
guint i, nkeys = 0;
while (foil_asn1_parse_start_sequence(&seq, &len)) {
- FoilParsePos seq2;
+ GUtilRange seq2;
seq2.ptr = seq.ptr;
seq2.end = seq.ptr + len;
key = g_slice_new(FoilMsgEncryptKey);
@@ -361,7 +363,7 @@
const FoilBytes* bytes)
{
guint32 len;
- FoilParsePos pos;
+ GUtilRange pos;
pos.ptr = bytes->val;
pos.end = pos.ptr + bytes->len;
if (foil_asn1_parse_start_sequence(&pos, &len)) {
@@ -621,7 +623,7 @@
{
GBytes* bytes = NULL;
if (G_LIKELY(data)) {
- FoilParsePos pos;
+ GUtilRange pos;
pos.ptr = data->val;
pos.end = pos.ptr + data->len;
foil_parse_skip_spaces(&pos);
@@ -657,7 +659,7 @@
{
FoilMsg* ret = NULL;
if (G_LIKELY(recipient) && G_LIKELY(text)) {
- FoilParsePos pos;
+ GUtilRange pos;
pos.ptr = text->val;
pos.end = pos.ptr + text->len;
foil_parse_skip_spaces(&pos);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/rpm/foil.spec
^
|
@@ -10,12 +10,13 @@
%define glib_version 2.36
%define libglibutil_version 1.0.24
+%define libglibutil_build_version 1.0.54
BuildRequires: file-devel
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(glib-2.0) >= %{glib_version}
-BuildRequires: pkgconfig(libglibutil) >= %{libglibutil_version}
+BuildRequires: pkgconfig(libglibutil) >= %{libglibutil_build_version}
Requires: glib2 >= %{glib_version}
Requires: libglibutil >= %{libglibutil_version}
Requires(post): /sbin/ldconfig
@@ -27,6 +28,7 @@
%package devel
Summary: Development library for %{name}
Requires: %{name} = %{version}
+Requires: pkgconfig(libglibutil) >= %{libglibutil_build_version}
Requires: pkgconfig
%description devel
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/foil/test/libfoil/test_basic/test_basic.c
^
|
@@ -1,26 +1,31 @@
/*
- * Copyright (C) 2016-2019 by Slava Monich
+ * Copyright (C) 2016-2021 by Slava Monich <slava@monich.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
- * 1.Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2.Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING
- * IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
@@ -170,7 +175,7 @@
test_skip(
void)
{
- FoilParsePos pos;
+ GUtilRange pos;
static const FoilBytes bytes = { (const void*)"xyz", 3 };
/* Test NULL resistance */
@@ -221,7 +226,7 @@
const char* value,
const char* expected)
{
- FoilParsePos pos;
+ GUtilRange pos;
GHashTable* headers;
char* header = foil_format_header(tag, value);
@@ -314,7 +319,7 @@
void)
{
GString* buf = g_string_new(NULL);
- FoilParsePos pos;
+ GUtilRange pos;
GHashTable* headers;
foil_parse_init_string(&pos, "");
@@ -345,7 +350,7 @@
static const guint8 a[] = { 0x01 };
static const guint8 b[] = { 0x01, 0x02 };
static const guint8 c[] = { 0x01, 0x02, 0x03 };
- FoilParsePos pos;
+ GUtilRange pos;
GBytes* bytes;
foil_parse_init_string(&pos, "AQ");
@@ -434,7 +439,7 @@
FoilInput* in;
guint32 len;
gboolean def;
- FoilParsePos pos;
+ GUtilRange pos;
pos.ptr = pos.end = len_short;
in = foil_input_mem_new(NULL);
@@ -626,7 +631,7 @@
const FoilBytes bytes1 = { seq1 + 2, sizeof(seq1) - 2 };
const FoilBytes bytes2 = { seq2 + 4, sizeof(seq2) - 4 };
const FoilBytes* data1 = &bytes1;
- FoilParsePos pos;
+ GUtilRange pos;
guint32 len;
FoilInput* in0 = foil_input_mem_new(NULL);
FoilInput* in1 = foil_input_mem_new_static(seq1, sizeof(seq1));
@@ -747,7 +752,7 @@
guint i;
guint32 len;
- FoilParsePos pos;
+ GUtilRange pos;
static const guint8 not_bit_string[] = { 0x00 };
static const guint8 broken_bit_string[] = { 0x03, 0x82, 0x01 };
static const guint8 broken_bit_string2[] = { 0x03, 0x00 };
@@ -959,7 +964,7 @@
guint i;
for (i=0; i<G_N_ELEMENTS(subtest); i++) {
- FoilParsePos pos, pos2;
+ GUtilRange pos, pos2;
FoilBytes bytes;
gboolean expected = subtest[i].good;
pos.ptr = subtest[i].data;
@@ -1021,7 +1026,7 @@
gsize length;
FoilInput* in = foil_input_mem_new_static(subtest->data, subtest->len);
char* str = foil_asn1_read_ia5_string(in, -1, &length);
- FoilParsePos pos, pos2;
+ GUtilRange pos, pos2;
FoilBytes bytes;
gboolean expected = subtest->good;
pos.ptr = subtest->data;
@@ -1120,7 +1125,7 @@
const struct asn1_int_test* subtest = number + i;
FoilInput* in1 = foil_input_mem_new_static(subtest->data, subtest->len);
FoilInput* in2 = foil_input_mem_new_static(subtest->data, subtest->len);
- FoilParsePos pos, pos1;
+ GUtilRange pos, pos1;
gint32 value;
if (subtest->ok) {
GBytes* enc1 = foil_asn1_encode_integer_value(subtest->value);
@@ -1158,6 +1163,65 @@
}
}
+static
+void
+test_asn1_tag(
+ void)
+{
+ static const guint8 x22 [] = { 0x22 };
+ static const guint8 x5f31 [] = { 0x5f, 0x31 };
+ static const guint8 x5f817f [] = { 0x5f, 0x81, 0x7f };
+ static const guint8 x5f00 [] = { 0x5f, 0x00 }; /* Zero byte */
+ static const guint8 x5f81 [] = { 0x5f, 0x81 }; /* Too short */
+ static const guint8 x7fffffffff7f [] =
+ { 0x7f, 0xff, 0xff, 0xff, 0xff, 0x7f }; /* Too many bits */
+ static const guint8 x5f818181818181 [] =
+ { 0x5f, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81 }; /* Too long */
+ static const struct asn1_tag_test {
+ gboolean ok;
+ guint8 id;
+ guint tag;
+ FoilBytes data;
+ } tests [] = {
+ { TRUE, 0x22, 0x02, { TEST_ARRAY_AND_SIZE(x22) } },
+ { TRUE, 0x5f, 0x31, { TEST_ARRAY_AND_SIZE(x5f31) } },
+ { TRUE, 0x5f, 0xff, { TEST_ARRAY_AND_SIZE(x5f817f) } },
+ { FALSE, 0, 0, { TEST_ARRAY_AND_SIZE(x5f00) } },
+ { FALSE, 0, 0, { TEST_ARRAY_AND_SIZE(x5f81) } },
+ { FALSE, 0, 0, { TEST_ARRAY_AND_SIZE(x7fffffffff7f) } },
+ { FALSE, 0, 0, { TEST_ARRAY_AND_SIZE(x5f818181818181) } }
+ };
+
+ GUtilRange pos;
+ gsize i;
+
+ memset(&pos, 0, sizeof(pos));
+ g_assert(!foil_asn1_parse_tag(&pos, NULL, NULL));
+ for (i = 0; i < G_N_ELEMENTS(tests); i++) {
+ const FoilBytes* data = &tests[i].data;
+ gboolean ok = tests[i].ok;
+ guint8 id = 0;
+ guint tag = 0;
+
+ pos.ptr = data->val;
+ pos.end = pos.ptr + data->len;
+ g_assert(foil_asn1_parse_tag(&pos, NULL, NULL) == ok);
+
+ pos.ptr = data->val;
+ pos.end = pos.ptr + data->len;
+ g_assert(foil_asn1_parse_tag(&pos, &id, &tag) == ok);
+ if (ok) {
+ g_assert_cmpuint(id, == ,tests[i].id);
+ g_assert_cmpuint(tag, == ,tests[i].tag);
+ g_assert(pos.ptr == pos.end);
+ } else {
+ g_assert(pos.ptr == data->val);
+ g_assert_cmpuint(id, == ,0);
+ g_assert_cmpuint(tag, == ,0);
+ }
+ }
+}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/libglibutil/Makefile
^
|
@@ -20,7 +20,7 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
-VERSION_RELEASE = 55
+VERSION_RELEASE = 56
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
@@ -152,7 +152,7 @@
@echo $(COVERAGE_STATIC_LIB)
clean:
- make -C test clean
+ $(MAKE) -C test clean
rm -fr test/coverage/results test/coverage/*.gcov
rm -f *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~
rm -fr $(BUILD_DIR) RPMS installroot
@@ -162,7 +162,7 @@
rm -fr debian/*.install
test:
- make -C test test
+ $(MAKE) -C test test
$(BUILD_DIR):
mkdir -p $@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/libglibutil/debian/changelog
^
|
@@ -1,3 +1,10 @@
+libglibutil (1.0.56) unstable; urgency=low
+
+ * Added gutil_parse_int64()
+ * Added gutil_parse_uint64()
+
+ -- Slava Monich <slava.monich@jolla.com> Sun, 03 Oct 2021 20:18:15 +0300
+
libglibutil (1.0.55) unstable; urgency=low
* Added gutil_log_dump()
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/libglibutil/include/gutil_misc.h
^
|
@@ -76,6 +76,18 @@
unsigned int* value); /* Since 1.0.53 */
gboolean
+gutil_parse_int64(
+ const char* str,
+ int base,
+ gint64* value); /* Since 1.0.56 */
+
+gboolean
+gutil_parse_uint64(
+ const char* str,
+ int base,
+ guint64* value); /* Since 1.0.56 */
+
+gboolean
gutil_data_equal(
const GUtilData* data1,
const GUtilData* data2); /* Since 1.0.31 */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/libglibutil/rpm/libglibutil.spec
^
|
@@ -1,12 +1,13 @@
Name: libglibutil
-Version: 1.0.55
+Version: 1.0.56
Release: 0
Summary: Library of glib utilities
License: BSD
-URL: https://git.sailfishos.org/mer-core/libglibutil
+URL: https://github.com/sailfishos/libglibutil
Source: %{name}-%{version}.tar.bz2
+BuildRequires: pkgconfig
BuildRequires: pkgconfig(glib-2.0)
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
@@ -17,7 +18,6 @@
%package devel
Summary: Development library for %{name}
Requires: %{name} = %{version}
-Requires: pkgconfig
%description devel
This package contains the development library for %{name}.
@@ -33,7 +33,7 @@
make LIBDIR=%{_libdir} DESTDIR=%{buildroot} install-dev
%check
-make -C test test
+make %{_smp_mflags} -C test test
%post -p /sbin/ldconfig
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/libglibutil/src/gutil_misc.c
^
|
@@ -35,6 +35,7 @@
#include <glib-object.h>
#include <ctype.h>
+#include <errno.h>
#include <limits.h>
void
@@ -181,17 +182,57 @@
int base,
int* value) /* Since 1.0.30 */
{
+ gint64 ll;
+
+ if (gutil_parse_int64(str, base, &ll) && ll >= INT_MIN && ll <= INT_MAX) {
+ if (value) {
+ *value = (int)ll;
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+gboolean
+gutil_parse_uint(
+ const char* str,
+ int base,
+ unsigned int* value) /* Since 1.0.53 */
+{
+ guint64 ull;
+
+ if (gutil_parse_uint64(str, base, &ull) && ull <= UINT_MAX) {
+ if (value) {
+ *value = (unsigned int)ull;
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+gboolean
+gutil_parse_int64(
+ const char* str,
+ int base,
+ gint64* value) /* Since 1.0.56 */
+{
gboolean ok = FALSE;
- if (str && str[0]) {
+ if (str && *str) {
char* tmp = NULL;
char* end = NULL;
const char* stripped = gutil_strstrip(str, &tmp);
- const gint64 ll = g_ascii_strtoll(stripped, &end, base);
+ gint64 ll;
- ok = !*end && ll >= INT_MIN && ll <= INT_MAX;
- if (ok && value) {
- *value = (int)ll;
+ errno = 0;
+ ll = g_ascii_strtoll(stripped, &end, base);
+ if (end && !*end &&
+ !((ll == G_MAXINT64 || ll == G_MININT64) && errno == ERANGE) &&
+ !(ll == 0 && errno == EINVAL)) {
+ if (value) {
+ *value = ll;
+ }
+ ok = TRUE;
}
g_free(tmp);
}
@@ -199,22 +240,35 @@
}
gboolean
-gutil_parse_uint(
+gutil_parse_uint64(
const char* str,
int base,
- unsigned int* value) /* Since 1.0.53 */
+ guint64* value) /* Since 1.0.56 */
{
gboolean ok = FALSE;
- if (str && str[0]) {
+ /*
+ * Sorry, we don't accept minus as a part of an unsigned number
+ * (unlike strtoul)
+ */
+ if (str && *str && *str != '-') {
char* tmp = NULL;
- char* end = NULL;
const char* stripped = gutil_strstrip(str, &tmp);
- const guint64 ull = g_ascii_strtoull(stripped, &end, base);
- ok = !*end && ull <= UINT_MAX;
- if (ok && value) {
- *value = (unsigned int)ull;
+ if (*stripped != '-') {
+ char* end = NULL;
+ guint64 ull;
+
+ errno = 0;
+ ull = g_ascii_strtoull(stripped, &end, base);
+ if (end && !*end &&
+ !(ull == G_MAXUINT64 && errno == ERANGE) &&
+ !(ull == 0 && errno == EINVAL)) {
+ if (value) {
+ *value = ull;
+ }
+ ok = TRUE;
+ }
}
g_free(tmp);
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/libglibutil/src/gutil_strv.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2020 Jolla Ltd.
- * Copyright (C) 2014-2020 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2014-2021 Jolla Ltd.
+ * Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -173,10 +173,7 @@
if (free_string) {
g_free(sv[pos]);
}
- if (pos < len-1) {
- memmove(sv + pos, sv + pos + 1, sizeof(char*)*(len-pos-1));
- }
- sv[len-1] = NULL;
+ memmove(sv + pos, sv + pos + 1, sizeof(char*)*(len - pos));
sv = g_realloc(sv, sizeof(char*)*len);
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/libglibutil/test/common/Makefile
^
|
@@ -52,7 +52,7 @@
$(shell pkg-config --cflags $(PKGS))
FULL_LDFLAGS = $(BASE_LDFLAGS)
LIBS = $(shell pkg-config --libs $(PKGS))
-QUIET_MAKE = make --no-print-directory
+QUIET_MAKE = $(MAKE) --no-print-directory
DEBUG_FLAGS = -g
RELEASE_FLAGS =
COVERAGE_FLAGS = -g
@@ -134,7 +134,7 @@
rm -fr $(BUILD_DIR)
cleaner: clean
- @make -C $(LIB_DIR) clean
+ @$(MAKE) -C $(LIB_DIR) clean
test_banner:
@echo "===========" $(EXE) "=========== "
@@ -185,10 +185,10 @@
$(LD) $(COVERAGE_LDFLAGS) $(COVERAGE_OBJS) $< $(LIBS) -o $@
debug_lib:
- @make $(SUBMAKE_OPTS) -C $(LIB_DIR) debug
+ @$(MAKE) $(SUBMAKE_OPTS) -C $(LIB_DIR) debug
release_lib:
- @make $(SUBMAKE_OPTS) -C $(LIB_DIR) release
+ @$(MAKE) $(SUBMAKE_OPTS) -C $(LIB_DIR) release
coverage_lib:
- @make $(SUBMAKE_OPTS) -C $(LIB_DIR) coverage
+ @$(MAKE) $(SUBMAKE_OPTS) -C $(LIB_DIR) coverage
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/libglibutil/test/test_misc/test_misc.c
^
|
@@ -173,6 +173,8 @@
g_assert(!gutil_parse_int("", 0, NULL));
g_assert(!gutil_parse_int("garbage", 0, NULL));
g_assert(!gutil_parse_int("0 trailing garbage", 0, NULL));
+ g_assert(!gutil_parse_int("0", -1, NULL));
+ g_assert(!gutil_parse_int("0", 1, NULL));
g_assert(gutil_parse_int("0", 0, NULL));
g_assert(gutil_parse_int("0", 0, &value));
g_assert_cmpint(value, == ,0);
@@ -207,14 +209,20 @@
g_assert(!gutil_parse_uint("", 0, NULL));
g_assert(!gutil_parse_uint("garbage", 0, NULL));
g_assert(!gutil_parse_uint("0 trailing garbage", 0, NULL));
+ g_assert(!gutil_parse_uint("0", -1, NULL));
+ g_assert(!gutil_parse_uint("0", 1, NULL));
g_assert(gutil_parse_uint("0", 0, NULL));
g_assert(gutil_parse_uint("0", 0, &value));
g_assert_cmpuint(value, == ,0);
g_assert(gutil_parse_uint("42", 0, &value));
g_assert_cmpuint(value, == ,42);
g_assert(!gutil_parse_uint("0x10000000000000000", 0, &value));
+#if defined __SIZEOF_INT__ && __SIZEOF_INT__ == 4
+ g_assert(!gutil_parse_uint("0x100000000", 0, &value));
+#endif
g_assert(!gutil_parse_uint("-2147483649", 0, &value));
g_assert(!gutil_parse_uint("-1", 0, &value));
+ g_assert(!gutil_parse_uint(" -1 ", 0, &value));
g_assert(gutil_parse_uint("4294967295", 0, &value));
g_assert_cmpuint(value, == ,4294967295);
g_assert(gutil_parse_uint(" 0x7fffffff ", 0, &value));
@@ -228,6 +236,91 @@
}
/*==========================================================================*
+ * parse_int64
+ *==========================================================================*/
+
+static
+void
+test_parse_int64(
+ void)
+{
+ gint64 value;
+
+ g_assert(!gutil_parse_int64(NULL, 0, NULL));
+ g_assert(!gutil_parse_int64("", 0, NULL));
+ g_assert(!gutil_parse_int64("garbage", 0, NULL));
+ g_assert(!gutil_parse_int64("0 trailing garbage", 0, NULL));
+ g_assert(!gutil_parse_int64("0", -1, NULL));
+ g_assert(!gutil_parse_int64("0", 1, NULL));
+ g_assert(gutil_parse_int64("0", 0, NULL));
+ g_assert(gutil_parse_int64("0", 0, &value));
+ g_assert_cmpint(value, == ,0);
+ g_assert(gutil_parse_int64("-1", 0, &value));
+ g_assert_cmpint(value, == ,-1);
+ g_assert(gutil_parse_int64("42", 0, &value));
+ g_assert_cmpint(value, == ,42);
+ g_assert(gutil_parse_int64("-2147483649", 0, &value));
+ g_assert_cmpint(value, == ,-2147483649);
+ g_assert(gutil_parse_int64("4294967295", 0, &value));
+ g_assert_cmpint(value, == ,4294967295);
+ g_assert(gutil_parse_int64(" 0x7fffffff ", 0, &value));
+ g_assert_cmpint(value, == ,0x7fffffff);
+ g_assert(gutil_parse_int64(" 7fffffff ", 16, &value));
+ g_assert_cmpint(value, == ,0x7fffffff);
+ g_assert(gutil_parse_int64("7ffffffe ", 16, &value));
+ g_assert_cmpint(value, == ,0x7ffffffe);
+ g_assert(gutil_parse_int64("0xffffffff", 0, &value));
+ g_assert_cmpint(value, == ,0xffffffff);
+ g_assert(!gutil_parse_int64("0x10000000000000000", 0, &value));
+ g_assert(!gutil_parse_int64("-9223372036854775809", 0, &value));
+ g_assert(gutil_parse_int64("-9223372036854775808", 0, &value));
+ g_assert_cmpint(value, == ,0x8000000000000000);
+ g_assert(!gutil_parse_int64("9223372036854775808", 0, &value));
+ g_assert(gutil_parse_int64("9223372036854775807", 0, &value));
+ g_assert_cmpint(value, == ,0x7fffffffffffffff);
+}
+
+/*==========================================================================*
+ * parse_uint64
+ *==========================================================================*/
+
+static
+void
+test_parse_uint64(
+ void)
+{
+ guint64 value;
+
+ g_assert(!gutil_parse_uint64(NULL, 0, NULL));
+ g_assert(!gutil_parse_uint64("", 0, NULL));
+ g_assert(!gutil_parse_uint64("garbage", 0, NULL));
+ g_assert(!gutil_parse_uint64("0 trailing garbage", 0, NULL));
+ g_assert(!gutil_parse_uint64("0", -1, NULL));
+ g_assert(!gutil_parse_uint64("0", 1, NULL));
+ g_assert(gutil_parse_uint64("0", 0, NULL));
+ g_assert(gutil_parse_uint64("0", 0, &value));
+ g_assert_cmpuint(value, == ,0);
+ g_assert(gutil_parse_uint64("42", 0, &value));
+ g_assert_cmpuint(value, == ,42);
+ g_assert(!gutil_parse_uint64("0x10000000000000000", 0, &value));
+ g_assert(!gutil_parse_uint64("-2147483649", 0, &value));
+ g_assert(!gutil_parse_uint64("-1", 0, &value));
+ g_assert(!gutil_parse_uint64(" -1 ", 0, &value));
+ g_assert(gutil_parse_uint64("4294967295", 0, &value));
+ g_assert_cmpuint(value, == ,4294967295);
+ g_assert(!gutil_parse_uint64(" 0x7fffffff ffffffff ", 0, &value));
+ g_assert(gutil_parse_uint64(" 0x7fffffffffffffff ", 0, &value));
+ g_assert_cmpuint(value, == ,0x7fffffffffffffff);
+ g_assert(!gutil_parse_uint64(" 7fffffff ffffffff", 16, &value));
+ g_assert(gutil_parse_uint64(" 7fffffffffffffff ", 16, &value));
+ g_assert_cmpuint(value, == ,0x7fffffffffffffff);
+ g_assert(gutil_parse_uint64("0x100000000", 0, &value));
+ g_assert_cmpuint(value, == ,0x100000000);
+ g_assert(gutil_parse_uint64("0xffffffffffffffff", 0, &value));
+ g_assert_cmpuint(value, == ,0xffffffffffffffff);
+}
+
+/*==========================================================================*
* data_equal
*==========================================================================*/
@@ -679,6 +772,8 @@
g_test_add_func(TEST_("hexdump"), test_hexdump);
g_test_add_func(TEST_("parse_int"), test_parse_int);
g_test_add_func(TEST_("parse_uint"), test_parse_uint);
+ g_test_add_func(TEST_("parse_int64"), test_parse_int64);
+ g_test_add_func(TEST_("parse_uint64"), test_parse_uint64);
g_test_add_func(TEST_("data_equal"), test_data_equal);
g_test_add_func(TEST_("data_prefix"), test_data_prefix);
g_test_add_func(TEST_("data_suffix"), test_data_suffix);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/qml/CoverPage.qml
^
|
@@ -27,7 +27,7 @@
color: Theme.primaryColor
opacity: 0.1
- readonly property bool active: foilModel.timerActive
+ readonly property bool active: list.model.needTimer && foilModel.timerActive
property real value
onActiveChanged: {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/qml/EditAuthTokenDialog.qml
^
|
@@ -15,10 +15,12 @@
property alias acceptText: header.acceptText
property alias dialogTitle: header.title
property string issuer
+ property int type: FoilAuth.DefaultType
property int algorithm: FoilAuth.DefaultAlgorithm
property alias label: labelField.text
property alias secret: secretField.text
property alias digits: digitsField.text
+ property alias counter: counterField.text
property alias timeShift: timeShiftField.text
signal tokenAccepted(var dialog)
@@ -30,8 +32,7 @@
id: generator
ecLevel: FoilAuthSettings.qrCodeEcLevel
- text: FoilAuth.toUri(secretField.text, labelField.text, thisDialog.issuer,
- digitsField.text, timeShiftField.text, algorithm)
+ text: FoilAuth.toUri(type, secret, label, issuer, digits, counter, timeShift, algorithm)
}
Item {
@@ -103,10 +104,12 @@
columns: isLandscape ? 2 : 1
width: parent.width
+ readonly property real columnWidth: width/columns
+
TextField {
id: digitsField
- width: parent.width/parent.columns
+ width: parent.columnWidth
//: Text field label (number of password digits)
//% "Digits"
label: qsTrId("foilauth-token-digits-text")
@@ -122,9 +125,26 @@
}
TextField {
+ id: counterField
+
+ width: parent.columnWidth
+ //: Text field label (HOTP counter value)
+ //% "Counter value"
+ label: qsTrId("foilauth-token-counter-text")
+ placeholderText: label
+ text: FoilAuthDefaultCounter
+ validator: IntValidator {}
+ enabled: !qrCodeOnly
+ visible: type === FoilAuth.TypeHOTP
+
+ EnterKey.iconSource: "image://theme/icon-m-enter-accept"
+ EnterKey.onClicked: thisDialog.accept()
+ }
+
+ TextField {
id: timeShiftField
- width: parent.width/parent.columns
+ width: parent.columnWidth
//: Text field label (number of password digits)
//% "Time shift (seconds)"
label: qsTrId("foilauth-token-timeshift-text")
@@ -134,31 +154,54 @@
text: FoilAuthDefaultTimeShift
validator: IntValidator {}
enabled: !qrCodeOnly
+ visible: type === FoilAuth.TypeTOTP
EnterKey.iconSource: "image://theme/icon-m-enter-accept"
EnterKey.onClicked: thisDialog.accept()
}
- }
- ComboBox {
- id: algorithmComboBox
+ ComboBox {
+ id: algorithmComboBox
- width: parent.width
- //: Combo box label
- //% "Digest algorithm"
- label: qsTrId("foilauth-token-digest_algorithm-label")
- menu: ContextMenu {
- MenuItem { text: "MD5" }
- //: Menu item for the default digest algorithm
- //% "%1 (default)"
- MenuItem { text: qsTrId("foilauth-token-digest_algorithm-default").arg("SHA1") }
- MenuItem { text: "SHA256" }
- MenuItem { text: "SHA512" }
+ width: parent.columnWidth
+ //: Combo box label
+ //% "Digest algorithm"
+ label: qsTrId("foilauth-token-digest_algorithm-label")
+ menu: ContextMenu {
+ x: 0
+ width: algorithmComboBox.width
+ MenuItem { text: "MD5" }
+ //: Menu item for the default digest algorithm
+ //% "%1 (default)"
+ MenuItem { text: qsTrId("foilauth-token-digest_algorithm-default").arg("SHA1") }
+ MenuItem { text: "SHA256" }
+ MenuItem { text: "SHA512" }
+ }
+ Component.onCompleted: currentIndex = algorithm
+ onCurrentIndexChanged: algorithm = currentIndex
}
- Component.onCompleted: currentIndex = algorithm
- onCurrentIndexChanged: algorithm = currentIndex
- }
+ ComboBox {
+ id: typeComboBox
+
+ width: parent.columnWidth
+ //: Combo box label
+ //% "Type"
+ label: qsTrId("foilauth-token-type-label")
+ menu: ContextMenu {
+ x: 0
+ width: typeComboBox.width
+ //: Menu item for time based token
+ //% "Time-based (TOTP)"
+ MenuItem { text: qsTrId("foilauth-token-type-totp") }
+ //: Menu item for counter based token
+ //% "Counter-based (HOTP)"
+ MenuItem { text: qsTrId("foilauth-token-type-hotp") }
+ }
+ Component.onCompleted: currentIndex = type
+ onCurrentIndexChanged: type = currentIndex
+ }
+ }
VerticalPadding { }
Button {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/qml/ImportTokensDialog.qml
^
|
@@ -4,6 +4,7 @@
Dialog {
allowedOrientations: appAllowedOrientations
+ property bool firstTime: true
property int count
DialogHeader {
@@ -33,7 +34,8 @@
height: Theme.itemSizeLarge
Image {
- source: "images/sailotp.png"
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/sailotp.svg"
sourceSize: Qt.size(parent.height, parent.height)
smooth: true
}
@@ -45,6 +47,7 @@
}
Image {
+ anchors.verticalCenter: parent.verticalCenter
source: "images/foilauth.svg"
sourceSize: Qt.size(parent.height, parent.height)
smooth: true
@@ -54,9 +57,19 @@
Label {
x: Theme.horizontalPageMargin
width: parent.width - 2*x
- //: Text for import page
- //% "FoilAuth has found %0 unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?"
- text: qsTrId("foilauth-import-text",count).arg(count)
+ text: firstTime ?
+ //: Text for SailOTP import page (first import, one token)
+ //% "FoilAuth has found 1 unencrypted SailOTP token on your device. Would you like to import and encrypt it?"
+ ((count === 1) ? qsTrId("foilauth-import-first_one") :
+ //: Text for SailOTP import page (first import, multiple tokens)
+ //% "FoilAuth has found %0 unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?"
+ qsTrId("foilauth-import-first_many", count).arg(count)) :
+ //: Text for SailOTP import page (one new token is found)
+ //% "FoilAuth has found 1 new unencrypted SailOTP token on your device. Would you like to import and encrypt it?"
+ ((count === 1) ? qsTrId("foilauth-import-new_one") :
+ //: Text for SailOTP import page (multiple new tokens were found)
+ //% "FoilAuth has found %0 new unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?"
+ qsTrId("foilauth-import-new_many", count).arg(count))
wrapMode: Text.Wrap
color: Theme.highlightColor
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/qml/ScanPage.qml
^
|
@@ -27,10 +27,12 @@
//% "Add token"
dialogTitle: qsTrId("foilauth-add_token-title"),
canScan: true,
+ type: token.type,
label: token.label,
issuer: token.issuer,
secret: token.secret,
digits: token.digits,
+ counter: token.counter,
timeShift: token.timeshift,
algorithm: token.algorithm
})
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/qml/SelectPage.qml
^
|
@@ -80,6 +80,8 @@
currentPassword: model.currentPassword
nextPassword: model.nextPassword
favorite: model.favorite
+ hotp: model.type === FoilAuth.TypeHOTP
+ hotpMinus: model.counter > 0
landscape: thisPage.isLandscape
color: model.selected ? Theme.rgba(Theme.highlightBackgroundColor, 0.2) : "transparent"
selected: model.selected
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/qml/TokenListItem.qml
^
|
@@ -14,10 +14,14 @@
property string nextPassword
property string currentPassword
property bool favorite
+ property bool hotp
+ property bool hotpMinus
property bool landscape
property bool selected
signal favoriteToggled()
+ signal incrementCounter()
+ signal decrementCounter()
HarbourIconTextButton {
id: favoriteButton
@@ -57,7 +61,7 @@
}
font.pixelSize: Theme.fontSizeTiny
color: Theme.highlightColor
- visible: landscape
+ visible: landscape && !hotp
transform: HarbourTextFlip {
text: thisItem.prevPassword
target: prevPasswordLabel
@@ -94,39 +98,105 @@
}
font.pixelSize: Theme.fontSizeTiny
color: Theme.highlightColor
- visible: landscape
+ visible: landscape && !hotp
transform: HarbourTextFlip {
text: thisItem.nextPassword
target: nextPasswordLabel
}
}
+ HarbourIconTextButton {
+ id: leftCounterButton
+
+ anchors {
+ horizontalCenter: prevPasswordLabel.horizontalCenter
+ verticalCenter: parent.verticalCenter
+ }
+ iconSource: hotp ? (landscape ? (hotpMinus ? "images/minus.svg" : "") : "images/plus.svg" ) : ""
+ enabled: parent.interactive
+ highlighted: down || thisItem.selected
+ visible: hotp && currentPassword.length > 0
+ onClicked: {
+ if (!landscape) {
+ thisItem.incrementCounter()
+ } else if (hotpMinus) {
+ thisItem.decrementCounter()
+ }
+ }
+ }
+
+ HarbourIconTextButton {
+ anchors {
+ horizontalCenter: nextPasswordLabel.horizontalCenter
+ verticalCenter: parent.verticalCenter
+ }
+ iconSource: (landscape && hotp) ? "images/plus.svg" : ""
+ enabled: parent.interactive
+ highlighted: down || thisItem.selected
+ visible: landscape && hotp && currentPassword.length > 0
+ onClicked: thisItem.incrementCounter()
+ }
+
states: [
State {
name: "portrait"
- when: !landscape
+ changes: [
+ AnchorChanges {
+ target: currentPasswordLabel
+ anchors.right: parent.right
+ }
+ ]
+ },
+ State {
+ name: "portrait-totp"
+ extend: "portrait"
+ when: !landscape && !hotp
changes: [
AnchorChanges {
target: descriptionLabel
anchors.right: currentPasswordLabel.left
- },
+ }
+ ]
+ },
+ State {
+ name: "portrait-hotp"
+ extend: "portrait"
+ when: !landscape && hotp
+ changes: [
AnchorChanges {
- target: currentPasswordLabel
- anchors.right: parent.right
+ target: descriptionLabel
+ anchors.right: leftCounterButton.left
}
]
},
State {
name: "landscape"
- when: landscape
+ changes: [
+ AnchorChanges {
+ target: currentPasswordLabel
+ anchors.right: nextPasswordLabel.left
+ }
+ ]
+ },
+ State {
+ name: "landscape-totp"
+ extend: "landscape"
+ when: landscape && !hotp
changes: [
AnchorChanges {
target: descriptionLabel
anchors.right: prevPasswordLabel.left
- },
+ }
+ ]
+ },
+ State {
+ name: "landscape-hotp"
+ extend: "landscape"
+ when: landscape && hotp
+ changes: [
AnchorChanges {
- target: currentPasswordLabel
- anchors.right: nextPasswordLabel.left
+ target: descriptionLabel
+ anchors.right: hotpMinus ? leftCounterButton.left : currentPasswordLabel.left
}
]
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/qml/TokenListView.qml
^
|
@@ -45,21 +45,24 @@
}
Component.onCompleted: {
- if (!FoilAuthSettings.sailotpImportDone) {
- var n = SailOTP.fetchTokens()
- if (n > 0) {
- FoilAuthSettings.sailotpImportDone = true
- var dialog = pageStack.push(Qt.resolvedUrl("ImportTokensDialog.qml"), {
- count: n
+ SailOTP.importedTokens = FoilAuthSettings.sailotpImportedTokens
+ var n = SailOTP.fetchNewTokens(FoilAuthModel)
+ if (n > 0) {
+ var dialog = pageStack.push(Qt.resolvedUrl("ImportTokensDialog.qml"), {
+ firstTime: !FoilAuthSettings.sailotpImportDone,
+ count: n
+ })
+ if (dialog) {
+ dialog.accepted.connect(function() {
+ FoilAuthSettings.sailotpImportDone = true
+ FoilAuthSettings.sailotpImportedTokens = SailOTP.importedTokens
+ SailOTP.importTokens(FoilAuthModel)
+ })
+ dialog.rejected.connect(function() {
+ FoilAuthSettings.sailotpImportDone = true
+ FoilAuthSettings.sailotpImportedTokens = SailOTP.importedTokens
+ SailOTP.dropTokens()
})
- if (dialog) {
- dialog.accepted.connect(function() {
- SailOTP.importTokens(FoilAuthModel)
- })
- dialog.rejected.connect(function() {
- SailOTP.dropTokens()
- })
- }
}
}
}
@@ -138,8 +141,6 @@
}
}
MenuItem {
- id: newNoteMenuItem
-
//: Pulley menu item, creates a new authentication token
//% "Add token"
text: qsTrId("foilauth-menu-new_auth_token")
@@ -160,8 +161,8 @@
})
}
function tokenAccepted(dialog) {
- FoilAuthModel.addToken(dialog.secret, dialog.label, dialog.issuer,
- dialog.digits, dialog.timeshift, dialog.algorithm)
+ FoilAuthModel.addToken(dialog.type, dialog.secret, dialog.label, dialog.issuer,
+ dialog.digits, dialog.counter, dialog.timeshift, dialog.algorithm)
}
}
}
@@ -254,13 +255,10 @@
menu: Component {
ContextMenu {
MenuItem {
- //: Context menu item (copy to clipboard)
- //% "Copy"
- text: qsTrId("foilauth-menu-copy")
- onClicked: {
- Clipboard.text = model.currentPassword
- clipboardNotification.publish()
- }
+ //: Context menu item (copy password to clipboard)
+ //% "Copy password"
+ text: qsTrId("foilauth-menu-copy_password")
+ onClicked: Clipboard.text = model.currentPassword
}
MenuItem {
//: Context menu item
@@ -269,7 +267,8 @@
onClicked: {
pageStack.push(Qt.resolvedUrl("QRCodePage.qml"), {
allowedOrientations: mainPage.allowedOrientations,
- uri: FoilAuth.toUri(model.secret, model.label, model.issuer, model.digits, model.timeShift, model.algorithm)
+ uri: FoilAuth.toUri(model.type, model.secret, model.label, model.issuer,
+ model.digits, model.counter, model.timeShift, model.algorithm)
})
}
}
@@ -286,11 +285,13 @@
//: Dialog title
//% "Edit token"
dialogTitle: qsTrId("foilauth-edit_token-title"),
+ type: model.type,
label: model.label,
secret: model.secret,
issuer: model.issuer,
algorithm: model.algorithm,
digits: model.digits,
+ counter: model.counter,
timeShift: model.timeShift
}).tokenAccepted.connect(function(dialog) {
item.updateToken(dialog)
@@ -328,6 +329,8 @@
currentPassword: model.currentPassword
nextPassword: model.nextPassword
favorite: model.favorite
+ hotp: model.type === FoilAuth.TypeHOTP
+ hotpMinus: model.counter > 0
landscape: tokenList.isLandscape
color: dragging ? Theme.rgba(Theme.highlightBackgroundColor, 0.2) : "transparent"
selected: tokenListDelegate.down
@@ -335,6 +338,8 @@
opacity: enabled ? 1 : 0.2
onFavoriteToggled: model.favorite = !model.favorite
+ onIncrementCounter: model.counter++
+ onDecrementCounter: model.counter--
Behavior on color { ColorAnimation { duration: 150 } }
}
@@ -407,12 +412,13 @@
}
function updateToken(token) {
+ model.type = token.type
model.issuer = token.issuer
model.secret = token.secret
model.label = token.label
- //model.issuer = token.issuer
model.algorithm = token.algorithm
model.digits = token.digits
+ model.counter = token.counter
model.timeShift = token.timeShift
}
@@ -426,7 +432,12 @@
pressY = mouseY
}
- onClicked: cancelDrag()
+ onClicked: {
+ Clipboard.text = model.currentPassword
+ clipboardNotification.publish()
+ cancelDrag()
+ }
+
onPressAndHold: cancelDrag()
onReleased: stopDrag(tokenListDelegate)
onCanceled: stopDrag(tokenListDelegate)
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/qml/images/minus.svg
^
|
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<svg
+ version="1.1"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ x="0px"
+ y="0px"
+ width="64px"
+ height="64px"
+ viewBox="0 0 64 64"
+ style="enable-background:new 0 0 64 64"
+ xml:space="preserve">
+ <g>
+ <rect
+ style="opacity:0;fill:#ffffff"
+ width="64"
+ height="64"/>
+ <circle
+ style="opacity:0.2;fill:#ffffff"
+ cx="32"
+ cy="32"
+ r="24"/>
+ <path
+ style="fill:#ffffff"
+ d="M44,33L44,33l-24-0c-0.552,0-1-0.448-1-1s0.448-1,1-1l0,0l24,0 c0.553,0,1,0.448,1,1S44.552,33,44,33z"/>
+ </g>
+</svg>
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/qml/images/plus.svg
^
|
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ version="1.1"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ x="0px"
+ y="0px"
+ width="64px"
+ height="64px"
+ viewBox="0 0 64 64"
+ style="enable-background:new 0 0 64 64"
+ xml:space="preserve">
+ <g>
+ <rect
+ style="opacity:0;fill:#ffffff"
+ width="64"
+ height="64"/>
+ <circle
+ style="opacity:0.2;fill:#ffffff"
+ cx="32"
+ cy="32"
+ r="24"/>
+ <path
+ style="fill:#ffffff"
+ d="M 32 19 C 31.448 19 31 19.448 31 20 L 31 31 L 20 31 C 19.448 31 19 31.448 19 32 C 19 32.552 19.448 33 20 33 L 31 33 L 31 44 C 31 44.552 31.448 45 32 45 C 32.552 45 33 44.553 33 44 L 33 33 L 44 33 C 44.552 33 45 32.552 45 32 C 45 31.448 44.553 31 44 31 L 33 31 L 33 20 C 33 19.448 32.552 19 32 19 z "/>
+ </g>
+</svg>
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/qml/images/sailotp.svg
^
|
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100%" height="100%" viewBox="0 0 86 86" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
+ <g id="Layer_1">
+ <path d="M84.277,85.674C85.063,85.674 85.7,85.037 85.7,84.251L85.7,42.987C85.7,19.411 66.583,0.3 43,0.3C19.418,0.3 0.3,19.411 0.3,42.987C0.3,66.563 19.418,85.675 43,85.675C43.636,85.675 84.277,85.674 84.277,85.674Z" style="fill:url(#_Linear1);fill-rule:nonzero;"/>
+ <g transform="matrix(0.211288,0,0,0.211288,13.6147,13.7701)">
+ <path d="M287.305,243.005C287.169,241.233 286.377,239.529 285.078,238.258L172.835,126.015C177.251,115.612 179.582,104.346 179.582,92.703C179.582,69.949 170.707,48.54 154.644,32.437C138.558,16.366 117.164,7.5 94.397,7.5C71.619,7.5 50.262,16.369 34.15,32.45C0.907,65.675 0.9,119.716 34.145,152.938C50.256,169.053 71.62,177.928 94.386,177.928C106.032,177.928 117.27,175.578 127.698,171.156L164.572,208.058C166.106,209.573 168.129,210.377 170.312,210.306L190.407,209.601L189.751,229.746C189.689,231.871 190.456,233.939 191.996,235.452C193.48,236.964 195.565,237.786 197.681,237.7L217.85,237.011L217.126,257.134C217.063,259.261 217.88,261.333 219.364,262.846C220.898,264.358 222.685,265.171 225.104,265.097L245.223,264.413L244.549,284.539C244.431,286.771 245.371,288.918 246.967,290.442C248.439,291.781 250.276,292.502 252.212,292.502C252.49,292.502 252.775,292.49 253.059,292.465L283.91,289.039C288.079,288.584 291.115,284.864 290.757,280.686L287.305,243.005ZM84.106,82.415C74.63,91.881 59.31,91.881 49.854,82.415C40.384,72.946 40.384,57.629 49.854,48.169C59.31,38.709 74.625,38.7 84.106,48.166C93.563,57.625 93.557,72.952 84.106,82.415ZM260.97,245.575C259.844,246.701 258.335,247.263 256.869,247.263C255.403,247.263 253.893,246.7 252.768,245.575L157.267,150.046C159.926,147.179 162.344,144.161 164.54,140.988L260.969,237.398C263.221,239.65 263.221,243.324 260.97,245.575Z" style="fill:white;fill-rule:nonzero;"/>
+ </g>
+ <g transform="matrix(1.72062,0,0,1.72062,-21.2913,-21.4266)">
+ <circle cx="31.868" cy="31.826" r="7.722" style="fill:rgb(228,86,70);fill-opacity:0.22;"/>
+ </g>
+ </g>
+ <defs>
+ <linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0,42.6872,-42.7001,0,43,42.9873)"><stop offset="0" style="stop-color:rgb(228,86,70);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(139,49,55);stop-opacity:1"/></linearGradient>
+ </defs>
+</svg>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/FoilAuth.cpp
^
|
@@ -238,7 +238,12 @@
uint FoilAuth::TOTP(QByteArray aSecret, quint64 aTime, uint aMaxPass, DigestAlgorithm aAlgorithm)
{
- const guint64 msg = htobe64(aTime/PERIOD);
+ return FoilAuth::HOTP(aSecret, aTime/PERIOD, aMaxPass, aAlgorithm);
+}
+
+uint FoilAuth::HOTP(QByteArray aSecret, quint64 aCounter, uint aMaxPass, DigestAlgorithm aAlgorithm)
+{
+ const guint64 msg = htobe64(aCounter);
GType (*digest_type)(void) = foil_impl_digest_sha1_get_type;
switch (aAlgorithm) {
case DigestAlgorithmMD5:
@@ -267,14 +272,17 @@
return mini_hash % aMaxPass;
}
-QString FoilAuth::toUri(QString aSecretBase32, QString aLabel, QString aIssuer,
- int aDigits, int aTimeShift, Algorithm aAlgorithm)
+QString FoilAuth::toUri(Type aType, QString aSecretBase32, QString aLabel,
+ QString aIssuer, int aDigits, quint64 aCounter, int aTimeShift,
+ Algorithm aAlgorithm)
{
QByteArray secret(fromBase32(aSecretBase32));
if (!secret.isEmpty()) {
- HDEBUG(aSecretBase32 << aLabel << aIssuer << aDigits << aTimeShift << aAlgorithm);
- return FoilAuthToken(secret, aLabel, aIssuer, aDigits, aTimeShift,
- (DigestAlgorithm) aAlgorithm).toUri();
+ QString uri = FoilAuthToken((AuthType)aType, secret, aLabel, aIssuer, aDigits,
+ aCounter, aTimeShift, (DigestAlgorithm) aAlgorithm).toUri();
+ HDEBUG(aType << aSecretBase32 << aLabel << aIssuer << aDigits <<
+ aCounter << aTimeShift << aAlgorithm << "=>" << uri);
+ return uri;
}
return QString();
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/FoilAuth.h
^
|
@@ -53,6 +53,7 @@
Q_PROPERTY(bool otherFoilAppsInstalled READ otherFoilAppsInstalled NOTIFY otherFoilAppsInstalledChanged)
Q_DISABLE_COPY(FoilAuth)
Q_ENUMS(Algorithm)
+ Q_ENUMS(Type)
public:
static const int PERIOD = 30;
@@ -66,6 +67,12 @@
DefaultAlgorithm = DEFAULT_ALGORITHM
};
+ enum Type {
+ TypeTOTP = AuthTypeTOTP,
+ TypeHOTP = AuthTypeHOTP,
+ DefaultType = DEFAULT_AUTH_TYPE
+ };
+
explicit FoilAuth(QObject* aParent = Q_NULLPTR);
// Callback for qmlRegisterSingletonType<FoilAuth>
@@ -83,10 +90,13 @@
static QString migrationUri(QByteArray aData);
static uint TOTP(QByteArray aSecret, quint64 aTime, uint aMaxPass,
DigestAlgorithm aAlgorithm = DEFAULT_ALGORITHM);
+ static uint HOTP(QByteArray aSecret, quint64 aCounter, uint aMaxPass,
+ DigestAlgorithm aAlgorithm = DEFAULT_ALGORITHM);
// Invokable from QML
- Q_INVOKABLE static QString toUri(QString aSecretBase32, QString aLabel,
- QString aIssuer, int aDigits, int aTimeShift, Algorithm aAlgorithm);
+ Q_INVOKABLE static QString toUri(Type aType, QString aSecretBase32,
+ QString aLabel, QString aIssuer, int aDigits, quint64 aCounter,
+ int aTimeShift, Algorithm aAlgorithm);
Q_INVOKABLE static QVariantMap parseUri(QString aUri);
Q_INVOKABLE static QVariantList parseMigrationUri(QString aUri);
Q_INVOKABLE static bool isValidBase32(QString aBase32);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/FoilAuthFavoritesModel.cpp
^
|
@@ -33,6 +33,7 @@
#include "FoilAuthFavoritesModel.h"
#include "FoilAuthModel.h"
+#include "FoilAuth.h"
#include "HarbourDebug.h"
@@ -45,29 +46,52 @@
public:
Private(FoilAuthFavoritesModel* aParent);
- FoilAuthFavoritesModel* parentModel();
+ FoilAuthFavoritesModel* parentModel() const;
+ bool needTimer() const;
+ void updateNeedTimer();
public Q_SLOTS:
void checkCount();
+ void onDataChanged(const QModelIndex& aTopLeft, const QModelIndex& aBottomRight,
+ const QVector<int>& aRoles);
public:
int iLastKnownCount;
+ bool iNeedTimer;
};
FoilAuthFavoritesModel::Private::Private(FoilAuthFavoritesModel* aParent) :
QObject(aParent),
- iLastKnownCount(0)
+ iLastKnownCount(0),
+ iNeedTimer(needTimer())
{
connect(aParent, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(checkCount()));
connect(aParent, SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(checkCount()));
connect(aParent, SIGNAL(modelReset()), SLOT(checkCount()));
+ connect(aParent, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
+ SLOT(onDataChanged(QModelIndex,QModelIndex,QVector<int>)));
}
-inline FoilAuthFavoritesModel* FoilAuthFavoritesModel::Private::parentModel()
+inline FoilAuthFavoritesModel* FoilAuthFavoritesModel::Private::parentModel() const
{
return qobject_cast<FoilAuthFavoritesModel*>(parent());
}
+bool FoilAuthFavoritesModel::Private::needTimer() const
+{
+ FoilAuthFavoritesModel* model = parentModel();
+ const int count = model->rowCount();
+ for (int row = 0; row < count; row++) {
+ bool ok;
+ const int type = model->data(model->index(row, 0),
+ FoilAuthModel::typeRole()).toInt(&ok);
+ if (ok && type == FoilAuth::TypeTOTP) {
+ return true;
+ }
+ }
+ return false;
+}
+
void FoilAuthFavoritesModel::Private::checkCount()
{
FoilAuthFavoritesModel* model = parentModel();
@@ -76,6 +100,24 @@
iLastKnownCount = count;
Q_EMIT model->countChanged();
}
+ updateNeedTimer();
+}
+
+void FoilAuthFavoritesModel::Private::onDataChanged(const QModelIndex& aTopLeft,
+ const QModelIndex& aBottomRight, const QVector<int>& aRoles)
+{
+ if (aRoles.isEmpty() || aRoles.contains(FoilAuthModel::typeRole())) {
+ updateNeedTimer();
+ }
+}
+
+void FoilAuthFavoritesModel::Private::updateNeedTimer()
+{
+ const bool need = needTimer();
+ if (iNeedTimer != need) {
+ iNeedTimer = need;
+ Q_EMIT parentModel()->needTimerChanged();
+ }
}
// ==========================================================================
@@ -96,6 +138,11 @@
setSourceModel(qobject_cast<QAbstractItemModel*>(aModel));
}
+bool FoilAuthFavoritesModel::needTimer() const
+{
+ return iPrivate->iNeedTimer;
+}
+
bool FoilAuthFavoritesModel::filterAcceptsRow(int aSourceRow,
const QModelIndex& aParent) const
{
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/FoilAuthFavoritesModel.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019-2020 Jolla Ltd.
- * Copyright (C) 2019-2020 Slava Monich <slava@monich.com>
+ * Copyright (C) 2019-2021 Jolla Ltd.
+ * Copyright (C) 2019-2021 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -40,18 +40,21 @@
class FoilAuthFavoritesModel : public QSortFilterProxyModel {
Q_OBJECT
Q_PROPERTY(QObject* sourceModel READ sourceModel WRITE setSourceModelObject NOTIFY sourceModelObjectChanged)
+ Q_PROPERTY(bool needTimer READ needTimer NOTIFY needTimerChanged)
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
public:
FoilAuthFavoritesModel(QObject* aParent = Q_NULLPTR);
void setSourceModelObject(QObject* aModel);
+ bool needTimer() const;
protected:
bool filterAcceptsRow(int aSourceRow, const QModelIndex& aParent) const Q_DECL_OVERRIDE;
Q_SIGNALS:
void sourceModelObjectChanged();
+ void needTimerChanged();
void countChanged();
private:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/FoilAuthModel.cpp
^
|
@@ -63,10 +63,13 @@
#define HEADER_LABEL "OTP-Label"
#define HEADER_ISSUER "OTP-Issuer"
+#define HEADER_TYPE "OTP-Type"
#define HEADER_ALGORITHM "OTP-Algorithm"
#define HEADER_DIGITS "OTP-Digits"
-#define HEADER_TIMESHIFT "OTP-TimeShift"
+#define HEADER_COUNTER "OTP-Counter" // HOTP specific
+#define HEADER_TIMESHIFT "OTP-TimeShift" // TOTP specific
#define HEADER_FAVORITE "OTP-Favorite"
+#define MAX_HEADERS 8
// Directories relative to home
#define FOIL_AUTH_DIR "Documents/FoilAuth"
@@ -83,10 +86,12 @@
#define FOILAUTH_ROLES_(first,role,last) \
first(ModelId,modelId) \
role(Favorite,favorite) \
+ role(Type,type) \
role(Secret,secret) \
role(Issuer,issuer) \
role(Digits,digits) \
role(Algorithm,algorithm) \
+ role(Counter,counter) \
role(TimeShift,timeShift) \
role(Label,label) \
role(PrevPassword,prevPassword) \
@@ -134,8 +139,10 @@
typedef QList<ModelData*> List;
- ModelData(QString aPath, QByteArray aSecret, QString aLabel, QString aIssuer,
+ ModelData(QString aPath, AuthType aType,
+ QByteArray aSecret, QString aLabel, QString aIssuer,
int aDigits = FoilAuthToken::DEFAULT_DIGITS,
+ int aCounter = FoilAuthToken::DEFAULT_COUNTER,
int aTimeShift = FoilAuthToken::DEFAULT_TIMESHIFT,
DigestAlgorithm aAlgorithm = DEFAULT_ALGORITHM,
bool aFavorite = true);
@@ -145,8 +152,10 @@
QString label() { return iToken.iLabel; }
void setTokenPath(QString aPath);
+ static AuthType headerAuthType(const FoilMsg* aMsg);
static DigestAlgorithm headerAlgorithm(const FoilMsg* aMsg);
static QString headerString(const FoilMsg* aMsg, const char* aKey);
+ static quint64 headerUint64(const FoilMsg* aMsg, const char* aKey, quint64 aDefault);
static int headerInt(const FoilMsg* aMsg, const char* aKey, int aDefault);
static bool headerBool(const FoilMsg* aMsg, const char* aKey, bool aDefault);
@@ -161,13 +170,14 @@
QString iNextPassword;
};
-FoilAuthModel::ModelData::ModelData(QString aPath, QByteArray aSecret,
- QString aLabel, QString aIssuer, int aDigits, int aTimeShift,
- DigestAlgorithm aAlgorithm, bool aFavorite) :
+FoilAuthModel::ModelData::ModelData(QString aPath, AuthType aType,
+ QByteArray aSecret, QString aLabel, QString aIssuer, int aDigits,
+ int aCounter, int aTimeShift, DigestAlgorithm aAlgorithm,
+ bool aFavorite) :
iPath(aPath),
iId(QFileInfo(aPath).fileName()),
iFavorite(aFavorite),
- iToken(aSecret, aLabel, aIssuer, aDigits, aTimeShift, aAlgorithm),
+ iToken(aType, aSecret, aLabel, aIssuer, aDigits, aCounter, aTimeShift, aAlgorithm),
iSecretBase32(FoilAuth::toBase32(aSecret))
{
HDEBUG(iSecretBase32 << aLabel);
@@ -198,7 +208,9 @@
case SecretRole: return iSecretBase32;
case IssuerRole: return iToken.iIssuer;
case DigitsRole: return iToken.iDigits;
- case AlgorithmRole: return iToken.iAlgorithm;
+ case TypeRole: return (int)iToken.iType;
+ case AlgorithmRole: return (int)iToken.iAlgorithm;
+ case CounterRole: return iToken.iCounter;
case TimeShiftRole: return iToken.iTimeShift;
case LabelRole: return iToken.iLabel;
case PrevPasswordRole: return iPrevPassword;
@@ -208,6 +220,19 @@
return QVariant();
}
+FoilAuthTypes::AuthType FoilAuthModel::ModelData::headerAuthType(const FoilMsg* aMsg)
+{
+ const char* value = foilmsg_get_value(aMsg, HEADER_TYPE);
+ if (value) {
+ if (!g_ascii_strcasecmp(value, FOILAUTH_TYPE_TOTP)) {
+ return AuthTypeTOTP;
+ } else if (!g_ascii_strcasecmp(value, FOILAUTH_TYPE_HOTP)) {
+ return AuthTypeHOTP;
+ }
+ }
+ return DEFAULT_AUTH_TYPE;
+}
+
FoilAuthTypes::DigestAlgorithm FoilAuthModel::ModelData::headerAlgorithm(const FoilMsg* aMsg)
{
const char* value = foilmsg_get_value(aMsg, HEADER_ALGORITHM);
@@ -231,6 +256,14 @@
return (value && value[0]) ? QString::fromLatin1(value) : QString();
}
+quint64 FoilAuthModel::ModelData::headerUint64(const FoilMsg* aMsg, const char* aKey, quint64 aDefault)
+{
+ const char* str = foilmsg_get_value(aMsg, aKey);
+ guint64 value = aDefault;
+ gutil_parse_uint64(str, 10, &value);
+ return value;
+}
+
int FoilAuthModel::ModelData::headerInt(const FoilMsg* aMsg, const char* aKey, int aDefault)
{
const char* str = foilmsg_get_value(aMsg, aKey);
@@ -562,11 +595,25 @@
FoilOutput* out = FoilAuth::createFoilFile(iDestDir, dest);
if (out) {
FoilMsgHeaders headers;
- FoilMsgHeader header[6];
+ FoilMsgHeader header[MAX_HEADERS];
headers.header = header;
headers.count = 0;
+ if (iToken.iType != DEFAULT_AUTH_TYPE) {
+ header[headers.count].name = HEADER_TYPE;
+ header[headers.count].value = FOILAUTH_TYPE_DEFAULT;
+ switch (iToken.iType) {
+ case AuthTypeTOTP:
+ header[headers.count].value = FOILAUTH_TYPE_TOTP;
+ break;
+ case AuthTypeHOTP:
+ header[headers.count].value = FOILAUTH_TYPE_HOTP;
+ break;
+ }
+ headers.count++;
+ }
+
const QByteArray label(iToken.iLabel.toUtf8());
header[headers.count].name = HEADER_LABEL;
header[headers.count].value = label.constData();
@@ -600,6 +647,14 @@
headers.count++;
}
+ char counter[16];
+ if (iToken.iCounter != FoilAuthToken::DEFAULT_COUNTER) {
+ snprintf(counter, sizeof(counter), "%llu", iToken.iCounter);
+ header[headers.count].name = HEADER_COUNTER;
+ header[headers.count].value = counter;
+ headers.count++;
+ }
+
if (iToken.iAlgorithm != DEFAULT_ALGORITHM) {
header[headers.count].name = HEADER_ALGORITHM;
header[headers.count].value = FOILAUTH_ALGORITHM_DEFAULT;
@@ -638,10 +693,14 @@
unlink(dest->str);
}
- if (iTime && !isCanceled()) {
+ if ((iTime || iToken.iType != FoilAuth::AuthTypeTOTP) && !isCanceled()) {
iCurrentPassword = iToken.passwordString(iTime);
- iPrevPassword = iToken.passwordString(iTime - FoilAuth::PERIOD);
- iNextPassword = iToken.passwordString(iTime + FoilAuth::PERIOD);
+ if (iToken.iType == FoilAuth::AuthTypeTOTP) {
+ iPrevPassword = iToken.passwordString(iTime - FoilAuth::PERIOD);
+ iNextPassword = iToken.passwordString(iTime + FoilAuth::PERIOD);
+ } else {
+ iPrevPassword = iNextPassword = iCurrentPassword;
+ }
HDEBUG(qPrintable(iPrevPassword) << qPrintable(iCurrentPassword) <<
qPrintable(iNextPassword));
}
@@ -790,10 +849,12 @@
if (msg) {
QByteArray bytes(FoilAuth::toByteArray(msg->data));
if (bytes.length() > 0) {
- ModelData* data = new ModelData(aPath, bytes,
+ ModelData* data = new ModelData(aPath,
+ ModelData::headerAuthType(msg), bytes,
ModelData::headerString(msg, HEADER_LABEL),
ModelData::headerString(msg, HEADER_ISSUER),
ModelData::headerInt(msg, HEADER_DIGITS, FoilAuthToken::DEFAULT_DIGITS),
+ ModelData::headerUint64(msg, HEADER_COUNTER, FoilAuthToken::DEFAULT_COUNTER),
ModelData::headerInt(msg, HEADER_TIMESHIFT, FoilAuthToken::DEFAULT_TIMESHIFT),
ModelData::headerAlgorithm(msg),
ModelData::headerBool(msg, HEADER_FAVORITE, false));
@@ -913,6 +974,7 @@
ModelData* findData(QString aId) const;
QList<FoilAuthToken> getTokens(const QList<int> aRows) const;
int findDataPos(QString aId) const;
+ bool needTimer() const;
void queueSignal(Signal aSignal);
void emitQueuedSignals();
void checkTimer();
@@ -1242,9 +1304,22 @@
return false;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/FoilAuthModel.h
^
|
@@ -83,6 +83,7 @@
FoilAuthModel(QObject* aParent = NULL);
+ static int typeRole();
static int favoriteRole();
int period() const;
@@ -94,6 +95,7 @@
int indexOf(const FoilAuthToken* aToken) const;
bool contains(const FoilAuthToken* aToken) const;
+ bool containsSecret(QByteArray aToken) const;
void addToken(const FoilAuthToken* aToken, bool aFavorite);
Q_INVOKABLE void generateKey(int aBits, QString aPassword);
@@ -103,8 +105,9 @@
Q_INVOKABLE bool unlock(QString aPassword);
Q_INVOKABLE int millisecondsLeft();
- Q_INVOKABLE bool addToken(QString aTokenBase32, QString aLabel,
- QString aIssuer, int aDigits, int aTimeShift, int aAlgorithm);
+ Q_INVOKABLE bool addToken(int aType, QString aTokenBase32,
+ QString aLabel, QString aIssuer, int aDigits, int aCounter,
+ int aTimeShift, int aAlgorithm);
Q_INVOKABLE bool addTokenUri(QString aUri);
Q_INVOKABLE void deleteToken(QString aId);
Q_INVOKABLE void deleteTokens(QStringList aIds);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/FoilAuthSettings.cpp
^
|
@@ -44,16 +44,16 @@
#define KEY_MAX_ZOOM DCONF_KEY("maxZoom")
#define KEY_SCAN_ZOOM DCONF_KEY("scanZoom")
#define KEY_SCAN_WIDE_MODE DCONF_KEY("scanWideMode")
-#define KEY_SAILOTP_IMPORT_DONE DCONF_KEY("sailotpImportDone")
#define KEY_SHARED_KEY_WARNING DCONF_KEY("sharedKeyWarning")
#define KEY_SHARED_KEY_WARNING2 DCONF_KEY("sharedKeyWarning2")
#define KEY_AUTO_LOCK_TIME DCONF_KEY("autoLockTime")
+#define KEY_SAILOTP_IMPORT_DONE DCONF_KEY("sailotpImportDone")
+#define KEY_SAILOTP_IMPORTED_TOKENS DCONF_KEY("sailotpImportedTokens")
#define DEFAULT_QRCODE_ECLEVEL ((int)HarbourQrCodeGenerator::ECLevelLowest)
#define DEFAULT_MAX_ZOOM 10.f
#define DEFAULT_SCAN_ZOOM 3.f
#define DEFAULT_SCAN_WIDE_MODE false
-#define DEFAULT_SAILOTP_IMPORT_DONE false
#define DEFAULT_SHARED_KEY_WARNING true
#define DEFAULT_AUTO_LOCK_TIME 15000
@@ -72,10 +72,11 @@
MGConfItem* iMaxZoom;
MGConfItem* iScanZoom;
MGConfItem* iScanWideMode;
- MGConfItem* iSailotpImportDone;
MGConfItem* iSharedKeyWarning;
MGConfItem* iSharedKeyWarning2;
MGConfItem* iAutoLockTime;
+ MGConfItem* iSailotpImportDone;
+ MGConfItem* iSailotpImportedTokens;
QVariant iDefaultSharedKeyWarning;
QVariant iDefaultAutoLockTime;
};
@@ -85,10 +86,11 @@
iMaxZoom(new MGConfItem(KEY_MAX_ZOOM, aParent)),
iScanZoom(new MGConfItem(KEY_SCAN_ZOOM, aParent)),
iScanWideMode(new MGConfItem(KEY_SCAN_WIDE_MODE, aParent)),
- iSailotpImportDone(new MGConfItem(KEY_SAILOTP_IMPORT_DONE, aParent)),
iSharedKeyWarning(new MGConfItem(KEY_SHARED_KEY_WARNING, aParent)),
iSharedKeyWarning2(new MGConfItem(KEY_SHARED_KEY_WARNING2, aParent)),
iAutoLockTime(new MGConfItem(KEY_AUTO_LOCK_TIME, aParent)),
+ iSailotpImportDone(new MGConfItem(KEY_SAILOTP_IMPORT_DONE, aParent)),
+ iSailotpImportedTokens(new MGConfItem(KEY_SAILOTP_IMPORTED_TOKENS, aParent)),
iDefaultSharedKeyWarning(DEFAULT_SHARED_KEY_WARNING),
iDefaultAutoLockTime(DEFAULT_AUTO_LOCK_TIME)
{
@@ -100,14 +102,16 @@
aParent, SIGNAL(scanZoomChanged()));
QObject::connect(iScanWideMode, SIGNAL(valueChanged()),
aParent, SIGNAL(scanWideModeChanged()));
- QObject::connect(iSailotpImportDone, SIGNAL(valueChanged()),
- aParent, SIGNAL(sailotpImportDoneChanged()));
QObject::connect(iSharedKeyWarning, SIGNAL(valueChanged()),
aParent, SIGNAL(sharedKeyWarningChanged()));
QObject::connect(iSharedKeyWarning2, SIGNAL(valueChanged()),
aParent, SIGNAL(sharedKeyWarning2Changed()));
QObject::connect(iAutoLockTime, SIGNAL(valueChanged()),
aParent, SIGNAL(autoLockTimeChanged()));
+ QObject::connect(iSailotpImportDone, SIGNAL(valueChanged()),
+ aParent, SIGNAL(sailotpImportDoneChanged()));
+ QObject::connect(iSailotpImportedTokens, SIGNAL(valueChanged()),
+ aParent, SIGNAL(sailotpImportedTokensChanged()));
}
inline int
@@ -208,22 +212,6 @@
iPrivate->iScanWideMode->set(aValue);
}
-// sailotpImportDone
-
-bool
-FoilAuthSettings::sailotpImportDone() const
-{
- return iPrivate->iSailotpImportDone->value(DEFAULT_SAILOTP_IMPORT_DONE).toBool();
-}
-
-void
-FoilAuthSettings::setSailotpImportDone(
- bool aValue)
-{
- HDEBUG(aValue);
- iPrivate->iSailotpImportDone->set(aValue);
-}
-
// sharedKeyWarning
// sharedKeyWarning2
@@ -273,3 +261,35 @@
HDEBUG(aValue);
iPrivate->iAutoLockTime->set(aValue);
}
+
+// sailotpImportDone
+
+bool
+FoilAuthSettings::sailotpImportDone() const
+{
+ return iPrivate->iSailotpImportDone->value(false).toBool();
+}
+
+void
+FoilAuthSettings::setSailotpImportDone(
+ bool aValue)
+{
+ HDEBUG(aValue);
+ iPrivate->iSailotpImportDone->set(aValue);
+}
+
+// sailotpImportedTokens
+
+QStringList
+FoilAuthSettings::sailotpImportedTokens() const
+{
+ return iPrivate->iSailotpImportedTokens->value(QStringList()).toStringList();
+}
+
+void
+FoilAuthSettings::setSailotpImportedTokens(
+ QStringList aValue)
+{
+ HDEBUG(aValue);
+ iPrivate->iSailotpImportedTokens->set(aValue);
+}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/FoilAuthSettings.h
^
|
@@ -36,16 +36,21 @@
#include <QtQml>
+// Note that sailotpImportedTokens stores SHA1 hash of the secrets
+// imported from SailOTP, not the actual secrets. In other words,
+// it's not much of a security flaw.
+
class FoilAuthSettings : public QObject {
Q_OBJECT
Q_PROPERTY(int qrCodeEcLevel READ qrCodeEcLevel WRITE setQrCodeEcLevel NOTIFY qrCodeEcLevelChanged)
Q_PROPERTY(qreal scanZoom READ scanZoom WRITE setScanZoom NOTIFY scanZoomChanged)
Q_PROPERTY(qreal maxZoom READ maxZoom WRITE setMaxZoom NOTIFY maxZoomChanged)
Q_PROPERTY(bool scanWideMode READ scanWideMode WRITE setScanWideMode NOTIFY scanWideModeChanged)
- Q_PROPERTY(bool sailotpImportDone READ sailotpImportDone WRITE setSailotpImportDone NOTIFY sailotpImportDoneChanged)
Q_PROPERTY(bool sharedKeyWarning READ sharedKeyWarning WRITE setSharedKeyWarning NOTIFY sharedKeyWarningChanged)
Q_PROPERTY(bool sharedKeyWarning2 READ sharedKeyWarning2 WRITE setSharedKeyWarning2 NOTIFY sharedKeyWarning2Changed)
Q_PROPERTY(int autoLockTime READ autoLockTime WRITE setAutoLockTime NOTIFY autoLockTimeChanged)
+ Q_PROPERTY(bool sailotpImportDone READ sailotpImportDone WRITE setSailotpImportDone NOTIFY sailotpImportDoneChanged)
+ Q_PROPERTY(QStringList sailotpImportedTokens READ sailotpImportedTokens WRITE setSailotpImportedTokens NOTIFY sailotpImportedTokensChanged)
Q_DISABLE_COPY(FoilAuthSettings)
public:
@@ -66,9 +71,6 @@
bool scanWideMode() const;
void setScanWideMode(bool aValue);
- bool sailotpImportDone() const;
- void setSailotpImportDone(bool aValue);
-
bool sharedKeyWarning() const;
bool sharedKeyWarning2() const;
void setSharedKeyWarning(bool aValue);
@@ -77,15 +79,22 @@
int autoLockTime() const;
void setAutoLockTime(int aValue);
+ bool sailotpImportDone() const;
+ void setSailotpImportDone(bool aValue);
+
+ QStringList sailotpImportedTokens() const;
+ void setSailotpImportedTokens(QStringList aValue);
+
Q_SIGNALS:
void qrCodeEcLevelChanged();
void maxZoomChanged();
void scanZoomChanged();
void scanWideModeChanged();
- void sailotpImportDoneChanged();
void sharedKeyWarningChanged();
void sharedKeyWarning2Changed();
void autoLockTimeChanged();
+ void sailotpImportDoneChanged();
+ void sailotpImportedTokensChanged();
private:
class Private;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/FoilAuthToken.cpp
^
|
@@ -48,8 +48,9 @@
#define FOILAUTH_KEY_SECRET "secret"
#define FOILAUTH_KEY_ISSUER "issuer"
#define FOILAUTH_KEY_DIGITS "digits"
-#define FOILAUTH_KEY_ALGORITHM "algorithm"
+#define FOILAUTH_KEY_COUNTER "counter"
#define FOILAUTH_KEY_TIMESHIFT "timeshift"
+#define FOILAUTH_KEY_ALGORITHM "algorithm"
const QString FoilAuthToken::KEY_VALID("valid");
const QString FoilAuthToken::KEY_TYPE(FOILAUTH_KEY_TYPE);
@@ -57,11 +58,9 @@
const QString FoilAuthToken::KEY_SECRET(FOILAUTH_KEY_SECRET);
const QString FoilAuthToken::KEY_ISSUER(FOILAUTH_KEY_ISSUER);
const QString FoilAuthToken::KEY_DIGITS(FOILAUTH_KEY_DIGITS);
-const QString FoilAuthToken::KEY_ALGORITHM(FOILAUTH_KEY_ALGORITHM);
+const QString FoilAuthToken::KEY_COUNTER(FOILAUTH_KEY_COUNTER);
const QString FoilAuthToken::KEY_TIMESHIFT(FOILAUTH_KEY_TIMESHIFT);
-
-#define FOILAUTH_TYPE_TOTP "totp"
-#define FOILAUTH_TYPE_HOTP "hotp"
+const QString FoilAuthToken::KEY_ALGORITHM(FOILAUTH_KEY_ALGORITHM);
const QString FoilAuthToken::TYPE_TOTP(FOILAUTH_TYPE_TOTP);
const QString FoilAuthToken::TYPE_HOTP(FOILAUTH_TYPE_HOTP);
@@ -74,41 +73,51 @@
#define FOILAUTH_SCHEME "otpauth"
FoilAuthToken::FoilAuthToken() :
+ iType(DEFAULT_AUTH_TYPE),
iAlgorithm(DEFAULT_ALGORITHM),
+ iCounter(DEFAULT_COUNTER),
iDigits(DEFAULT_DIGITS),
iTimeShift(DEFAULT_TIMESHIFT)
{
}
FoilAuthToken::FoilAuthToken(const FoilAuthToken& aToken) :
+ iType(aToken.iType),
iAlgorithm(aToken.iAlgorithm),
iBytes(aToken.iBytes),
iLabel(aToken.iLabel),
iIssuer(aToken.iIssuer),
+ iCounter(aToken.iCounter),
iDigits(aToken.iDigits),
iTimeShift(aToken.iTimeShift)
{
}
-FoilAuthToken::FoilAuthToken(QByteArray aBytes, QString aLabel,
- QString aIssuer, int aDigits, int aTimeShift, DigestAlgorithm aAlgorithm) :
+FoilAuthToken::FoilAuthToken(AuthType aType, QByteArray aBytes, QString aLabel,
+ QString aIssuer, int aDigits, quint64 aCounter, int aTimeShift,
+ DigestAlgorithm aAlgorithm) :
+ iType(AuthTypeTOTP),
iAlgorithm(DEFAULT_ALGORITHM),
iBytes(aBytes),
iLabel(aLabel),
iIssuer(aIssuer),
+ iCounter(aCounter),
iDigits(DEFAULT_DIGITS),
iTimeShift(aTimeShift)
{
+ setType(aType);
setDigits(aDigits);
setAlgorithm(aAlgorithm);
}
FoilAuthToken& FoilAuthToken::operator=(const FoilAuthToken& aToken)
{
+ iType = aToken.iType;
iAlgorithm = aToken.iAlgorithm;
iBytes = aToken.iBytes;
iLabel = aToken.iLabel;
iIssuer = aToken.iIssuer;
+ iCounter = aToken.iCounter;
iDigits = aToken.iDigits;
iTimeShift = aToken.iTimeShift;
return *this;
@@ -116,8 +125,10 @@
bool FoilAuthToken::equals(const FoilAuthToken& aToken) const
{
- return iAlgorithm == aToken.iAlgorithm &&
+ return iType == aToken.iType &&
+ iAlgorithm == aToken.iAlgorithm &&
iDigits == aToken.iDigits &&
+ iCounter == aToken.iCounter &&
iTimeShift == aToken.iTimeShift &&
iBytes == aToken.iBytes &&
iLabel == aToken.iLabel &&
@@ -130,7 +141,9 @@
for (int i = 1; i < iDigits; i++) {
maxPass *= 10;
}
- return FoilAuth::TOTP(iBytes, aTime, maxPass, iAlgorithm);
+ return (iType == AuthTypeHOTP) ?
+ FoilAuth::HOTP(iBytes, iCounter, maxPass, iAlgorithm) :
+ FoilAuth::TOTP(iBytes, aTime, maxPass, iAlgorithm);
}
QString FoilAuthToken::passwordString(quint64 aTime) const
@@ -147,6 +160,17 @@
return false;
}
+bool FoilAuthToken::setType(AuthType aType)
+{
+ switch (aType) {
+ case AuthTypeTOTP:
+ case AuthTypeHOTP:
+ iType = aType;
+ return true;
+ }
+ return false;
+}
+
bool FoilAuthToken::setAlgorithm(DigestAlgorithm aAlgorithm)
{
switch (aAlgorithm) {
@@ -168,11 +192,21 @@
pos.ptr = (guint8*)uri.constData();
pos.end = pos.ptr + uri.size();
+ // Check scheme + type prefix
FoilBytes prefixBytes;
+ AuthType type = AuthTypeTOTP;
foil_bytes_from_string(&prefixBytes, FOILAUTH_SCHEME "://"
FOILAUTH_TYPE_TOTP "/");
- if (foil_parse_skip_bytes(&pos, &prefixBytes)) {
- QByteArray label, secret, issuer, algorithm, digits;
+ bool prefixOK = foil_parse_skip_bytes(&pos, &prefixBytes);
+ if (!prefixOK) {
+ type = AuthTypeHOTP;
+ foil_bytes_from_string(&prefixBytes, FOILAUTH_SCHEME "://"
+ FOILAUTH_TYPE_HOTP "/");
+ prefixOK = foil_parse_skip_bytes(&pos, &prefixBytes);
+ }
+
+ if (prefixOK) {
+ QByteArray label, secret, issuer, algorithm, digits, counter;
while (pos.ptr < pos.end && pos.ptr[0] != '?') {
label.append(*pos.ptr++);
}
@@ -180,26 +214,25 @@
FoilBytes secretTag;
FoilBytes issuerTag;
FoilBytes digitsTag;
+ FoilBytes counterTag;
FoilBytes algorithmTag;
foil_bytes_from_string(&secretTag, FOILAUTH_KEY_SECRET "=");
foil_bytes_from_string(&issuerTag, FOILAUTH_KEY_ISSUER "=");
foil_bytes_from_string(&digitsTag, FOILAUTH_KEY_DIGITS "=");
+ foil_bytes_from_string(&counterTag, FOILAUTH_KEY_COUNTER "=");
foil_bytes_from_string(&algorithmTag, FOILAUTH_KEY_ALGORITHM "=");
- QByteArray* value;
while (pos.ptr < pos.end) {
pos.ptr++;
- if (foil_parse_skip_bytes(&pos, &secretTag)) {
- value = &secret;
- } else if (foil_parse_skip_bytes(&pos, &issuerTag)) {
- value = &issuer;
- } else if (foil_parse_skip_bytes(&pos, &digitsTag)) {
- value = &digits;
- } else if (foil_parse_skip_bytes(&pos, &algorithmTag)) {
- value = &algorithm;
- } else {
- value = Q_NULLPTR;
- }
+
+ QByteArray* value =
+ foil_parse_skip_bytes(&pos, &secretTag) ? &secret :
+ foil_parse_skip_bytes(&pos, &issuerTag) ? &issuer :
+ foil_parse_skip_bytes(&pos, &digitsTag) ? &digits :
+ foil_parse_skip_bytes(&pos, &counterTag) ? &counter :
+ foil_parse_skip_bytes(&pos, &algorithmTag) ? &algorithm :
+ Q_NULLPTR;
+
if (value) {
*value = QByteArray();
while (pos.ptr < pos.end && pos.ptr[0] != '&') {
@@ -215,19 +248,29 @@
if (!secret.isEmpty()) {
QByteArray bytes = FoilAuth::fromBase32(QUrl::fromPercentEncoding(secret));
if (!bytes.isEmpty()) {
+ iType = type;
iBytes = bytes;
iLabel = QUrl::fromPercentEncoding(label);
iIssuer = QUrl::fromPercentEncoding(issuer);
iDigits = DEFAULT_DIGITS;
+ iCounter = DEFAULT_COUNTER;
iAlgorithm = DEFAULT_ALGORITHM;
iTimeShift = DEFAULT_TIMESHIFT;
if (!digits.isEmpty()) {
- const int n = digits.toInt();
- if (n >= MIN_DIGITS && n <= MAX_DIGITS) {
+ bool ok;
+ const int n = digits.toInt(&ok);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/FoilAuthToken.h
^
|
@@ -58,16 +58,19 @@
static const QString KEY_SECRET;
static const QString KEY_ISSUER;
static const QString KEY_DIGITS;
- static const QString KEY_ALGORITHM;
+ static const QString KEY_COUNTER;
static const QString KEY_TIMESHIFT;
+ static const QString KEY_ALGORITHM;
static const QString TYPE_TOTP;
static const QString TYPE_HOTP;
FoilAuthToken();
FoilAuthToken(const FoilAuthToken& aToken);
- FoilAuthToken(QByteArray aBytes, QString aLabel, QString aIssuer,
- int aDigits = DEFAULT_DIGITS, int aTimeShift = DEFAULT_TIMESHIFT,
+ FoilAuthToken(AuthType aType, QByteArray aBytes, QString aLabel,
+ QString aIssuer, int aDigits = DEFAULT_DIGITS,
+ quint64 aCounter = DEFAULT_COUNTER,
+ int aTimeShift = DEFAULT_TIMESHIFT,
DigestAlgorithm aAlgorithm = DEFAULT_ALGORITHM);
FoilAuthToken& operator=(const FoilAuthToken& aToken);
@@ -76,6 +79,7 @@
bool isValid() const;
bool setDigits(int aDigits);
+ bool setType(AuthType aType);
bool setAlgorithm(DigestAlgorithm aAlgorithm);
bool parseUri(QString aUri);
uint password(quint64 aTime) const;
@@ -89,13 +93,16 @@
static QList<FoilAuthToken> fromProtoBuf(const QByteArray& aData);
static QByteArray toProtoBuf(const QList<FoilAuthToken>& aTokens);
- static QList<QByteArray> toProtoBufs(const QList<FoilAuthToken>& aTokens, int aPrefBatchSize = 1000, int aMaxBatchSize = 2000);
+ static QList<QByteArray> toProtoBufs(const QList<FoilAuthToken>& aTokens,
+ int aPrefBatchSize = 1000, int aMaxBatchSize = 2000);
public:
+ AuthType iType;
DigestAlgorithm iAlgorithm;
QByteArray iBytes;
QString iLabel;
QString iIssuer;
+ quint64 iCounter;
int iDigits;
int iTimeShift; // Seconds
};
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/FoilAuthTypes.h
^
|
@@ -34,15 +34,23 @@
#ifndef FOILAUTH_TYPES_H
#define FOILAUTH_TYPES_H
-#define FOILAUTH_ALGORITHM_MD5 "MD5"
-#define FOILAUTH_ALGORITHM_SHA1 "SHA1"
-#define FOILAUTH_ALGORITHM_SHA256 "SHA256"
-#define FOILAUTH_ALGORITHM_SHA512 "SHA512"
+#define FOILAUTH_TYPE_TOTP "totp"
+#define FOILAUTH_TYPE_HOTP "hotp"
+#define FOILAUTH_TYPE_DEFAULT FOILAUTH_TYPE_TOTP
-#define FOILAUTH_ALGORITHM_DEFAULT FOILAUTH_ALGORITHM_SHA1
+#define FOILAUTH_ALGORITHM_MD5 "MD5"
+#define FOILAUTH_ALGORITHM_SHA1 "SHA1"
+#define FOILAUTH_ALGORITHM_SHA256 "SHA256"
+#define FOILAUTH_ALGORITHM_SHA512 "SHA512"
+#define FOILAUTH_ALGORITHM_DEFAULT FOILAUTH_ALGORITHM_SHA1
class FoilAuthTypes {
public:
+ enum AuthType {
+ AuthTypeTOTP,
+ AuthTypeHOTP
+ };
+
enum DigestAlgorithm {
DigestAlgorithmMD5,
DigestAlgorithmSHA1,
@@ -50,8 +58,10 @@
DigestAlgorithmSHA512
};
+ static const AuthType DEFAULT_AUTH_TYPE = AuthTypeTOTP;
static const DigestAlgorithm DEFAULT_ALGORITHM = DigestAlgorithmSHA1;
static const int DEFAULT_DIGITS = 6;
+ static const int DEFAULT_COUNTER = 0;
static const int DEFAULT_TIMESHIFT = 0;
};
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/SailOTP.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019-2020 Jolla Ltd.
- * Copyright (C) 2019-2020 Slava Monich <slava@monich.com>
+ * Copyright (C) 2019-2021 Jolla Ltd.
+ * Copyright (C) 2019-2021 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -40,6 +40,7 @@
#include "HarbourDebug.h"
#include <QDir>
+#include <QFile>
#include <QStandardPaths>
#include <QCryptographicHash>
@@ -62,6 +63,8 @@
bool iFavorite;
};
+ static const QString DB_PATH;
+
static const QString DB_TYPE;
static const QString DB_NAME;
static const QString DB_TABLE;
@@ -75,20 +78,25 @@
static const QString COL_LEN;
static const QString COL_DIFF;
+ Private(QStringList aImportedTokens, FoilAuthModel* aDestModel);
+
+private:
static QString databaseDir();
static QString databasePath();
- Private();
-
- void fetchTokens();
+ void fetchTokens(FoilAuthModel* aDestModel);
public:
QList<Token> iTokens;
+ QStringList iImportedTokens;
};
+const QString SailOTP::Private::DB_PATH(SailOTP::Private::databasePath());
+
#define TABLE_NAME "OTPStorage"
+#define DATABASE_NAME "harbour-sailotp"
const QString SailOTP::Private::DB_TYPE("QSQLITE");
-const QString SailOTP::Private::DB_NAME("harbour-sailotp");
+const QString SailOTP::Private::DB_NAME(DATABASE_NAME);
const QString SailOTP::Private::DB_TABLE(TABLE_NAME);
#define SORT_COL "sort"
@@ -111,54 +119,67 @@
QString SailOTP::Private::databasePath()
{
// This is how LocalStorage plugin generates database file name
- QCryptographicHash md5(QCryptographicHash::Md5);
- md5.addData(DB_NAME.toUtf8());
- const QString dbId(QLatin1String(md5.result().toHex()));
- return databaseDir() + "/" + dbId + ".sqlite";
+ return databaseDir() + QDir::separator() +
+ QLatin1String(QCryptographicHash::hash(DATABASE_NAME, QCryptographicHash::Md5).toHex()) +
+ ".sqlite";
}
-SailOTP::Private::Private()
+SailOTP::Private::Private(QStringList aImportedTokens, FoilAuthModel* aDestModel) :
+ iImportedTokens(aImportedTokens)
{
// SqlDatabase object needs to go out of scope before we can
// call QSqlDatabase::removeDatabase
- fetchTokens();
+ fetchTokens(aDestModel);
QSqlDatabase::removeDatabase(DB_NAME);
}
-void SailOTP::Private::fetchTokens()
+void SailOTP::Private::fetchTokens(FoilAuthModel* aDestModel)
{
QSqlDatabase db(QSqlDatabase::database(Private::DB_NAME));
if (!db.isValid()) {
HDEBUG("adding database" << DB_NAME);
db = QSqlDatabase::addDatabase(DB_TYPE, DB_NAME);
}
- const QString path(databasePath());
- db.setDatabaseName(path);
+ db.setDatabaseName(DB_PATH);
if (db.open()) {
- HDEBUG("Opened " << qPrintable(path));
+ HDEBUG("Opened " << qPrintable(DB_PATH));
QSqlQuery query(db);
if (query.exec("SELECT * FROM " TABLE_NAME " ORDER BY " SORT_COL) ||
query.exec("SELECT * FROM " TABLE_NAME)) {
while (query.next()) {
const QString type(query.value(COL_TYPE).toString());
- if (type.compare(FoilAuthToken::TYPE_TOTP, Qt::CaseInsensitive) == 0) {
+ const bool isTOTP = !type.compare(FoilAuthToken::TYPE_TOTP, Qt::CaseInsensitive);
+ const bool isHOTP = !type.compare(FoilAuthToken::TYPE_HOTP, Qt::CaseInsensitive);
+ if (isTOTP || isHOTP) {
const QString base32(query.value(COL_SECRET).toString());
const QByteArray secret(HarbourBase32::fromBase32(base32));
if (!secret.isEmpty()) {
- bool ok;
- int value;
-
- Token token;
- token.iToken.iBytes = secret;
- token.iToken.iLabel = query.value(COL_TITLE).toString();
- value = query.value(COL_FAV).toInt(&ok);
- if (ok) token.iFavorite = value != 0;
- value = query.value(COL_LEN).toInt(&ok);
- if (ok && value > 0) token.iToken.iDigits = value;
- value = query.value(COL_DIFF).toInt(&ok);
- if (ok) token.iToken.iTimeShift = value;
- HDEBUG(token.iToken.iLabel << base32 << token.iToken.iDigits);
- iTokens.append(token);
+ const QString title(query.value(COL_TITLE).toString());
+ const QString secretHash(QString(QCryptographicHash::hash(secret,
+ QCryptographicHash::Sha1).toHex()).toLower());
+ if (iImportedTokens.contains(secretHash) ||
+ (aDestModel && aDestModel->containsSecret(secret))) {
+ HDEBUG("SailOTP token" << title << "is already imported");
+ } else {
+ bool ok;
+ int value;
+
+ Token token;
+ token.iToken.iBytes = secret;
+ token.iToken.iLabel = title;
+ token.iToken.setType(isHOTP ?
+ FoilAuthToken::AuthTypeHOTP :
+ FoilAuthToken::AuthTypeTOTP);
+ value = query.value(COL_FAV).toInt(&ok);
+ if (ok) token.iFavorite = value != 0;
+ value = query.value(COL_LEN).toInt(&ok);
+ if (ok && value > 0) token.iToken.setDigits(value);
+ value = query.value(COL_DIFF).toInt(&ok);
+ if (ok) token.iToken.iTimeShift = value;
+ HDEBUG(token.iToken.iLabel << type << base32 << token.iToken.iDigits);
+ iTokens.append(token);
+ iImportedTokens.append(secretHash);
+ }
}
}
}
@@ -183,24 +204,40 @@
delete iPrivate;
}
+QStringList SailOTP::importedTokens() const
+{
+ return iImportedTokens;
+}
+
+void SailOTP::setImportedTokens(QStringList aList)
+{
+ if (iImportedTokens != aList) {
+ iImportedTokens = aList;
+ Q_EMIT importedTokensChanged();
+ }
+}
+
// Callback for qmlRegisterSingletonType<SailOTP>
QObject* SailOTP::createSingleton(QQmlEngine* aEngine, QJSEngine* aScript)
{
return new SailOTP;
}
-int SailOTP::fetchTokens()
+int SailOTP::fetchNewTokens(QObject* aDestModel)
{
delete iPrivate;
- iPrivate = new Private;
- if (iPrivate->iTokens.isEmpty()) {
+ if (QFile(Private::DB_PATH).exists()) {
+ iPrivate = new Private(iImportedTokens, qobject_cast<FoilAuthModel*>(aDestModel));
+ if (!iPrivate->iTokens.isEmpty()) {
+ const int count = iPrivate->iTokens.count();
+ HDEBUG("Fetched" << count << "new token(s)");
+ setImportedTokens(iPrivate->iImportedTokens);
+ return count;
+ }
delete iPrivate;
- iPrivate = Q_NULLPTR;
- return 0;
- } else {
- HDEBUG("Fetched" << iPrivate->iTokens.count() << "token(s)");
- return iPrivate->iTokens.count();
}
+ iPrivate = Q_NULLPTR;
+ return 0;
}
void SailOTP::importTokens(QObject* aDestModel)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/SailOTP.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava@monich.com>
+ * Copyright (C) 2019-2021 Jolla Ltd.
+ * Copyright (C) 2019-2021 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -39,21 +39,29 @@
class SailOTP : public QObject {
Q_OBJECT
Q_DISABLE_COPY(SailOTP)
+ Q_PROPERTY(QStringList importedTokens READ importedTokens WRITE setImportedTokens NOTIFY importedTokensChanged)
public:
explicit SailOTP(QObject* aParent = Q_NULLPTR);
~SailOTP();
+ QStringList importedTokens() const;
+ void setImportedTokens(QStringList aList);
+
// Callback for qmlRegisterSingletonType<SailOTP>
static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
- Q_INVOKABLE int fetchTokens();
+ Q_INVOKABLE int fetchNewTokens(QObject* aDestModel);
Q_INVOKABLE void importTokens(QObject* aDestModel);
Q_INVOKABLE void dropTokens();
+Q_SIGNALS:
+ void importedTokensChanged();
+
private:
class Private;
Private* iPrivate;
+ QStringList iImportedTokens;
};
QML_DECLARE_TYPE(SailOTP)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/src/main.cpp
^
|
@@ -159,6 +159,8 @@
context->setContextProperty("TorchSupported", torchSupported);
context->setContextProperty("FoilAuthDefaultDigits",
QVariant::fromValue((int)FoilAuthToken::DEFAULT_DIGITS));
+ context->setContextProperty("FoilAuthDefaultCounter",
+ QVariant::fromValue((int)FoilAuthToken::DEFAULT_COUNTER));
context->setContextProperty("FoilAuthDefaultTimeShift",
QVariant::fromValue((int)FoilAuthToken::DEFAULT_TIMESHIFT));
if (res_4_3.isValid()) {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/test/Makefile.common
^
|
@@ -1,6 +1,8 @@
# -*- Mode: makefile-gmake -*-
-.PHONY: clean all debug release coverage
+.PHONY: clean all debug release coverage test_banner test valgrind
+.PHONY: libfoil_debug_lib libfoil_release_lib libfoil_coverage_lib
+.PHONY: libglibutil_debug_lib libglibutil_release_lib libglibutil_coverage_lib
#
# Real test makefile defines EXE (and possibly SRC) and includes this one.
@@ -16,7 +18,7 @@
# Required packages
#
-PKGS += Qt5Core Qt5Quick libglibutil libfoil libcrypto gobject-2.0 glib-2.0
+PKGS += Qt5Core Qt5Quick libcrypto gobject-2.0 glib-2.0
#
# Default target
@@ -29,16 +31,38 @@
#
SRC_DIR = .
-TOP_DIR = ../..
+TOP_DIR = $(shell cd ../..; pwd)
APP_DIR = $(TOP_DIR)/src
QRENCODE_DIR = $(TOP_DIR)/libqrencode
HARBOUR_DIR = $(TOP_DIR)/harbour-lib
+LIBFOIL_DIR = $(TOP_DIR)/foil/libfoil
+LIBGLIBUTIL_DIR = $(TOP_DIR)/libglibutil
BUILD_DIR = build
DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
RELEASE_BUILD_DIR = $(BUILD_DIR)/release
COVERAGE_BUILD_DIR = $(BUILD_DIR)/coverage
#
+# Libs
+#
+
+LIBGLIBUTIL_MAKE = $(MAKE) --no-print-directory -C $(LIBGLIBUTIL_DIR)
+LIBGLIBUTIL_DEBUG_LIB_FILE := $(shell $(LIBGLIBUTIL_MAKE) print_debug_lib)
+LIBGLIBUTIL_RELEASE_LIB_FILE := $(shell $(LIBGLIBUTIL_MAKE) print_release_lib)
+LIBGLIBUTIL_COVERAGE_LIB_FILE := $(shell $(LIBGLIBUTIL_MAKE) print_coverage_lib)
+LIBGLIBUTIL_DEBUG_LIB := $(LIBGLIBUTIL_DIR)/$(LIBGLIBUTIL_DEBUG_LIB_FILE)
+LIBGLIBUTIL_RELEASE_LIB := $(LIBGLIBUTIL_DIR)/$(LIBGLIBUTIL_RELEASE_LIB_FILE)
+LIBGLIBUTIL_COVERAGE_LIB := $(LIBGLIBUTIL_DIR)/$(LIBGLIBUTIL_COVERAGE_LIB_FILE)
+
+LIBFOIL_MAKE = $(MAKE) --no-print-directory -C $(LIBFOIL_DIR) LIBGLIBUTIL_PATH=$(LIBGLIBUTIL_DIR)
+LIBFOIL_DEBUG_LIB_FILE := $(shell $(LIBFOIL_MAKE) print_debug_lib)
+LIBFOIL_RELEASE_LIB_FILE := $(shell $(LIBFOIL_MAKE) print_release_lib)
+LIBFOIL_COVERAGE_LIB_FILE := $(shell $(LIBFOIL_MAKE) print_coverage_lib)
+LIBFOIL_DEBUG_LIB := $(LIBFOIL_DIR)/$(LIBFOIL_DEBUG_LIB_FILE)
+LIBFOIL_RELEASE_LIB := $(LIBFOIL_DIR)/$(LIBFOIL_RELEASE_LIB_FILE)
+LIBFOIL_COVERAGE_LIB := $(LIBFOIL_DIR)/$(LIBFOIL_COVERAGE_LIB_FILE)
+
+#
# Tools and flags
#
@@ -47,7 +71,7 @@
MOC = qtchooser -run-tool=moc -qt=5
WARNINGS = -Wall
INCLUDES = -I$(BUILD_DIR) -I$(APP_DIR) -I$(HARBOUR_DIR)/include \
- -I$(QRENCODE_DIR)
+ -I$(QRENCODE_DIR) -I$(LIBFOIL_DIR)/include -I$(LIBGLIBUTIL_DIR)/include
BASE_FLAGS = -fPIC
BASE_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS)
BASE_CFLAGS = $(BASE_FLAGS) $(CFLAGS)
@@ -60,6 +84,10 @@
RELEASE_FLAGS =
COVERAGE_FLAGS = -g
+DEBUG_LIBS = $(LIBFOIL_DEBUG_LIB) $(LIBGLIBUTIL_DEBUG_LIB) $(LIBS)
+RELEASE_LIBS = $(LIBFOIL_RELEASE_LIB) $(LIBGLIBUTIL_RELEASE_LIB) $(LIBS)
+COVERAGE_LIBS = $(LIBFOIL_COVERAGE_LIB) $(LIBGLIBUTIL_COVERAGE_LIB) $(LIBS)
+
DEBUG_LDFLAGS = $(FULL_LDFLAGS) $(DEBUG_FLAGS)
RELEASE_LDFLAGS = $(FULL_LDFLAGS) $(RELEASE_FLAGS)
COVERAGE_LDFLAGS = $(FULL_LDFLAGS) $(COVERAGE_FLAGS) --coverage
@@ -115,18 +143,22 @@
endif
endif
+DEBUG_EXE = $(DEBUG_BUILD_DIR)/$(EXE)
+RELEASE_EXE = $(RELEASE_BUILD_DIR)/$(EXE)
+COVERAGE_EXE = $(COVERAGE_BUILD_DIR)/$(EXE)
+
$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
$(COVERAGE_OBJS): | $(COVERAGE_BUILD_DIR)
+$(DEBUG_EXE): | libfoil_debug_lib libglibutil_debug_lib
+$(RELEASE_EXE): | libfoil_release_lib libglibutil_release_lib
+$(COVERAGE_EXE): | libfoil_coverage_lib libglibutil_coverage_lib
+
#
# Rules
#
-DEBUG_EXE = $(DEBUG_BUILD_DIR)/$(EXE)
-RELEASE_EXE = $(RELEASE_BUILD_DIR)/$(EXE)
-COVERAGE_EXE = $(COVERAGE_BUILD_DIR)/$(EXE)
-
debug: $(DEBUG_EXE)
release: $(RELEASE_EXE)
@@ -219,10 +251,28 @@
$(CC) -c $(COVERAGE_CFLAGS) $(QRENCODE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
$(DEBUG_EXE): $(DEBUG_OBJS)
- $(LD) $(DEBUG_LDFLAGS) $^ $(LIBS) -o $@
+ $(LD) $(DEBUG_LDFLAGS) $^ $(DEBUG_LIBS) -o $@
$(RELEASE_EXE): $(RELEASE_OBJS)
- $(LD) $(RELEASE_LDFLAGS) $^ $(LIBS) -o $@
+ $(LD) $(RELEASE_LDFLAGS) $^ $(RELEASE_LIBS) -o $@
$(COVERAGE_EXE): $(COVERAGE_OBJS)
- $(LD) $(COVERAGE_LDFLAGS) $^ $(LIBS) -o $@
+ $(LD) $(COVERAGE_LDFLAGS) $^ $(COVERAGE_LIBS) -o $@
+
+libfoil_debug_lib:
+ @$(LIBFOIL_MAKE) $(LIBFOIL_DEBUG_LIB_FILE)
+
+libfoil_release_lib:
+ @$(LIBFOIL_MAKE) $(LIBFOIL_RELEASE_LIB_FILE)
+
+libfoil_coverage_lib:
+ @$(LIBFOIL_MAKE) $(LIBFOIL_COVERAGE_LIB_FILE)
+
+libglibutil_debug_lib:
+ @$(LIBGLIBUTIL_MAKE) $(LIBGLIBUTIL_DEBUG_LIB_FILE)
+
+libglibutil_release_lib:
+ @$(LIBGLIBUTIL_MAKE) $(LIBGLIBUTIL_RELEASE_LIB_FILE)
+
+libglibutil_coverage_lib:
+ @$(LIBGLIBUTIL_MAKE) $(LIBGLIBUTIL_COVERAGE_LIB_FILE)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/test/TestFoilAuth/TestFoilAuth.cpp
^
|
@@ -265,7 +265,21 @@
void)
{
QByteArray secret = FoilAuth::fromBase32("VHIIKTVJC6MEOFTJ");
- g_assert(FoilAuth::TOTP(secret, 1548529350, 1000000) == 38068);
+ g_assert_cmpuint(FoilAuth::TOTP(secret, 1548529350, 1000000), == ,38068);
+}
+
+/*==========================================================================*
+ * hotp
+ *==========================================================================*/
+
+static
+void
+test_hotp(
+ void)
+{
+ QByteArray secret = FoilAuth::fromBase32("MHGU3YYJJD6W44KUVED4FODUNN4JHJNQ");
+ g_assert_cmpuint(FoilAuth::HOTP(secret, 0, 1000000), == ,207601);
+ g_assert_cmpuint(FoilAuth::HOTP(secret, 1, 1000000), == ,444239);
}
/*==========================================================================*
@@ -277,18 +291,63 @@
test_toUri(
void)
{
- g_assert(FoilAuth::toUri("", "Label", "Issuer", 5,
+ g_assert(FoilAuth::toUri(FoilAuth::TypeTOTP,
+ "", "Label", "Issuer", 5,
+ FoilAuthTypes::DEFAULT_COUNTER,
FoilAuthTypes::DEFAULT_TIMESHIFT,
FoilAuth::DefaultAlgorithm).isEmpty());
- g_assert(FoilAuth::toUri("aebagbafa", "Label", "Issuer", 5,
+ g_assert(FoilAuth::toUri(FoilAuth::TypeTOTP,
+ "aebagbafa", "Label", "Issuer", 5,
+ FoilAuthTypes::DEFAULT_COUNTER,
FoilAuthTypes::DEFAULT_TIMESHIFT,
FoilAuth::DefaultAlgorithm) ==
"otpauth://totp/Label?secret=aebagbaf&issuer=Issuer&digits=5");
- g_assert(FoilAuth::toUri("aebagbafa", "Label", "Issuer",
+ g_assert(FoilAuth::toUri(FoilAuth::TypeTOTP,
+ "aebagbafa", "Label", "Issuer",
FoilAuthTypes::DEFAULT_DIGITS,
+ FoilAuthTypes::DEFAULT_COUNTER,
FoilAuthTypes::DEFAULT_TIMESHIFT,
FoilAuth::DefaultAlgorithm) ==
"otpauth://totp/Label?secret=aebagbaf&issuer=Issuer&digits=6");
+ g_assert(FoilAuth::toUri(FoilAuth::TypeTOTP,
+ "aebagbafa", "", "",
+ FoilAuthTypes::DEFAULT_DIGITS,
+ FoilAuthTypes::DEFAULT_COUNTER,
+ 10,
+ FoilAuth::DefaultAlgorithm) ==
+ "otpauth://totp/?secret=aebagbaf&digits=6×hift=10");
+ g_assert(FoilAuth::toUri(FoilAuth::TypeHOTP,
+ "aebagbafa", "Label", "",
+ FoilAuthTypes::DEFAULT_DIGITS, 42,
+ FoilAuthTypes::DEFAULT_TIMESHIFT,
+ FoilAuth::DefaultAlgorithm) ==
+ "otpauth://hotp/Label?secret=aebagbaf&digits=6&counter=42");
+}
+
+/*==========================================================================*
+ * migrationUri
+ *==========================================================================*/
+
+static
+void
+test_migrationUri(
+ void)
+{
+ g_assert(FoilAuth::migrationUri(QByteArray()).isEmpty());
+
+ static const uchar data[] = {
+ 0x0a, 0x37, 0x0a, 0x0a, 0x5f, 0x7a, 0x82, 0xa1,
+ 0x79, 0x58, 0x3c, 0x32, 0x48, 0x0e, 0x12, 0x18,
+ 0x57, 0x6f, 0x72, 0x64, 0x50, 0x72, 0x65, 0x73,
+ 0x73, 0x3a, 0x54, 0x68, 0x69, 0x6e, 0x6b, 0x69,
+ 0x6e, 0x67, 0x54, 0x65, 0x61, 0x70, 0x6f, 0x74,
+ 0x1a, 0x09, 0x57, 0x6f, 0x72, 0x64, 0x50, 0x72,
+ 0x65, 0x73, 0x73, 0x20, 0x01, 0x28, 0x02, 0x30,
+ 0x02
+ };
+
+ const QString uri(FoilAuth::migrationUri(QByteArray((char*)data, (int)sizeof(data))));
+ g_assert(uri == QString("otpauth-migration://offline?data=CjcKCl96gqF5WDwySA4SGFdvcmRQcmVzczpUaGlua2luZ1RlYXBvdBoJV29yZFByZXNzIAEoAjAC"));
}
/*==========================================================================*
@@ -308,14 +367,15 @@
// Valid token
map = FoilAuth::parseUri("otpauth://totp/Test?secret=vhiiktvjc6meoftj&issuer=Issuer&digits=5");
- g_assert(map.count() == 8);
+ g_assert(map.count() == 9);
g_assert(map.value(FoilAuthToken::KEY_VALID).toBool());
- g_assert(map.value(FoilAuthToken::KEY_TYPE).toString() == FoilAuthToken::TYPE_TOTP);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_TYPE).toInt(), == ,FoilAuthToken::AuthTypeTOTP);
g_assert(map.value(FoilAuthToken::KEY_LABEL).toString() == QString("Test"));
g_assert(map.value(FoilAuthToken::KEY_SECRET).toString() == QString("vhiiktvjc6meoftj"));
g_assert(map.value(FoilAuthToken::KEY_ISSUER).toString() == QString("Issuer"));
g_assert_cmpint(map.value(FoilAuthToken::KEY_DIGITS).toInt(), == ,5);
- g_assert_cmpint(map.value(FoilAuthToken::KEY_TIMESHIFT).toInt(), == ,0);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_COUNTER).toInt(), == ,FoilAuthToken::DEFAULT_COUNTER);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_TIMESHIFT).toInt(), == ,FoilAuthToken::DEFAULT_TIMESHIFT);
g_assert_cmpint(map.value(FoilAuthToken::KEY_ALGORITHM).toInt(), == ,FoilAuthToken::DEFAULT_ALGORITHM);
}
@@ -331,17 +391,59 @@
QVariantList list = FoilAuth::parseMigrationUri(QString());
g_assert_cmpint(list.count(), == ,0);
+ // One TOTP tocken
list = FoilAuth::parseMigrationUri(QString("otpauth-migration://offline?data=CjcKCl96gqF5WDwySA4SGFdvcmRQcmVzczpUaGlua2luZ1RlYXBvdBoJV29yZFByZXNzIAEoAjAC"));
g_assert_cmpint(list.count(), == ,1);
+
QVariantMap map = list.at(0).toMap();
- g_assert(map.count() == 8);
+ g_assert(map.count() == 9);
+
+ QByteArray label, secret, issuer;
g_assert(map.value(FoilAuthToken::KEY_VALID).toBool());
- g_assert(map.value(FoilAuthToken::KEY_TYPE).toString() == FoilAuthToken::TYPE_TOTP);
- g_assert(map.value(FoilAuthToken::KEY_LABEL).toString() == QString("WordPress:ThinkingTeapot"));
- g_assert(map.value(FoilAuthToken::KEY_SECRET).toString() == QString("l55ifilzla6desao"));
- g_assert(map.value(FoilAuthToken::KEY_ISSUER).toString() == QString("WordPress"));
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_TYPE).toInt(), == ,FoilAuthToken::AuthTypeTOTP);
+ label = map.value(FoilAuthToken::KEY_LABEL).toString().toUtf8();
+ secret = map.value(FoilAuthToken::KEY_SECRET).toString().toUtf8();
+ issuer = map.value(FoilAuthToken::KEY_ISSUER).toString().toUtf8();
+ g_assert_cmpstr(label, == ,"WordPress:ThinkingTeapot");
+ g_assert_cmpstr(secret, == ,"l55ifilzla6desao");
+ g_assert_cmpstr(issuer, == ,"WordPress");
g_assert_cmpint(map.value(FoilAuthToken::KEY_DIGITS).toInt(), == ,8);
- g_assert_cmpint(map.value(FoilAuthToken::KEY_TIMESHIFT).toInt(), == ,0);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_COUNTER).toInt(), == ,FoilAuthToken::DEFAULT_COUNTER);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_TIMESHIFT).toInt(), == ,FoilAuthToken::DEFAULT_TIMESHIFT);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_ALGORITHM).toInt(), == ,FoilAuthToken::DEFAULT_ALGORITHM);
+
+ // One HOTP + one TOTP token
+ list = FoilAuth::parseMigrationUri(QString("otpauth-migration://offline?data=CikKFGHNTeMJSP1ucVSpB8K4dGt4k6WwEglIT1RQIHRlc3QgASgBMAE4AwojChDGzIcWUVA5HichlIduvZrUEglUT1RQIHRlc3QgASgBMAIQARgBIAAo%2BOCI%2Bvn%2F%2F%2F%2F%2FAQ%3D%3D"));
+ g_assert_cmpint(list.count(), == ,2);
+
+ // HOTP
+ map = list.at(0).toMap();
+ g_assert(map.count() == 9);
+ g_assert(map.value(FoilAuthToken::KEY_VALID).toBool());
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_TYPE).toInt(), == ,FoilAuthToken::AuthTypeHOTP);
+ label = map.value(FoilAuthToken::KEY_LABEL).toString().toUtf8();
+ secret = map.value(FoilAuthToken::KEY_SECRET).toString().toUtf8();
+ g_assert(map.value(FoilAuthToken::KEY_ISSUER).toString().isEmpty());
+ g_assert_cmpstr(label, == ,"HOTP test");
+ g_assert_cmpstr(secret, == ,"mhgu3yyjjd6w44kuved4fodunn4jhjnq");
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_DIGITS).toInt(), == ,FoilAuthTypes::DEFAULT_DIGITS);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_COUNTER).toInt(), == ,3);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_TIMESHIFT).toInt(), == ,FoilAuthToken::DEFAULT_TIMESHIFT);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_ALGORITHM).toInt(), == ,FoilAuthToken::DEFAULT_ALGORITHM);
+
+ // TOTP
+ map = list.at(1).toMap();
+ g_assert(map.count() == 9);
+ g_assert(map.value(FoilAuthToken::KEY_VALID).toBool());
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_TYPE).toInt(), == ,FoilAuthToken::AuthTypeTOTP);
+ label = map.value(FoilAuthToken::KEY_LABEL).toString().toUtf8();
+ secret = map.value(FoilAuthToken::KEY_SECRET).toString().toUtf8();
+ g_assert(map.value(FoilAuthToken::KEY_ISSUER).toString().isEmpty());
+ g_assert_cmpstr(label, == ,"TOTP test");
+ g_assert_cmpstr(secret, == ,"y3giofsrka4r4jzbssdw5pm22q======");
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_DIGITS).toInt(), == ,FoilAuthTypes::DEFAULT_DIGITS);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_COUNTER).toInt(), == ,FoilAuthToken::DEFAULT_COUNTER);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_TIMESHIFT).toInt(), == ,FoilAuthToken::DEFAULT_TIMESHIFT);
g_assert_cmpint(map.value(FoilAuthToken::KEY_ALGORITHM).toInt(), == ,FoilAuthToken::DEFAULT_ALGORITHM);
}
@@ -382,7 +484,9 @@
g_test_add_func(TEST_("fileArray"), test_byteArray);
g_test_add_func(TEST_("file"), test_file);
g_test_add_func(TEST_("totp"), test_totp);
+ g_test_add_func(TEST_("hotp"), test_hotp);
g_test_add_func(TEST_("toUri"), test_toUri);
+ g_test_add_func(TEST_("migrationUri"), test_migrationUri);
g_test_add_func(TEST_("parseUri"), test_parseUri);
g_test_add_func(TEST_("parseMigrationUri"), test_parseMigrationUri);
g_test_add_func(TEST_("stringListRemove"), test_stringListRemove);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/test/TestFoilAuthToken/TestFoilAuthToken.cpp
^
|
@@ -52,7 +52,8 @@
void)
{
QByteArray data("secret");
- FoilAuthToken token1(data, "Label", "Issuer", 1, 10);
+ FoilAuthToken token1(FoilAuthToken::AuthTypeTOTP, data, "Label",
+ "Issuer", 1, FoilAuthToken::DEFAULT_COUNTER, 10);
FoilAuthToken token2(token1);
FoilAuthToken token3;
@@ -70,6 +71,15 @@
g_assert(!token3.setAlgorithm((FoilAuthToken::DigestAlgorithm)-1));
g_assert(token1 == token3);
+ g_assert(token3.setAlgorithm(token3.iAlgorithm));
+ g_assert(token1 == token3);
+
+ g_assert(!token3.setType((FoilAuthToken::AuthType)-1));
+ g_assert(token1 == token3);
+
+ g_assert(token3.setType(token3.iType));
+ g_assert(token1 == token3);
+
g_assert(token3.setDigits(token3.iDigits + 1));
g_assert(token1 != token3);
}
@@ -84,7 +94,7 @@
void)
{
QByteArray data = FoilAuth::fromBase32("VHIIKTVJC6MEOFTJ");
- FoilAuthToken token(data, "Label", "Issuer");
+ FoilAuthToken token(FoilAuthToken::AuthTypeTOTP, data, "Label", "Issuer");
g_assert(token.passwordString(1548529350) == QString("038068"));
}
@@ -112,6 +122,7 @@
g_assert(token.iLabel == QString("Test Secret"));
g_assert(token.iIssuer == QString("Test Issuer"));
g_assert_cmpint(token.iDigits, == ,FoilAuthToken::DEFAULT_DIGITS);
+ g_assert_cmpint(token.iCounter, == ,FoilAuthToken::DEFAULT_COUNTER);
g_assert_cmpint(token.iTimeShift, == ,FoilAuthToken::DEFAULT_TIMESHIFT);
g_assert_cmpint(token.iAlgorithm, == ,FoilAuthToken::DEFAULT_ALGORITHM);
@@ -120,6 +131,7 @@
g_assert(token.iLabel.isEmpty());
g_assert(token.iIssuer.isEmpty());
g_assert_cmpint(token.iDigits, == ,2);
+ g_assert_cmpint(token.iCounter, == ,FoilAuthToken::DEFAULT_COUNTER);
g_assert_cmpint(token.iTimeShift, == ,FoilAuthToken::DEFAULT_TIMESHIFT);
g_assert_cmpint(token.iAlgorithm, == ,FoilAuthToken::DEFAULT_ALGORITHM);
@@ -128,6 +140,7 @@
g_assert(token.iLabel.isEmpty());
g_assert(token.iIssuer.isEmpty());
g_assert_cmpint(token.iDigits, == ,FoilAuthToken::DEFAULT_DIGITS);
+ g_assert_cmpint(token.iCounter, == ,FoilAuthToken::DEFAULT_COUNTER);
g_assert_cmpint(token.iTimeShift, == ,FoilAuthToken::DEFAULT_TIMESHIFT);
g_assert_cmpint(token.iAlgorithm, == ,FoilAuthToken::DigestAlgorithmMD5);
@@ -136,6 +149,7 @@
g_assert(token.iLabel.isEmpty());
g_assert(token.iIssuer.isEmpty());
g_assert_cmpint(token.iDigits, == ,FoilAuthToken::DEFAULT_DIGITS);
+ g_assert_cmpint(token.iCounter, == ,FoilAuthToken::DEFAULT_COUNTER);
g_assert_cmpint(token.iTimeShift, == ,FoilAuthToken::DEFAULT_TIMESHIFT);
g_assert_cmpint(token.iAlgorithm, == ,FoilAuthToken::DigestAlgorithmSHA1);
@@ -144,6 +158,7 @@
g_assert(token.iLabel.isEmpty());
g_assert(token.iIssuer.isEmpty());
g_assert_cmpint(token.iDigits, == ,FoilAuthToken::DEFAULT_DIGITS);
+ g_assert_cmpint(token.iCounter, == ,FoilAuthToken::DEFAULT_COUNTER);
g_assert_cmpint(token.iTimeShift, == ,FoilAuthToken::DEFAULT_TIMESHIFT);
g_assert_cmpint(token.iAlgorithm, == ,FoilAuthToken::DigestAlgorithmSHA256);
@@ -152,8 +167,18 @@
g_assert(token.iLabel.isEmpty());
g_assert(token.iIssuer.isEmpty());
g_assert_cmpint(token.iDigits, == ,FoilAuthToken::DEFAULT_DIGITS);
+ g_assert_cmpint(token.iCounter, == ,FoilAuthToken::DEFAULT_COUNTER);
g_assert_cmpint(token.iTimeShift, == ,FoilAuthToken::DEFAULT_TIMESHIFT);
g_assert_cmpint(token.iAlgorithm, == ,FoilAuthToken::DigestAlgorithmSHA512);
+
+ g_assert(token.parseUri("otpauth://hotp/HOTP%20test?secret=vhiiktvjc6meoftj&digits=6&counter=3"));
+ g_assert(token.iBytes == QByteArray((char*)bytes, sizeof(bytes)));
+ g_assert(token.iLabel == QString("HOTP test"));
+ g_assert(token.iIssuer.isEmpty());
+ g_assert_cmpint(token.iDigits, == ,FoilAuthToken::DEFAULT_DIGITS);
+ g_assert_cmpint(token.iCounter, == ,3);
+ g_assert_cmpint(token.iTimeShift, == ,FoilAuthToken::DEFAULT_TIMESHIFT);
+ g_assert_cmpint(token.iAlgorithm, == ,FoilAuthToken::DEFAULT_ALGORITHM);
}
/*==========================================================================*
@@ -172,33 +197,40 @@
FoilAuthToken token;
g_assert(token.toUri().isEmpty());
- token = FoilAuthToken(QByteArray((char*)bytes, sizeof(bytes)),
- QString(), QString());
+ token = FoilAuthToken(FoilAuthToken::AuthTypeTOTP,
+ QByteArray((char*)bytes, sizeof(bytes)), QString(), QString());
g_assert(token.toUri() == QString("otpauth://totp/?secret=vhiiktvjc6meoftj&digits=6"));
- token = FoilAuthToken(QByteArray((char*)bytes, sizeof(bytes)),
+ token = FoilAuthToken(FoilAuthToken::AuthTypeTOTP,
+ QByteArray((char*)bytes, sizeof(bytes)),
"Test Secret", "Test Issuer", 5);
QString uri(token.toUri());
- g_assert(uri == QString("otpauth://totp/Test Secret?secret=vhiiktvjc6meoftj&issuer=Test Issuer&digits=5"));
+ g_assert(uri == QString("otpauth://totp/Test%20Secret?secret=vhiiktvjc6meoftj&issuer=Test%20Issuer&digits=5"));
FoilAuthToken token2;
g_assert(token2.parseUri(uri));
g_assert(token2 == token);
// Algorithm
- uri = FoilAuthToken(QByteArray((char*)bytes, sizeof(bytes)), "Test",
- QString(), 6, FoilAuthToken::DEFAULT_TIMESHIFT,
+ uri = FoilAuthToken(FoilAuthToken::AuthTypeTOTP,
+ QByteArray((char*)bytes, sizeof(bytes)), "Test",
+ QString(), 6, FoilAuthToken::DEFAULT_COUNTER,
+ FoilAuthToken::DEFAULT_TIMESHIFT,
FoilAuthToken::DigestAlgorithmMD5).toUri();
g_assert(uri == QString("otpauth://totp/Test?secret=vhiiktvjc6meoftj&digits=6&algorithm=MD5"));
- uri = FoilAuthToken(QByteArray((char*)bytes, sizeof(bytes)), "Test",
- QString(), 6, FoilAuthToken::DEFAULT_TIMESHIFT,
+ uri = FoilAuthToken(FoilAuthToken::AuthTypeTOTP,
+ QByteArray((char*)bytes, sizeof(bytes)), "Test",
+ QString(), 6, FoilAuthToken::DEFAULT_COUNTER,
+ FoilAuthToken::DEFAULT_TIMESHIFT,
FoilAuthToken::DigestAlgorithmSHA256).toUri();
g_assert(uri == QString("otpauth://totp/Test?secret=vhiiktvjc6meoftj&digits=6&algorithm=SHA256"));
- uri = FoilAuthToken(QByteArray((char*)bytes, sizeof(bytes)), "Test",
- QString(), 6, FoilAuthToken::DEFAULT_TIMESHIFT,
+ uri = FoilAuthToken(FoilAuthToken::AuthTypeTOTP,
+ QByteArray((char*)bytes, sizeof(bytes)), "Test",
+ QString(), 6, FoilAuthToken::DEFAULT_COUNTER,
+ FoilAuthToken::DEFAULT_TIMESHIFT,
FoilAuthToken::DigestAlgorithmSHA512).toUri();
g_assert(uri == QString("otpauth://totp/Test?secret=vhiiktvjc6meoftj&digits=6&algorithm=SHA512"));
}
@@ -223,14 +255,16 @@
// Valid token
g_assert(token.parseUri("otpauth://totp/Test?secret=vhiiktvjc6meoftj&issuer=Issuer&digits=5"));
map = token.toVariantMap();
- g_assert_cmpint(map.count(), == ,8);
+
+ g_assert_cmpint(map.count(), == ,9);
g_assert(map.value(FoilAuthToken::KEY_VALID).toBool());
- g_assert(map.value(FoilAuthToken::KEY_TYPE).toString() == FoilAuthToken::TYPE_TOTP);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_TYPE).toInt(), == ,FoilAuthToken::AuthTypeTOTP);
g_assert(map.value(FoilAuthToken::KEY_LABEL).toString() == QString("Test"));
g_assert(map.value(FoilAuthToken::KEY_SECRET).toString() == QString("vhiiktvjc6meoftj"));
g_assert(map.value(FoilAuthToken::KEY_ISSUER).toString() == QString("Issuer"));
g_assert_cmpint(map.value(FoilAuthToken::KEY_DIGITS).toInt(), == ,5);
- g_assert_cmpint(map.value(FoilAuthToken::KEY_TIMESHIFT).toInt(), == ,0);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_COUNTER).toInt(), == ,FoilAuthToken::DEFAULT_COUNTER);
+ g_assert_cmpint(map.value(FoilAuthToken::KEY_TIMESHIFT).toInt(), == ,FoilAuthToken::DEFAULT_TIMESHIFT);
g_assert_cmpint(map.value(FoilAuthToken::KEY_ALGORITHM).toInt(), == ,FoilAuthToken::DEFAULT_ALGORITHM);
}
@@ -244,7 +278,7 @@
void)
{
static const uchar bytes[] = {
- 0x0a, 0x51, 0x0a, 0x14, 0x85, 0x29, 0xe2, 0x03,
+ 0x0a, 0x4f, 0x0a, 0x14, 0x85, 0x29, 0xe2, 0x03,
0x46, 0x3b, 0xa2, 0x66, 0x0f, 0x5a, 0x93, 0x75,
0x85, 0x53, 0xd5, 0x52, 0x24, 0x25, 0x60, 0x06,
0x12, 0x20, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c,
@@ -254,18 +288,18 @@
0x6f, 0x6d, 0x1a, 0x0f, 0x45, 0x78, 0x61, 0x6d,
0x70, 0x6c, 0x65, 0x20, 0x43, 0x6f, 0x6d, 0x70,
0x61, 0x6e, 0x79, 0x20, 0x01, 0x28, 0x01, 0x30,
- 0x02, 0x38, 0x00,
+ 0x02,
- 0x0a, 0x39, 0x0a, 0x0a, 0x5f, 0x7a, 0x82, 0xa1,
+ 0x0a, 0x37, 0x0a, 0x0a, 0x5f, 0x7a, 0x82, 0xa1,
0x79, 0x58, 0x3c, 0x32, 0x48, 0x0e, 0x12, 0x18,
0x57, 0x6f, 0x72, 0x64, 0x50, 0x72, 0x65, 0x73,
0x73, 0x3a, 0x54, 0x68, 0x69, 0x6e, 0x6b, 0x69,
0x6e, 0x67, 0x54, 0x65, 0x61, 0x70, 0x6f, 0x74,
0x1a, 0x09, 0x57, 0x6f, 0x72, 0x64, 0x50, 0x72,
0x65, 0x73, 0x73, 0x20, 0x02, 0x28, 0x02, 0x30,
- 0x02, 0x38, 0x00,
+ 0x02,
- 0x0a, 0x40, 0x0a, 0x14, 0x82, 0x6b, 0xb2, 0x37,
+ 0x0a, 0x3e, 0x0a, 0x14, 0x82, 0x6b, 0xb2, 0x37,
0xa9, 0x4a, 0x4e, 0x68, 0x71, 0xea, 0xdb, 0x3c,
0x4e, 0xff, 0xd8, 0x65, 0xa8, 0x2e, 0x8f, 0x97,
0x12, 0x18, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
@@ -273,9 +307,8 @@
0x40, 0x67, 0x6d, 0x61, 0x69, 0x6c, 0x2e, 0x63,
0x6f, 0x6d, 0x1a, 0x06, 0x47, 0x6f, 0x6f, 0x67,
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/translations/harbour-foilauth-de.ts
^
|
@@ -141,6 +141,26 @@
<extracomment>Text field placeholder (number of password digits)</extracomment>
<translation>OTP Zeitverschiebung in Sekunden</translation>
</message>
+ <message id="foilauth-token-counter-text">
+ <source>Counter value</source>
+ <extracomment>Text field label (HOTP counter value)</extracomment>
+ <translation type="unfinished">Zählerwert</translation>
+ </message>
+ <message id="foilauth-token-type-label">
+ <source>Type</source>
+ <extracomment>Combo box label</extracomment>
+ <translation type="unfinished">Typ</translation>
+ </message>
+ <message id="foilauth-token-type-totp">
+ <source>Time-based (TOTP)</source>
+ <extracomment>Menu item for time based token</extracomment>
+ <translation type="unfinished">Zeitbasiert (TOTP)</translation>
+ </message>
+ <message id="foilauth-token-type-hotp">
+ <source>Counter-based (HOTP)</source>
+ <extracomment>Menu item for counter based token</extracomment>
+ <translation type="unfinished">Zählerbasiert (HOTP)</translation>
+ </message>
<message id="foilauth-token-scan-button">
<source>Scan QR code</source>
<extracomment>Button label, opens QR code scan window</extracomment>
@@ -186,14 +206,32 @@
<extracomment>Dialog button</extracomment>
<translation>Nein</translation>
</message>
- <message id="foilauth-import-text" numerus="yes">
+ <message id="foilauth-import-first_one">
+ <source>FoilAuth has found 1 unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (first import, one token)</extracomment>
+ <translation type="unfinished">FoilAuth hat 1 unverschlüsseltes SailOTP Token auf dem Gerät gefunden. Möchstest Du es importieren und verschlüssen?</translation>
+ </message>
+ <message id="foilauth-import-first_many" numerus="yes">
<source>FoilAuth has found %0 unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
- <extracomment>Text for import page</extracomment>
- <translation>
+ <extracomment>Text for SailOTP import page (first import, multiple tokens)</extracomment>
+ <translation type="unfinished">
<numerusform>FoilAuth hat %0 unverschlüsselte SailOTP Token auf dem Gerät gefunden. Möchstest Du diese importieren und verschlüssen?</numerusform>
<numerusform>FoilAuth hat %0 unverschlüsselte SailOTP Token auf dem Gerät gefunden. Möchstest Du diese importieren und verschlüssen?</numerusform>
</translation>
</message>
+ <message id="foilauth-import-new_one">
+ <source>FoilAuth has found 1 new unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (one new token is found)</extracomment>
+ <translation type="unfinished">FoilAuth hat ein neues unverschlüsseltes SailOTP Token auf dem Gerät gefunden. Möchstest Du es importieren und verschlüssen?</translation>
+ </message>
+ <message id="foilauth-import-new_many" numerus="yes">
+ <source>FoilAuth has found %0 new unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
+ <extracomment>Text for SailOTP import page (multiple new tokens were found)</extracomment>
+ <translation type="unfinished">
+ <numerusform>FoilAuth hat %0 neue unverschlüsselte SailOTP Token auf dem Gerät gefunden. Möchstest Du diese importieren und verschlüssen?</numerusform>
+ <numerusform>FoilAuth hat %0 neue unverschlüsselte SailOTP Token auf dem Gerät gefunden. Möchstest Du diese importieren und verschlüssen?</numerusform>
+ </translation>
+ </message>
<message id="foilauth-notification-copied_to_clipboard">
<source>Password copied to clipboard</source>
<extracomment>Pop-up notification</extracomment>
@@ -229,10 +267,10 @@
<extracomment>Pulley menu item, creates a new authentication token</extracomment>
<translation>Token hinzufügen</translation>
</message>
- <message id="foilauth-menu-copy">
- <source>Copy</source>
- <extracomment>Context menu item (copy to clipboard)</extracomment>
- <translation>Kopieren</translation>
+ <message id="foilauth-menu-copy_password">
+ <source>Copy password</source>
+ <extracomment>Context menu item (copy password to clipboard)</extracomment>
+ <translation type="unfinished">Passwort kopieren</translation>
</message>
<message id="foilauth-menu-show_qr_code">
<source>Show QR code</source>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/translations/harbour-foilauth-fr.ts
^
|
@@ -141,6 +141,26 @@
<extracomment>Text field placeholder (number of password digits)</extracomment>
<translation>Décalage horaire OTP, en secondes</translation>
</message>
+ <message id="foilauth-token-counter-text">
+ <source>Counter value</source>
+ <extracomment>Text field label (HOTP counter value)</extracomment>
+ <translation type="unfinished">Valeur de compteur</translation>
+ </message>
+ <message id="foilauth-token-type-label">
+ <source>Type</source>
+ <extracomment>Combo box label</extracomment>
+ <translation type="unfinished">Type</translation>
+ </message>
+ <message id="foilauth-token-type-totp">
+ <source>Time-based (TOTP)</source>
+ <extracomment>Menu item for time based token</extracomment>
+ <translation type="unfinished">Basé sur le temps (TOTP)</translation>
+ </message>
+ <message id="foilauth-token-type-hotp">
+ <source>Counter-based (HOTP)</source>
+ <extracomment>Menu item for counter based token</extracomment>
+ <translation type="unfinished">Basé sur un compteur (HOTP)</translation>
+ </message>
<message id="foilauth-token-scan-button">
<source>Scan QR code</source>
<extracomment>Button label, opens QR code scan window</extracomment>
@@ -186,12 +206,30 @@
<extracomment>Dialog button</extracomment>
<translation>Non</translation>
</message>
- <message id="foilauth-import-text" numerus="yes">
+ <message id="foilauth-import-first_one">
+ <source>FoilAuth has found 1 unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (first import, one token)</extracomment>
+ <translation type="unfinished">FoilAuth a trouvé un jeton SailOTP non chiffré sur le périphérique. Souhaitez-vous l’importer et le chiffrer?</translation>
+ </message>
+ <message id="foilauth-import-first_many" numerus="yes">
<source>FoilAuth has found %0 unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
- <extracomment>Text for import page</extracomment>
- <translation>
- <numerusform>FoilAuth a trouvé %0 jeton SailOTP non chiffré sur le périphérique. Souhaitez-vous l’importer et le chiffrer ?</numerusform>
- <numerusform>FoilAuth a trouvé %0 jetons SailOTP non chiffrés sur le périphérique. Souhaitez-vous les importer et les chiffrer ?</numerusform>
+ <extracomment>Text for SailOTP import page (first import, multiple tokens)</extracomment>
+ <translation type="unfinished">
+ <numerusform>FoilAuth a trouvé %0 jetons SailOTP non chiffrés sur le périphérique. Souhaitez-vous les importer et les chiffrer?</numerusform>
+ <numerusform>FoilAuth a trouvé %0 jetons SailOTP non chiffrés sur le périphérique. Souhaitez-vous les importer et les chiffrer?</numerusform>
+ </translation>
+ </message>
+ <message id="foilauth-import-new_one">
+ <source>FoilAuth has found 1 new unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (one new token is found)</extracomment>
+ <translation type="unfinished">FoilAuth a trouvé un nouveau jeton SailOTP non chiffré sur le périphérique. Souhaitez-vous l’importer et le chiffrer?</translation>
+ </message>
+ <message id="foilauth-import-new_many" numerus="yes">
+ <source>FoilAuth has found %0 new unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
+ <extracomment>Text for SailOTP import page (multiple new tokens were found)</extracomment>
+ <translation type="unfinished">
+ <numerusform>FoilAuth a trouvé %0 nouveaux jetons SailOTP non chiffrés sur le périphérique. Souhaitez-vous les importer et les chiffrer?</numerusform>
+ <numerusform>FoilAuth a trouvé %0 nouveaux jetons SailOTP non chiffrés sur le périphérique. Souhaitez-vous les importer et les chiffrer?</numerusform>
</translation>
</message>
<message id="foilauth-notification-copied_to_clipboard">
@@ -214,10 +252,10 @@
<extracomment>Pulley menu item, creates a new authentication token</extracomment>
<translation>Ajouter un jeton</translation>
</message>
- <message id="foilauth-menu-copy">
- <source>Copy</source>
- <extracomment>Context menu item (copy to clipboard)</extracomment>
- <translation>Copier</translation>
+ <message id="foilauth-menu-copy_password">
+ <source>Copy password</source>
+ <extracomment>Context menu item (copy password to clipboard)</extracomment>
+ <translation type="unfinished">Copier le mot de passe</translation>
</message>
<message id="foilauth-menu-show_qr_code">
<source>Show QR code</source>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/translations/harbour-foilauth-hu.ts
^
|
@@ -140,6 +140,26 @@
<extracomment>Text field placeholder (number of password digits)</extracomment>
<translation>OTP időeltolódás másodpercben</translation>
</message>
+ <message id="foilauth-token-counter-text">
+ <source>Counter value</source>
+ <extracomment>Text field label (HOTP counter value)</extracomment>
+ <translation type="unfinished">Számlálóérték</translation>
+ </message>
+ <message id="foilauth-token-type-label">
+ <source>Type</source>
+ <extracomment>Combo box label</extracomment>
+ <translation type="unfinished">Típus</translation>
+ </message>
+ <message id="foilauth-token-type-totp">
+ <source>Time-based (TOTP)</source>
+ <extracomment>Menu item for time based token</extracomment>
+ <translation type="unfinished">Idő-alapú (TOTP)</translation>
+ </message>
+ <message id="foilauth-token-type-hotp">
+ <source>Counter-based (HOTP)</source>
+ <extracomment>Menu item for counter based token</extracomment>
+ <translation type="unfinished">Számláló-alapú (HOTP)</translation>
+ </message>
<message id="foilauth-token-scan-button">
<source>Scan QR code</source>
<extracomment>Button label, opens QR code scan window</extracomment>
@@ -185,13 +205,30 @@
<extracomment>Dialog button</extracomment>
<translation>Nem</translation>
</message>
- <message id="foilauth-import-text" numerus="yes">
+ <message id="foilauth-import-first_one">
+ <source>FoilAuth has found 1 unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (first import, one token)</extracomment>
+ <translation type="unfinished">A FoilAuth titkosítatlan SailOTP token talál az eszközén. Szeretné importálni és titkosítani?</translation>
+ </message>
+ <message id="foilauth-import-first_many" numerus="yes">
<source>FoilAuth has found %0 unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
- <extracomment>Text for import page</extracomment>
- <translation>
+ <extracomment>Text for SailOTP import page (first import, multiple tokens)</extracomment>
+ <translation type="unfinished">
<numerusform>A FoilAuth %0 titkosítítlan SailOTP tokent talált a készülékeden. Szeretnéd importálni és titkosítani?</numerusform>
</translation>
</message>
+ <message id="foilauth-import-new_one">
+ <source>FoilAuth has found 1 new unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (one new token is found)</extracomment>
+ <translation type="unfinished">A FoilAuth új titkosítatlan SailOTP tokent talál az eszközén. Szeretné importálni és titkosítani?</translation>
+ </message>
+ <message id="foilauth-import-new_many" numerus="yes">
+ <source>FoilAuth has found %0 new unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
+ <extracomment>Text for SailOTP import page (multiple new tokens were found)</extracomment>
+ <translation type="unfinished">
+ <numerusform>A FoilAuth %0 új titkosítítlan SailOTP tokent talált a készülékeden. Szeretnéd importálni és titkosítani?</numerusform>
+ </translation>
+ </message>
<message id="foilauth-notification-copied_to_clipboard">
<source>Password copied to clipboard</source>
<extracomment>Pop-up notification</extracomment>
@@ -212,10 +249,10 @@
<extracomment>Pulley menu item, creates a new authentication token</extracomment>
<translation>Token hozzáadása</translation>
</message>
- <message id="foilauth-menu-copy">
- <source>Copy</source>
- <extracomment>Context menu item (copy to clipboard)</extracomment>
- <translation>Másolás</translation>
+ <message id="foilauth-menu-copy_password">
+ <source>Copy password</source>
+ <extracomment>Context menu item (copy password to clipboard)</extracomment>
+ <translation type="unfinished">Jelszó másolása</translation>
</message>
<message id="foilauth-menu-show_qr_code">
<source>Show QR code</source>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/translations/harbour-foilauth-pl.ts
^
|
@@ -11,7 +11,7 @@
<message id="foilauth-menu-generate_key">
<source>Generate a new key</source>
<extracomment>Pulley menu item</extracomment>
- <translation>Generuj nowy klucz</translation>
+ <translation>Wygeneruj nowy klucz</translation>
</message>
<message id="foilauth-foil_password-label-enter_password_short">
<source>Secret tokens are locked</source>
@@ -142,6 +142,26 @@
<extracomment>Text field placeholder (number of password digits)</extracomment>
<translation>Zmiana czasu OTP, w sekundach</translation>
</message>
+ <message id="foilauth-token-counter-text">
+ <source>Counter value</source>
+ <extracomment>Text field label (HOTP counter value)</extracomment>
+ <translation type="unfinished">Wartość licznika</translation>
+ </message>
+ <message id="foilauth-token-type-label">
+ <source>Type</source>
+ <extracomment>Combo box label</extracomment>
+ <translation type="unfinished">Typ</translation>
+ </message>
+ <message id="foilauth-token-type-totp">
+ <source>Time-based (TOTP)</source>
+ <extracomment>Menu item for time based token</extracomment>
+ <translation type="unfinished">Na podstawie czasu (TOTP)</translation>
+ </message>
+ <message id="foilauth-token-type-hotp">
+ <source>Counter-based (HOTP)</source>
+ <extracomment>Menu item for counter based token</extracomment>
+ <translation type="unfinished">Na podstawie licznika (HOTP)</translation>
+ </message>
<message id="foilauth-token-scan-button">
<source>Scan QR code</source>
<extracomment>Button label, opens QR code scan window</extracomment>
@@ -187,15 +207,34 @@
<extracomment>Dialog button</extracomment>
<translation>Nie</translation>
</message>
- <message id="foilauth-import-text" numerus="yes">
+ <message id="foilauth-import-first_one">
+ <source>FoilAuth has found 1 unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (first import, one token)</extracomment>
+ <translation type="unfinished">FoilAuth znalazł na twoim urządzeniu 1 niezaszyfrowany token SailOTP. Czy chcesz go zaimportować i zaszyfrować?</translation>
+ </message>
+ <message id="foilauth-import-first_many" numerus="yes">
<source>FoilAuth has found %0 unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
- <extracomment>Text for import page</extracomment>
- <translation>
- <numerusform>FoilAuth znalazł na twoim urządzeniu %0 niezaszyfrowanego tokena SailOTP. Czy chcesz go zaimportować i zaszyfrować?</numerusform>
+ <extracomment>Text for SailOTP import page (first import, multiple tokens)</extracomment>
+ <translation type="unfinished">
+ <numerusform>FoilAuth znalazł na twoim urządzeniu %0 niezaszyfrowanego tokena SailOTP. Czy chcesz je zaimportować i zaszyfrować?</numerusform>
<numerusform>FoilAuth znalazł na twoim urządzeniu %0 niezaszyfrowane tokeny SailOTP. Czy chcesz je zaimportować i zaszyfrować?</numerusform>
<numerusform>FoilAuth znalazł na twoim urządzeniu %0 niezaszyfrowanych tokenów SailOTP. Czy chcesz je zaimportować i zaszyfrować?</numerusform>
</translation>
</message>
+ <message id="foilauth-import-new_one">
+ <source>FoilAuth has found 1 new unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (one new token is found)</extracomment>
+ <translation type="unfinished">FoilAuth znalazł na twoim urządzeniu 1 nowy niezaszyfrowany token SailOTP. Czy chcesz go zaimportować i zaszyfrować?</translation>
+ </message>
+ <message id="foilauth-import-new_many" numerus="yes">
+ <source>FoilAuth has found %0 new unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
+ <extracomment>Text for SailOTP import page (multiple new tokens were found)</extracomment>
+ <translation type="unfinished">
+ <numerusform>FoilAuth znalazł na twoim urządzeniu %0 nowego niezaszyfrowanego tokena SailOTP. Czy chcesz je zaimportować i zaszyfrować?</numerusform>
+ <numerusform>FoilAuth znalazł na twoim urządzeniu %0 nowe niezaszyfrowane tokeny SailOTP. Czy chcesz je zaimportować i zaszyfrować?</numerusform>
+ <numerusform>FoilAuth znalazł na twoim urządzeniu %0 nowych niezaszyfrowanych tokenów SailOTP. Czy chcesz je zaimportować i zaszyfrować?</numerusform>
+ </translation>
+ </message>
<message id="foilauth-notification-copied_to_clipboard">
<source>Password copied to clipboard</source>
<extracomment>Pop-up notification</extracomment>
@@ -231,10 +270,10 @@
<extracomment>Pulley menu item, creates a new authentication token</extracomment>
<translation>Dodaj token</translation>
</message>
- <message id="foilauth-menu-copy">
- <source>Copy</source>
- <extracomment>Context menu item (copy to clipboard)</extracomment>
- <translation>Kopiuj</translation>
+ <message id="foilauth-menu-copy_password">
+ <source>Copy password</source>
+ <extracomment>Context menu item (copy password to clipboard)</extracomment>
+ <translation type="unfinished">Kopiuj hasło</translation>
</message>
<message id="foilauth-menu-show_qr_code">
<source>Show QR code</source>
@@ -369,12 +408,12 @@
<message id="jail-explanation">
<source>This application is not designed to function in a sandbox. Try installing the latest version from <b><a href='%1'>OpenRepos</a></b> or <b><a href='%2'>GitHub</a></b>, it may implement some sort of a workaround. No guarantee, though.</source>
<extracomment>Label text explaining the sandbox situation</extracomment>
- <translation type="unfinished">Ta aplikacja nie jest przeznaczona do działania w piaskownicy. Spróbuj pobrać najnowszą wersję z <b><a href='%1'>OpenRepos</a></b> lub <b><a href='%2'>GitHub</a></b>, to może pomóc. Ale niestety bez gwarancji.</translation>
+ <translation>Ta aplikacja nie jest przeznaczona do działania w piaskownicy. Spróbuj zainstalować najnowszą wersję z <b><a href='%1'>OpenRepos</a></b> lub <b><a href='%2'>GitHub</a></b>, to może pomóc. Nie ma jednak gwarancji.</translation>
</message>
<message id="jail-terminal_hint">
<source>If you have developer mode enabled, you may also try running <b>%1</b> from the terminal. Sorry for the inconvenience!</source>
<extracomment>Hint suggesting to run the app from the terminal</extracomment>
- <translation type="unfinished">A jeśli masz włączony tryb programisty, masz szczęście - możesz uruchomić <b>%1</b> z terminala. Przepraszam za niedogodności!</translation>
+ <translation>Jeśli masz włączony tryb developera, możesz uruchomić <b>%1</b> z terminala. Przepraszam za niedogodności!</translation>
</message>
</context>
</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/translations/harbour-foilauth-ru.ts
^
|
@@ -105,12 +105,12 @@
<message id="foilauth-token-secret-text">
<source>Secret</source>
<extracomment>Text field label (OTP secret)</extracomment>
- <translation>Код авторизации</translation>
+ <translation>Секретный ключ</translation>
</message>
<message id="foilauth-token-secret-placeholder">
<source>Secret OTP key</source>
<extracomment>Text field placeholder (OTP secret)</extracomment>
- <translation>Код авторизации в кодировке Base32</translation>
+ <translation>Секретный ключ в кодировке Base32</translation>
</message>
<message id="foilauth-token-digest_algorithm-label">
<source>Digest algorithm</source>
@@ -142,10 +142,30 @@
<extracomment>Text field placeholder (number of password digits)</extracomment>
<translation>Сдвиг по времени, в секундах</translation>
</message>
+ <message id="foilauth-token-counter-text">
+ <source>Counter value</source>
+ <extracomment>Text field label (HOTP counter value)</extracomment>
+ <translation>Значение счетчика</translation>
+ </message>
+ <message id="foilauth-token-type-label">
+ <source>Type</source>
+ <extracomment>Combo box label</extracomment>
+ <translation>Генерация пароля</translation>
+ </message>
+ <message id="foilauth-token-type-totp">
+ <source>Time-based (TOTP)</source>
+ <extracomment>Menu item for time based token</extracomment>
+ <translation>По текущему времени (TOTP)</translation>
+ </message>
+ <message id="foilauth-token-type-hotp">
+ <source>Counter-based (HOTP)</source>
+ <extracomment>Menu item for counter based token</extracomment>
+ <translation>По счётчику (HOTP)</translation>
+ </message>
<message id="foilauth-token-scan-button">
<source>Scan QR code</source>
<extracomment>Button label, opens QR code scan window</extracomment>
- <translation>Сканировать QR-код</translation>
+ <translation>Отсканировать QR-код</translation>
</message>
<message id="foilauth-notification-unsupported_qrcode">
<source>Invalid or unsupported QR code</source>
@@ -155,7 +175,7 @@
<message id="foilauth-scan-title">
<source>Scan QR code</source>
<extracomment>Page title (suggestion to scan QR code)</extracomment>
- <translation>Сосканируйте QR-код</translation>
+ <translation>Сканирование QR-кода</translation>
</message>
<message id="foilauth-scan-zoom_label">
<source>Zoom</source>
@@ -165,7 +185,7 @@
<message id="foilauth-scan-hint_toggle_flash">
<source>Toggle flashlight</source>
<extracomment>Hint label</extracomment>
- <translation>Можно включать вспышку в качестве подсветки</translation>
+ <translation>Можно включать вспышку для подсветки</translation>
</message>
<message id="foilauth-scan-hint_aspect_ratio">
<source>Switch the aspect ratio between 9:16 and 3:4</source>
@@ -187,13 +207,32 @@
<extracomment>Dialog button</extracomment>
<translation>Нет</translation>
</message>
- <message id="foilauth-import-text" numerus="yes">
+ <message id="foilauth-import-first_one">
+ <source>FoilAuth has found 1 unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (first import, one token)</extracomment>
+ <translation>Извините, но у вас тут нашлась база данных SailOTP, а там лежит незашифрованный cекретный ключ. Вы хотите его зашифровать и использовать в этой программе?</translation>
+ </message>
+ <message id="foilauth-import-first_many" numerus="yes">
<source>FoilAuth has found %0 unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
- <extracomment>Text for import page</extracomment>
+ <extracomment>Text for SailOTP import page (first import, multiple tokens)</extracomment>
+ <translation>
+ <numerusform>Извините, но у вас тут нашлась база данных SailOTP, а там %0 незашифрованный cекретный ключ. Вы хотите их зашифровать и использовать в этой программе?</numerusform>
+ <numerusform>Извините, но у вас тут нашлась база данных SailOTP, а там %0 незашифрованных cекретных ключа. Вы хотите их зашифровать и использовать в этой программе?</numerusform>
+ <numerusform>Извините, но у вас тут нашлась база данных SailOTP, а там %0 незашифрованных cекретных ключей. Вы хотите их зашифровать и использовать в этой программе?</numerusform>
+ </translation>
+ </message>
+ <message id="foilauth-import-new_one">
+ <source>FoilAuth has found 1 new unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (one new token is found)</extracomment>
+ <translation>Извините, но в базе данных SailOTP нашёлся новый незашифрованный cекретный ключ. Вы хотите его зашифровать и использовать в этой программе?</translation>
+ </message>
+ <message id="foilauth-import-new_many" numerus="yes">
+ <source>FoilAuth has found %0 new unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
+ <extracomment>Text for SailOTP import page (multiple new tokens were found)</extracomment>
<translation>
- <numerusform>У вас тут нашлась база данных SailOTP, а там %0 незашифрованный код авторизации. Хотите его зашифровать и использовать в этой программе?</numerusform>
- <numerusform>У вас тут нашлась база данных SailOTP, а там %0 незашифрованных кода авторизации. Хотите их зашифровать и использовать в этой программе?</numerusform>
- <numerusform>У вас тут нашлась база данных SailOTP, а там %0 незашифрованных кодов авторизации. Хотите их зашифровать и использовать в этой программе?</numerusform>
+ <numerusform>Извините, но в базе данных SailOTP нашёлся %0 новый незашифрованный cекретный ключ. Вы хотите их зашифровать и использовать в этой программе?</numerusform>
+ <numerusform>Извините, но в базе данных SailOTP нашлось %0 новых незашифрованных cекретных ключа. Вы хотите их зашифровать и использовать в этой программе?</numerusform>
+ <numerusform>Извините, но в базе данных SailOTP нашлось %0 новых незашифрованных cекретных ключей. Вы хотите их зашифровать и использовать в этой программе?</numerusform>
</translation>
</message>
<message id="foilauth-notification-copied_to_clipboard">
@@ -231,10 +270,10 @@
<extracomment>Pulley menu item, creates a new authentication token</extracomment>
<translation>Добавить код</translation>
</message>
- <message id="foilauth-menu-copy">
- <source>Copy</source>
- <extracomment>Context menu item (copy to clipboard)</extracomment>
- <translation>Скопировать</translation>
+ <message id="foilauth-menu-copy_password">
+ <source>Copy password</source>
+ <extracomment>Context menu item (copy password to clipboard)</extracomment>
+ <translation>Скопировать пароль</translation>
</message>
<message id="foilauth-menu-show_qr_code">
<source>Show QR code</source>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/translations/harbour-foilauth-sv.ts
^
|
@@ -141,6 +141,27 @@
<extracomment>Text field placeholder (number of password digits)</extracomment>
<translation>OTP-tidsförskjutning i sekunder</translation>
</message>
+ <message id="foilauth-token-counter-text">
+ <source>Counter value</source>
+ <oldsource>Сounter value</oldsource>
+ <extracomment>Text field label (HOTP counter value)</extracomment>
+ <translation type="unfinished">Räknarvärde</translation>
+ </message>
+ <message id="foilauth-token-type-label">
+ <source>Type</source>
+ <extracomment>Combo box label</extracomment>
+ <translation type="unfinished">Typ</translation>
+ </message>
+ <message id="foilauth-token-type-totp">
+ <source>Time-based (TOTP)</source>
+ <extracomment>Menu item for time based token</extracomment>
+ <translation type="unfinished">Tidsbaserad (TOTP)</translation>
+ </message>
+ <message id="foilauth-token-type-hotp">
+ <source>Counter-based (HOTP)</source>
+ <extracomment>Menu item for counter based token</extracomment>
+ <translation type="unfinished">Räknarbaserad (HOTP)</translation>
+ </message>
<message id="foilauth-token-scan-button">
<source>Scan QR code</source>
<extracomment>Button label, opens QR code scan window</extracomment>
@@ -186,12 +207,30 @@
<extracomment>Dialog button</extracomment>
<translation>Nej</translation>
</message>
- <message id="foilauth-import-text" numerus="yes">
+ <message id="foilauth-import-first_one">
+ <source>FoilAuth has found 1 unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (first import, one token)</extracomment>
+ <translation type="unfinished">FoilAuth har hittat en okrypterad SailOTP-token på din enhet. Vill du importera och kryptera det?</translation>
+ </message>
+ <message id="foilauth-import-first_many" numerus="yes">
<source>FoilAuth has found %0 unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
- <extracomment>Text for import page</extracomment>
- <translation>
- <numerusform></numerusform>
- <numerusform></numerusform>
+ <extracomment>Text for SailOTP import page (first import, multiple tokens)</extracomment>
+ <translation type="unfinished">
+ <numerusform>FoilAuth har hittat %0 okrypterade SailOTP-tokens på din enhet. Vill du importera och kryptera dem?</numerusform>
+ <numerusform>FoilAuth har hittat %0 okrypterade SailOTP-tokens på din enhet. Vill du importera och kryptera dem?</numerusform>
+ </translation>
+ </message>
+ <message id="foilauth-import-new_one">
+ <source>FoilAuth has found 1 new unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (one new token is found)</extracomment>
+ <translation type="unfinished">FoilAuth har hittat en ny okrypterad SailOTP-token på din enhet. Vill du importera och kryptera det?</translation>
+ </message>
+ <message id="foilauth-import-new_many" numerus="yes">
+ <source>FoilAuth has found %0 new unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
+ <extracomment>Text for SailOTP import page (multiple new tokens were found)</extracomment>
+ <translation type="unfinished">
+ <numerusform>FoilAuth har hittat %0 nya okrypterade SailOTP-tokens på din enhet. Vill du importera och kryptera dem?</numerusform>
+ <numerusform>FoilAuth har hittat %0 nya okrypterade SailOTP-tokens på din enhet. Vill du importera och kryptera dem?</numerusform>
</translation>
</message>
<message id="foilauth-notification-copied_to_clipboard">
@@ -214,10 +253,10 @@
<extracomment>Pulley menu item, creates a new authentication token</extracomment>
<translation>Lägg till token</translation>
</message>
- <message id="foilauth-menu-copy">
- <source>Copy</source>
- <extracomment>Context menu item (copy to clipboard)</extracomment>
- <translation>Kopiera</translation>
+ <message id="foilauth-menu-copy_password">
+ <source>Copy password</source>
+ <extracomment>Context menu item (copy password to clipboard)</extracomment>
+ <translation type="unfinished">Kopiera lösenord</translation>
</message>
<message id="foilauth-menu-show_qr_code">
<source>Show QR code</source>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/translations/harbour-foilauth-zh_CN.ts
^
|
@@ -140,6 +140,27 @@
<extracomment>Text field placeholder (number of password digits)</extracomment>
<translation>OTP 时间转换, 秒</translation>
</message>
+ <message id="foilauth-token-counter-text">
+ <source>Counter value</source>
+ <oldsource>Next counter value</oldsource>
+ <extracomment>Text field label (HOTP counter value)</extracomment>
+ <translation type="unfinished">柜台的价值</translation>
+ </message>
+ <message id="foilauth-token-type-label">
+ <source>Type</source>
+ <extracomment>Combo box label</extracomment>
+ <translation type="unfinished">类型</translation>
+ </message>
+ <message id="foilauth-token-type-totp">
+ <source>Time-based (TOTP)</source>
+ <extracomment>Menu item for time based token</extracomment>
+ <translation type="unfinished">基于时间(TOTP)</translation>
+ </message>
+ <message id="foilauth-token-type-hotp">
+ <source>Counter-based (HOTP)</source>
+ <extracomment>Menu item for counter based token</extracomment>
+ <translation type="unfinished">基于计数器(HOTP)</translation>
+ </message>
<message id="foilauth-token-scan-button">
<source>Scan QR code</source>
<extracomment>Button label, opens QR code scan window</extracomment>
@@ -185,11 +206,28 @@
<extracomment>Dialog button</extracomment>
<translation>取消</translation>
</message>
- <message id="foilauth-import-text" numerus="yes">
+ <message id="foilauth-import-first_one">
+ <source>FoilAuth has found 1 unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (first import, one token)</extracomment>
+ <translation type="unfinished">FoilAuth 在您的设备上发现了一个未加密的 SailOTP 令牌。 您想导入并加密它吗?</translation>
+ </message>
+ <message id="foilauth-import-first_many" numerus="yes">
<source>FoilAuth has found %0 unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
- <extracomment>Text for import page</extracomment>
- <translation>
- <numerusform>FoilAuth 已在你的设备上找到 %0 未加密的 SailOTP 令牌。 是否导入及加密?</numerusform>
+ <extracomment>Text for SailOTP import page (first import, multiple tokens)</extracomment>
+ <translation type="unfinished">
+ <numerusform>FoilAuth 在您的设备上发现了 %0 个未加密的 SailOTP 令牌。 您想导入并加密它们吗?</numerusform>
+ </translation>
+ </message>
+ <message id="foilauth-import-new_one">
+ <source>FoilAuth has found 1 new unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (one new token is found)</extracomment>
+ <translation type="unfinished">FoilAuth 在您的设备上发现了一个新的未加密的 SailOTP 令牌。 您想导入并加密它吗?</translation>
+ </message>
+ <message id="foilauth-import-new_many" numerus="yes">
+ <source>FoilAuth has found %0 new unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
+ <extracomment>Text for SailOTP import page (multiple new tokens were found)</extracomment>
+ <translation type="unfinished">
+ <numerusform>FoilAuth 在您的设备上发现了 %0 个新的未加密的 SailOTP 令牌。 您想导入并加密它们吗?</numerusform>
</translation>
</message>
<message id="foilauth-notification-copied_to_clipboard">
@@ -212,10 +250,10 @@
<extracomment>Pulley menu item, creates a new authentication token</extracomment>
<translation>添加令牌</translation>
</message>
- <message id="foilauth-menu-copy">
- <source>Copy</source>
- <extracomment>Context menu item (copy to clipboard)</extracomment>
- <translation>复制</translation>
+ <message id="foilauth-menu-copy_password">
+ <source>Copy password</source>
+ <extracomment>Context menu item (copy password to clipboard)</extracomment>
+ <translation type="unfinished">复制密码</translation>
</message>
<message id="foilauth-menu-show_qr_code">
<source>Show QR code</source>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.0.19.tar.gz/translations/harbour-foilauth.ts
^
|
@@ -141,6 +141,26 @@
<extracomment>Text field placeholder (number of password digits)</extracomment>
<translation>OTP time shift, in seconds</translation>
</message>
+ <message id="foilauth-token-counter-text">
+ <source>Counter value</source>
+ <extracomment>Text field label (HOTP counter value)</extracomment>
+ <translation>Counter value</translation>
+ </message>
+ <message id="foilauth-token-type-label">
+ <source>Type</source>
+ <extracomment>Combo box label</extracomment>
+ <translation>Type</translation>
+ </message>
+ <message id="foilauth-token-type-totp">
+ <source>Time-based (TOTP)</source>
+ <extracomment>Menu item for time based token</extracomment>
+ <translation>Time-based (TOTP)</translation>
+ </message>
+ <message id="foilauth-token-type-hotp">
+ <source>Counter-based (HOTP)</source>
+ <extracomment>Menu item for counter based token</extracomment>
+ <translation>Counter-based (HOTP)</translation>
+ </message>
<message id="foilauth-token-scan-button">
<source>Scan QR code</source>
<extracomment>Button label, opens QR code scan window</extracomment>
@@ -186,14 +206,32 @@
<extracomment>Dialog button</extracomment>
<translation>No</translation>
</message>
- <message id="foilauth-import-text" numerus="yes">
+ <message id="foilauth-import-first_one">
+ <source>FoilAuth has found 1 unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (first import, one token)</extracomment>
+ <translation>FoilAuth has found an unencrypted SailOTP token on your device. Would you like to import and encrypt it?</translation>
+ </message>
+ <message id="foilauth-import-first_many" numerus="yes">
<source>FoilAuth has found %0 unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
- <extracomment>Text for import page</extracomment>
+ <extracomment>Text for SailOTP import page (first import, multiple tokens)</extracomment>
<translation>
- <numerusform>FoilAuth has found %0 unencrypted SailOTP token on your device. Would you like to import and encrypt it?</numerusform>
+ <numerusform>FoilAuth has found %0 unencrypted SailOTP token on your device. Would you like to import and encrypt them?</numerusform>
<numerusform>FoilAuth has found %0 unencrypted SailOTP tokens on your device. Would you like to import and encrypt them?</numerusform>
</translation>
</message>
+ <message id="foilauth-import-new_one">
+ <source>FoilAuth has found 1 new unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
+ <extracomment>Text for SailOTP import page (one new token is found)</extracomment>
+ <translation>FoilAuth has found a new unencrypted SailOTP token on your device. Would you like to import and encrypt it?</translation>
+ </message>
+ <message id="foilauth-import-new_many" numerus="yes">
+ <source>FoilAuth has found %0 new unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
+ <extracomment>Text for SailOTP import page (multiple new tokens were found)</extracomment>
+ <translation>
+ <numerusform>FoilAuth has found %0 new unencrypted SailOTP token on your device. Would you like to import and encrypt them?</numerusform>
+ <numerusform>FoilAuth has found %0 new unencrypted SailOTP tokens on your device. Would you like to import and encrypt them?</numerusform>
+ </translation>
+ </message>
<message id="foilauth-notification-copied_to_clipboard">
<source>Password copied to clipboard</source>
<extracomment>Pop-up notification</extracomment>
@@ -229,10 +267,10 @@
<extracomment>Pulley menu item, creates a new authentication token</extracomment>
<translation>Add token</translation>
</message>
- <message id="foilauth-menu-copy">
- <source>Copy</source>
- <extracomment>Context menu item (copy to clipboard)</extracomment>
- <translation>Copy</translation>
+ <message id="foilauth-menu-copy_password">
+ <source>Copy password</source>
+ <extracomment>Context menu item (copy password to clipboard)</extracomment>
+ <translation>Copy password</translation>
</message>
<message id="foilauth-menu-show_qr_code">
<source>Show QR code</source>
|