forked from Novators/sqrl-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraft-sqrl.txt
2520 lines (1641 loc) · 92 KB
/
draft-sqrl.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Internet Engineering Task Force A. Comley
Internet-Draft
Intended status: Informational S. Killian
Expires: August 5, 2018 February 2018
Secure Quick Reliable Login (SQRL), an Authentication and Identity
Management Framework
draft-sqrl-working
Abstract
Secure Quick Reliable Login (SQRL) is an application-level protocol
for user authentication and identity management. It enables a user
to create and manage a single pseudonymous lifetime identity. That
identity will allow the user to securely authenticate with any SQRL
enabled server without relying on a third party or disclosing
personally identifiable information.
It provides:
o Unique pseudonymous identifiers for each site
o Separation of identity management from account management
o Strong anti-phishing protection
o No shared secrets that can be exploited by bad actors
o Out-of-band authentication for logging in on untrusted devices
Status of This Memo
This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."
This Internet-Draft will expire on August 5, 2018.
Comley & Killian Expires August 5, 2018 [Page 1]
Internet-Draft SQRL February 2018
Copyright Notice
Copyright (c) 2018 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1. Purpose . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2. Features . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3. Requirements Language . . . . . . . . . . . . . . . . . . 6
1.4. Definitions . . . . . . . . . . . . . . . . . . . . . . . 6
2. Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1. Standard Algorithms . . . . . . . . . . . . . . . . . . . 8
2.2. base56check . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.1. Encoding . . . . . . . . . . . . . . . . . . . . . . 9
2.2.2. Validation . . . . . . . . . . . . . . . . . . . . . 10
2.2.3. Decoding . . . . . . . . . . . . . . . . . . . . . . 10
2.3. EnHash . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4. EnScrypt . . . . . . . . . . . . . . . . . . . . . . . . 11
3. Cryptographic Keys, Secrets, and Passwords . . . . . . . . . 12
3.1. Class A Secrets . . . . . . . . . . . . . . . . . . . . . 12
3.1.1. Identity Unlock Key (IUK) . . . . . . . . . . . . . . 13
3.1.2. Unlock Request Signing Key (URSK) . . . . . . . . . . 13
3.1.3. Rescue Code (RC) . . . . . . . . . . . . . . . . . . 13
3.1.4. Password Derived Keys . . . . . . . . . . . . . . . . 13
3.2. Class B Secrets . . . . . . . . . . . . . . . . . . . . . 14
3.2.1. Previous Identity Unlock Key (PIUK) . . . . . . . . . 14
3.2.2. Identity Master Key (IMK) . . . . . . . . . . . . . . 14
3.2.3. Identity Lock Key (ILK) . . . . . . . . . . . . . . . 14
3.2.4. Site Specific Secret Key (SSSK) . . . . . . . . . . . 15
3.2.5. Random Lock Key (RLK) . . . . . . . . . . . . . . . . 15
3.3. Class C (Public) Keys . . . . . . . . . . . . . . . . . . 15
3.3.1. Site Specific Public Key (SSPK) . . . . . . . . . . . 15
3.3.2. Server Unlock Key (SUK) . . . . . . . . . . . . . . . 15
3.3.3. Verify Unlock Key (VUK) . . . . . . . . . . . . . . . 15
4. Identity Management . . . . . . . . . . . . . . . . . . . . . 15
4.1. Identity Lifecycle . . . . . . . . . . . . . . . . . . . 15
Comley & Killian Expires August 5, 2018 [Page 2]
Internet-Draft SQRL February 2018
4.2. User Options . . . . . . . . . . . . . . . . . . . . . . 16
4.3. Identity Storage . . . . . . . . . . . . . . . . . . . . 17
4.3.1. Storage Blocks . . . . . . . . . . . . . . . . . . . 18
4.3.2. Predefined Block Types . . . . . . . . . . . . . . . 18
4.3.3. Encoding . . . . . . . . . . . . . . . . . . . . . . 21
4.4. Identity Operations . . . . . . . . . . . . . . . . . . . 21
4.4.1. Identity Creation . . . . . . . . . . . . . . . . . . 22
4.4.2. Importing / Exporting an Identity . . . . . . . . . . 23
4.4.3. Changing the User's Password . . . . . . . . . . . . 23
4.4.4. Identity Recovery . . . . . . . . . . . . . . . . . . 23
4.4.5. Rekeying an Identity . . . . . . . . . . . . . . . . 24
5. Client-Server Protocol . . . . . . . . . . . . . . . . . . . 25
5.1. Initiation of SQRL Authentication . . . . . . . . . . . . 25
5.1.1. The SQRL Scheme . . . . . . . . . . . . . . . . . . . 25
5.1.2. QR Codes (Out of Band) . . . . . . . . . . . . . . . 25
5.2. The SQRL Realm (Domain) . . . . . . . . . . . . . . . . . 25
5.3. Client to Server Requests . . . . . . . . . . . . . . . . 25
5.3.1. Protocol Version . . . . . . . . . . . . . . . . . . 25
5.3.2. Commands . . . . . . . . . . . . . . . . . . . . . . 26
5.3.3. Options . . . . . . . . . . . . . . . . . . . . . . . 26
5.3.4. The Server Value . . . . . . . . . . . . . . . . . . 26
5.3.5. The Client Value . . . . . . . . . . . . . . . . . . 29
5.3.6. Client Keys . . . . . . . . . . . . . . . . . . . . . 32
5.3.7. Client Signatures . . . . . . . . . . . . . . . . . . 32
5.3.8. Composing the Request . . . . . . . . . . . . . . . . 32
5.4. Server to Client Replies . . . . . . . . . . . . . . . . 32
5.4.1. Required Values . . . . . . . . . . . . . . . . . . . 33
5.4.2. Optional Values . . . . . . . . . . . . . . . . . . . 33
5.4.3. Additional Values . . . . . . . . . . . . . . . . . . 33
5.4.4. Composing the Reply . . . . . . . . . . . . . . . . . 33
6. Client-Server Interactions . . . . . . . . . . . . . . . . . 33
6.1. Same Device Authentication . . . . . . . . . . . . . . . 33
6.2. Cross Device Authentication . . . . . . . . . . . . . . . 33
6.3. Identity Association . . . . . . . . . . . . . . . . . . 33
6.4. Updating Identity Association . . . . . . . . . . . . . . 33
6.5. Disabling Site Login . . . . . . . . . . . . . . . . . . 33
6.6. Re-Enabling Site Login . . . . . . . . . . . . . . . . . 33
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 34
8. Security Considerations . . . . . . . . . . . . . . . . . . . 34
8.1. Phishing . . . . . . . . . . . . . . . . . . . . . . . . 34
8.2. Shoulder-Surfing . . . . . . . . . . . . . . . . . . . . 36
8.3. Evil Router . . . . . . . . . . . . . . . . . . . . . . . 36
8.4. Server Compromise . . . . . . . . . . . . . . . . . . . . 37
8.5. CPU Flooding . . . . . . . . . . . . . . . . . . . . . . 37
8.6. Evil Client . . . . . . . . . . . . . . . . . . . . . . . 38
9. References . . . . . . . . . . . . . . . . . . . . . . . . . 39
9.1. Normative References . . . . . . . . . . . . . . . . . . 39
9.2. Informative References . . . . . . . . . . . . . . . . . 40
Comley & Killian Expires August 5, 2018 [Page 3]
Internet-Draft SQRL February 2018
Appendix A. Recommendations and Best Practices . . . . . . . . . 40
A.1. Logo . . . . . . . . . . . . . . . . . . . . . . . . . . 40
A.2. Font . . . . . . . . . . . . . . . . . . . . . . . . . . 40
A.3. For Clients . . . . . . . . . . . . . . . . . . . . . . . 41
A.4. For Servers . . . . . . . . . . . . . . . . . . . . . . . 41
A.5. For Users . . . . . . . . . . . . . . . . . . . . . . . . 41
A.5.1. Master Password . . . . . . . . . . . . . . . . . . . 41
A.5.2. Identity Backup . . . . . . . . . . . . . . . . . . . 41
A.5.3. Disaster Recovery . . . . . . . . . . . . . . . . . . 42
Appendix B. The Optional ShortPass Feature . . . . . . . . . . . 42
Appendix C. Harvesting Entropy . . . . . . . . . . . . . . . . . 42
C.1. Entropy Sources . . . . . . . . . . . . . . . . . . . . . 43
C.1.1. Operating System . . . . . . . . . . . . . . . . . . 43
C.1.2. Hardware . . . . . . . . . . . . . . . . . . . . . . 43
C.1.3. User . . . . . . . . . . . . . . . . . . . . . . . . 44
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 45
1. Introduction
1.1. Purpose
Secure Quick Reliable Login (SQRL) is an authentication method and
identity management framework which gives the user complete control
over their online identity, including provisions for recovering from
the loss of their identity file or password and recovering from
potential security breaches.
1.2. Features
Secure
Through a series of cryptographic signatures, the user can prove
their identity without disclosing any information that would allow
that identity to be compromised or their account hacked. SQRL
also provides strong anti-phishing features.
Identity Management
SQRL separates and delineates the concepts of account and
identity. SQRL provides a full identity lifecycle management
framework which allows the user to maintain complete control of
their identity, while leaving servers with complete control over
account issues. Even in the event of a compromise, the user
retains the ability to retake control of their identity and lock
the attacker out. Automated rekeying means that the user can
maintain a single SQRL identity indefinitely, even after a
compromise.
Global Password
Comley & Killian Expires August 5, 2018 [Page 4]
Internet-Draft SQRL February 2018
The user only has to remember a single password, which is used to
locally decrypt their identity during SQRL authentication. Since
the user no longer has to remember a unique password for each
site, this one global password can be very strong. This strong
password combined with strong encryption makes it infeasible for
even a state level actor to compromise the user's identity. (SQRL
apps can alternately use other methods of protection such as
biometrics when available on the host device.)
Pseudononymous
SQRL authentication is pseudonymous, in that it only provides a
secure, site-specific token to the server. This token cannot be
directly linked to a user's account at any other server, and
provides no personally identifiable information.
No Shared Secrets
Passwords, time-based authenticators, and other authentication
methods work through shared secrets. These secrets can
conceivably be stolen by hackers or rogue employees and used to
impersonate the user. SQRL does not operate through shared
secrets, and even if the server's account database is stolen the
attacker is not given any means to impersonate the user.
No Third Party
The user's identity cannot be compromised by a security breach at
a third party authentication provider, protecting it from both
hackers and overreaching authorities.
No Per-Site Settings
Unlike password managers, SQRL does not require any information
about specific websites to be saved, preventing potential privacy
issues stemming from information leaks as well as keeping its
database size small.
Offline Identity Backup
Since SQRL identities are intended to last a lifetime, and there
is no third party that can help the user recover their identity if
they forget their password, SQRL includes an offline backup
mechanism. The user can print out or write down their encrypted
identity, along with a secure Rescue Code, that will allow the
user to recover from a forgotten password.
Out Of Band Authentication Option
With SQRL, the user can safely authenticate a session on public or
potentially compromised systems by scanning a QR code on a trusted
mobile device containing their SQRL identity, without the need to
expose that identity to the public system.
Comley & Killian Expires August 5, 2018 [Page 5]
Internet-Draft SQRL February 2018
1.3. Requirements Language
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [RFC2119].
1.4. Definitions
Account
Information on a user's services and permissions on a particular
web site for purposes of facilitating access
Authentication
The process of verifying an identity and attaching it to an
account
Backup
To externally save a user's Rescue Code-protected IUK via file, QR
code, or text without saving the IMK
Client
The user component of SQRL
Export
To externally save a user's Rescue Code-protected IUK and
password-protected IMK via file or QR code
Identity
A means of pseudonymously recognizing a user
Identity Lock
A method of locking a user's identity on various websites
(generally out of fear the user's IMK may be compromised) for
later unlocking with Rescue Code or rekeyed identity
IDK
IDentity Key: a secure, irreversible, and collision-resistant
public key used to identify the user in a specific realm; unique
to both the realm and the user's IMK
ILK
Identity Lock Key: public key counterpart to the IUK
IMK
Identity Master Key: A key derived from the IUK that is the basis
of a user's identity for each realm
Import
Comley & Killian Expires August 5, 2018 [Page 6]
Internet-Draft SQRL February 2018
To load an exported or backed up identity into a client
IUK
Identity Unlock Key: the master key from which all aspects of a
user's identity are derived
Master Password
A password created by the user that is used to derive the
encryption key for the user's IMK
Nut
A unique, unpredictable, cryptographically-strong string
identifying the current session
Pseudonymous
Of a consistent and reliable means of verifying a user without
having to obtain personal information
Realm
The basis for generating a unique identity key; generally the
domain name, but additional data can be included (ref)
Rekey
To replace a potentially-compromised IMK
Rescue Code
A cryptographically-strong 24 decimal digit random number that is
used to derive the encryption key for the user's IUK
RLK
Random Lock Key: generated randomly by a user for a new website
and used as the basis of the Identity Lock system
Server
The backend component of SQRL that verifies a user identity and
attaches it to an account
ShortPass
The first few characters (4 by default) of a user's Master
Password; used to verify the user after the Master Password has
been used to start a session
SUK
Server Unlock Key: public key counterpart to the RLK; sent by the
user to the server on account creation and used to unlock an
identity
VUK
Comley & Killian Expires August 5, 2018 [Page 7]
Internet-Draft SQRL February 2018
Verify Unlock Key: public key counterpart to a Diffie-Hellman key
generated by the RLK and the ILK; later used to verify an unlock
request from the user made from the SUK and the user's IUK
2. Algorithms
TODO
2.1. Standard Algorithms
The following standard algorithms are used in this document:
o AES-GCM [NIST.800-38D]
o base64url: URL safe base64 encoding, as defined in Section 4 of
[RFC3548], without padding.
o Curve25519 [RFC8031]
o Ed25519 [RFC8032]
o HMAC [RFC2104]
o HMAC-SHA256 [RFC4868]
o PBKDF2 [RFC2898]
o scrypt [RFC7914]
o SHA-256 [FIPS.180-4.2015]
o urlencode: Percent-Encoding as defined in Section 2.1 of
[RFC3986].
2.2. base56check
base56check encoding allows the backup of SQRL identities to a
textual form. It:
o Accepts an arbitrarily sized payload.
o Uses a set of 56 alphanumeric symbols chosen to be easily
distinguishable in any font.
o Ignores invalid characters and white space to allow readable
formatting.
Comley & Killian Expires August 5, 2018 [Page 8]
Internet-Draft SQRL February 2018
o Designed to be printed 20 characters per line, in 5 space
separated groups of 4 characters for readability.
o Includes a check character at the end of each line to catch errors
while the user is typing with 98.2% accuracy.
The chosen alphabet is:
23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz
2.2.1. Encoding
To encode a series of bytes to base56check, treat the source bytes as
a single, large, little-endian number and convert using the normal
mathematical steps:
1. Calculate BASE_LENGTH: ceil( SOURCE_LENGTH * 8.0 / log2(56))
2. Divide SOURCE by 56 to yield SOURCE and REMAINDER.
3. Append the character in ALPHABET at position REMAINDER to the
BASE string.
4. Repeat from step 1, until SOURCE is zero.
5. Append '2' (character in ALPHABET at position 0) to BASE until
BASE is BASE_LENGTH bytes long.
Now, with our converted BASE string, we can calculate the check
digits and produce the final output.
6. Split BASE into 19 character CHUNKS (the final chunk may be
smaller).
7. For each CHUNK:
A. Append a single byte zero-based CHUNK-NUMBER to the CHUNK.
B. Perform a SHA-256 hash on the CHUNK, yielding HASH.
C. Treating HASH as a single little-endian number, divide HASH
by 56 to obtain REMAINDER.
D. Replace the last character in CHUNK with the character in
ALPHABET at position REMAINDER.
E. Append the CHUNK to OUTPUT.
Comley & Killian Expires August 5, 2018 [Page 9]
Internet-Draft SQRL February 2018
OUTPUT can then be formatted as desired. The RECOMMENDED formatting
is 20 characters per line in space-separated groups of 4 characters
each. This format is easy for humans to read and type, and allows
error checking for each line of input.
2.2.2. Validation
base56check is designed to provide periodic error checking and
feedback to the user as they are typing. To perform this validation:
1. Remove any characters from INPUT that are invalid (not included
in ALPHABET).
2. Split INPUT into 20 character CHUNKS (the final chunk may be
smaller).
3. For each CHUNK:
A. Store the last character from CHUNK as CHECK.
B. Replace the last character in CHUNK with a single byte zero-
based CHUNK-NUMBER.
C. Perform a SHA-256 hash on the CHUNK, yielding HASH.
D. Treating HASH as a single little-endian number, divide HASH
by 56 to obtain REMAINDER.
E. Compare CHECK with the character from ALPHABET at position
REMAINDER.
F. If comparison passes (is equal), continue. Otherwise, there
is an error in this CHUNK.
2.2.3. Decoding
Decoding base56check is similarly straight-forward:
1. Start with an empty BASE string and an zero OUTPUT buffer, to be
treated as a single, large, little-endian number.
2. Perform the base56check validation as described above, appending
all but the last character of each validated CHUNK to the BASE
string.
3. If any chunk fails validation, abort.
4. For each CHARACTER in BASE, from right to left:
Comley & Killian Expires August 5, 2018 [Page 10]
Internet-Draft SQRL February 2018
A. Multiply OUTPUT by 56.
B. Lookup the INDEX of CHARACTER in ALPHABET.
C. Add INDEX to OUTPUT.
2.3. EnHash
EnHash is an iterated hash used to derive a 256 bit key from another
256 bit key. It is performed by chaining 16 iterations of SHA-256,
with each iteration's output XORed to produce the final output as
follows:
function EnHash ( input := 32 byte key )
{
output := 32 byte buffer;
set output to all NULL (0) bytes;
repeat {
input = SHA256( input );
output = output XOR input;
} 16 times;
return output;
}
2.4. EnScrypt
EnScrypt is an implementation of PBKDF2 using scrypt as a PRF. It
hardens scrypt by allowing for extended processing time while keeping
memory requirements low but still effective.
The following parameters are used for the scrypt function:
+-------+------------+-----+---+
| dkLen | N | r | p |
+-------+------------+-----+---+
| 32 | 512 (1<<9) | 256 | 1 |
+-------+------------+-----+---+
Table 1: scrypt parameters
In this document, we may refer to an additional parameter, "n-factor"
or just "n". This is simply a shorthand way of storing the N
parameter. N is derived from n as follows:
N = (1 << n);
Comley & Killian Expires August 5, 2018 [Page 11]
Internet-Draft SQRL February 2018
Enscrypt is performed by calling scrypt via multiple rounds of
PBKDF2.
EnScrypt can operate in two different modes, the only difference
being when the calculation is stopped.
Counter Mode:
Stops after a predefined number of iterations.
Timer Mode:
Stops after a desired amount of time has passed (5 seconds by
default).
Timer Mode is used when creating an encryption key from a password.
Successive rounds of PBKDF2 are computed until the specified time
elapses. The result is used as the key to encrypt the identity, and
the resulting number of iterations is saved with the identity file.
Counter Mode is used to recreate this key and decrypt the identity.
3. Cryptographic Keys, Secrets, and Passwords
SQRL uses a wide variety of secrets in various operations.
3.1. Class A Secrets
Class A secrets are absolutely critical to protecting a user's
identity. A compromised Class A secret may result in the user's
complete loss of control of the identity, with no recourse available.
Due to their highly sensitive nature, the following precautions are
REQUIRED when dealing with Class A secrets:
o The secret MUST be generated using the highest quality entropy
source available to the client. See Appendix C for
recommendations.
o The client MUST prevent the secret from being written to non-
volatile memory in plaintext form, including being swapped to
disk, by any means possible.
o The plaintext secret MUST be securely wiped from RAM as soon as it
is no longer needed.
o If the secret is to be stored, it MUST be stored in an offline
format (printed), OR encrypted using a Class A key.
o The secret SHOULD NOT be transmitted over the network in any form,
and MUST NOT be transmitted unencrypted.
Comley & Killian Expires August 5, 2018 [Page 12]
Internet-Draft SQRL February 2018
3.1.1. Identity Unlock Key (IUK)
IUK = RandomBytes( 32 );
The IUK is a Class A 256 bit high entropy random number that
represents a user's identity. All other identifying keys are derived
from this one. After identity creation, this key is only used in
emergency situations, such as rekeying an identity in the event of a
possible compromise.
3.1.2. Unlock Request Signing Key (URSK)
URSK = curve25519_key_agreement( SUK, curve25519_private_key( IUK ));
Used by the client to update the identity association on a server,
the URSK is derived from the SUK and IUK.
3.1.3. Rescue Code (RC)
The Rescue Code is a Class A, computer generated, high entropy
passcode consisting of 24 numeric digits. The client SHOULD
encourage the user to store the Rescue Code in an offline format
(printed or written).
3.1.4. Password Derived Keys
Several keys are generated from user input. Both the user supplied
passwords and the derived keys are to be treated as Class A secrets.
Since these are expected to be low entropy, they must be processed
through EnScrypt (Section 2.4). When generating derived keys,
EnScrypt MUST be used in timer mode with a minimum duration of 1
second. The table below lists RECOMMENDED durations for EnScrypt key
generation:
+----------------------------+--------------+---------------+
| Key | Abbreviation | EnScrypt Time |
+----------------------------+--------------+---------------+
| Password Derived Key | PWDK | 5 seconds |
| Short Password Derived Key | SPDK | 1 second |
| Rescue Code Derived Key | RCDK | 60 seconds |
+----------------------------+--------------+---------------+
Table 2: Password Derived Keys and Recommended EnScrypt Times
Clients MAY allow the user to specify the EnScrypt time for the PWDK,
as long as that timer is at least 1 second. The RCDK is used so
rarely, and is so important to protect, that 60 seconds should not
cause an undue burden on the user.
Comley & Killian Expires August 5, 2018 [Page 13]
Internet-Draft SQRL February 2018
When re-generating derived keys, EnScrypt is used in counter mode
with the iteration count from the original generation operation.
3.2. Class B Secrets
Class B secrets are used often, and have less strict security
requirements. A compromised Class B secret may result in an attacker
temporarily gaining the ability to impersonate the user to any
server, but the user can regain control of their identity by rekeying
followed by authenticating with each affected server. The following
precautions are REQUIRED when dealing with Class B secrets:
o The client MUST prevent the secret from being written to non-
volatile memory in plaintext form, including being swapped to
disk, by any means possible.
o The plaintext secret MUST be securely wiped from RAM as soon as it
is no longer needed.
o If the secret is to be stored, it MUST be stored in an encrypted
form.
o The secret SHOULD NOT be transmitted over the network in any form,
and MUST NOT be transmitted unencrypted.
3.2.1. Previous Identity Unlock Key (PIUK)
A PIUK is an IUK that is no longer in active use. It has been
replaced by a newly generated IUK, and requires less strict
protection.
3.2.2. Identity Master Key (IMK)
IMK = EnHash( IUK );
This Class B key acts as a proxy for the IUK during normal SQRL
operation. It is used to generate the unique keys that each site
associates with the user. The IMK is derived from the IUK using the
EnHash (Section 2.3) function.
3.2.3. Identity Lock Key (ILK)
ILK = curve25519_public_key( curve25519_private_key( IUK ));
The (modified) IUK and ILK together form a Curve25519 key pair.
Comley & Killian Expires August 5, 2018 [Page 14]
Internet-Draft SQRL February 2018
3.2.4. Site Specific Secret Key (SSSK)
SSSK = HMAC-SHA256( IMK, Realm );
The Site Specific Secret Key is generated from the IMK and the Realm
(Section 5.2).
3.2.5. Random Lock Key (RLK)
RLK = curve25519_private_key( RandomBytes( 32 ));
The RLK is generated randomly when the client associates with a new
server.
3.3. Class C (Public) Keys
Class C keys are not required to be kept secret.
3.3.1. Site Specific Public Key (SSPK)
SSPK = ed25519_public_key( SSSK );
The Site Specific Public Key (SSPK) is the public counterpart to the
SSSK. It serves as the user's pseudonymous identity on the site.
3.3.2. Server Unlock Key (SUK)
SUK = curve25519_public_key( RLK );
Created during identity association, the SUK is the public
counterpart of the RLK.
3.3.3. Verify Unlock Key (VUK)
VUK = ed25519_public_key( curve25519_key_agreement( ILK, RLK ));
Generated during identity association, and stored only on the server,
the VUK is the public key used to verify the client's URSK.
4. Identity Management
4.1. Identity Lifecycle
TODO
Comley & Killian Expires August 5, 2018 [Page 15]
Internet-Draft SQRL February 2018
4.2. User Options
Several user options are available which will affect the operation of
compatible SQRL clients:
ShortPass Length:
The number of characters from the user's password to use as the
ShortPass (Appendix B). Clients that implement ShortPass MUST
honor the user's choice here. Valid values are 0 to 255. A value
of 0 disables the ShortPass feature.
EnScrypt Seconds:
The number of seconds to run EnScrypt when deriving the PWDK. The
RECOMMENDED default is 5 seconds. The REQUIRED minimum is 1
second.
Idle Timeout:
If the client implements ShortPass or holds the user's password or
keys in memory in any form, and the 0x0080 option flag is set, it
MUST securely erase that memory after this many minutes of system
idle time. Valid values are 1-65535.
Option Flags:
The following binary flags turn on or off various user options:
Comley & Killian Expires August 5, 2018 [Page 16]
Internet-Draft SQRL February 2018
+--------+----------------------------------------------------------+
| Flag | Description |
+--------+----------------------------------------------------------+
| 0x0001 | Check for updates: Gives the client permission to |
| | periodically check for updates. |
| 0x0002 | Update Automatically: Requests that the client |
| | automatically update itself when a new version is |
| | available. |
| 0x0004 | Request SQRL only: Requests that servers disable other |
| | means of authentication and only allow SQRL. |
| 0x0008 | Request no bypass: Requests that servers not allow non- |
| | SQRL account recovery options. |
| 0x0010 | Warn of possible MITM attack: The client will warn the |
| | user if their IP doesn't match the server's |
| | expectations. |
| 0x0020 | Clear ShortPass when screen blanks: The client will |
| | securely erase any ShortPass information when the screen |
| | saver is activated or the system is going to suspend / |
| | sleep modes. |
| 0x0040 | Clear ShortPass when changing users: The client will |
| | securely erase any ShortPass information when the |
| | system's active user changes. |
| 0x0080 | Clear ShortPass after idle timer: The client will |
| | securely erase any ShortPass information after the |
| | system has been idle for an amount of time specified in |
| | the "Idle Timeout" option. |
| 0x0100 | Warn of non-CPS authentication: The client will warn the |
| | user before a non-CPS authentication is attempted. This |
| | flag MUST default to on. |
+--------+----------------------------------------------------------+
User Option Flags
4.3. Identity Storage
Because SQRL identities are intended to last the user's lifetime, the
user needs to be able to move his identity between clients. Every
SQRL client MUST be able to read and write identities in this
standard format. The format described here is RECOMMENDED for both
non-volatile and in-memory storage.
Because identities should be backed up offline (to printed paper),
the storage format must be compact enough to reliably fit in a
printed QR code, and short enough to not cause undue burden if the
user has to type it in by hand.
Values stored in standard SQRL storage format MUST follow these
rules:
Comley & Killian Expires August 5, 2018 [Page 17]
Internet-Draft SQRL February 2018
o All numeric values are unsigned.
o Multibyte numeric values are stored in little endian byte order,
with the least significant byte first.
o String values are stored in natural order, first byte first.
4.3.1. Storage Blocks
A stored SQRL identity is composed of any number of blocks. Each
block begins with a four byte header identifying the total length of
the block and the type of data stored in the block.
+-----------------------------+--------------+
| Field | Size (bytes) |
+-----------------------------+--------------+
| block length in bytes (n+4) | 2 |
| block type | 2 |
| block data | n |
+-----------------------------+--------------+
Table 3: Storage Block Format
Standard block types are defined in the next section. Clients MAY
add their own block types to store additional information, but SHOULD
consider types 0-255 as reserved for future official block types.
Any client reading an identity that encouters a block type unknown to
that client MUST simply ignore that block.
4.3.2. Predefined Block Types
4.3.2.1. Block Type 1: Working Identity
The type 1 block contains the user's encrypted IMK and ILK, as well
as user defined options. The user options are in plain text, but
MUST be regarded as untrusted until authenticated through AES-GCM.
Type 1 blocks are encrypted with AES-GCM using the PWDK. The type 1
block is formatted as follows: