summaryrefslogtreecommitdiff
path: root/doc/rfc/rfc6287.txt
blob: 07e69c268c58b15ab43ab5bd58cc7cb9324951a7 (plain) (blame)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
Internet Engineering Task Force (IETF)                        D. M'Raihi
Request for Comments: 6287                                Verisign, Inc.
Category: Informational                                        J. Rydell
ISSN: 2070-1721                                           Portwise, Inc.
                                                                S. Bajaj
                                                          Symantec Corp.
                                                              S. Machani
                                                        Diversinet Corp.
                                                             D. Naccache
                                                Ecole Normale Superieure
                                                               June 2011


                OCRA: OATH Challenge-Response Algorithm

Abstract

   This document describes an algorithm for challenge-response
   authentication developed by the Initiative for Open Authentication
   (OATH).  The specified mechanisms leverage the HMAC-based One-Time
   Password (HOTP) algorithm and offer one-way and mutual
   authentication, and electronic signature capabilities.

Status of This Memo

   This document is not an Internet Standards Track specification; it is
   published for informational purposes.

   This document is a product of the Internet Engineering Task Force
   (IETF).  It represents the consensus of the IETF community.  It has
   received public review and has been approved for publication by the
   Internet Engineering Steering Group (IESG).  Not all documents
   approved by the IESG are a candidate for any level of Internet
   Standard; see Section 2 of RFC 5741.

   Information about the current status of this document, any errata,
   and how to provide feedback on it may be obtained at
   http://www.rfc-editor.org/info/rfc6287.

Copyright Notice

   Copyright (c) 2011 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



M'Raihi, et al.               Informational                     [Page 1]
^L
RFC 6287                          OCRA                         June 2011


   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 ....................................................3
   2. Notation and Terminology ........................................3
   3. Algorithm Requirements ..........................................3
   4. OCRA Background .................................................4
      4.1. HOTP Algorithm .............................................4
   5. Definition of OCRA ..............................................5
      5.1. DataInput Parameters .......................................5
      5.2. CryptoFunction .............................................7
   6. The OCRASuite ...................................................8
      6.1. Algorithm ..................................................9
      6.2. CryptoFunction .............................................9
      6.3. DataInput ..................................................9
      6.4. OCRASuite Examples ........................................10
   7. Algorithm Modes for Authentication .............................10
      7.1. One-Way Challenge-Response ................................11
      7.2. Mutual Challenge-Response .................................12
      7.3. Algorithm Modes for Signature .............................13
           7.3.1. Plain Signature ....................................13
           7.3.2. Signature with Server Authentication ...............14
   8. Security Considerations ........................................16
      8.1. Security Analysis of OCRA .................................16
      8.2. Implementation Considerations .............................17
   9. Conclusion .....................................................18
   10. Acknowledgements ..............................................18
   11. References ....................................................19
      11.1. Normative References .....................................19
      11.2. Informative References ...................................19
   Appendix A. Reference Implementation ..............................20
   Appendix B. Test Vectors Generation ...............................26
   Appendix C. Test Vectors ..........................................33
     C.1. One-Way Challenge Response .................................34
     C.2. Mutual Challenge-Response ..................................35
     C.3. Plain Signature ............................................37










M'Raihi, et al.               Informational                     [Page 2]
^L
RFC 6287                          OCRA                         June 2011


1.  Introduction

   The Initiative for Open Authentication (OATH) [OATH] has identified
   several use cases and scenarios that require an asynchronous variant
   to accommodate users who do not want to maintain a synchronized
   authentication system.  A commonly accepted method for this is to use
   a challenge-response scheme.

   Such a challenge-response mode of authentication is widely adopted in
   the industry.  Several vendors already offer software applications
   and hardware devices implementing challenge-response -- but each of
   those uses vendor-specific proprietary algorithms.  For the benefits
   of users there is a need for a standardized challenge-response
   algorithm that allows multi-sourcing of token purchases and
   validation systems to facilitate the democratization of strong
   authentication.

   Additionally, this specification describes the means to create
   symmetric key-based short 'electronic signatures'.  Such signatures
   are variants of challenge-response mode where the data to be signed
   becomes the challenge or is used to derive the challenge.  Note that
   the term 'electronic signature' and 'signature' are used
   interchangeably in this document.

2.  Notation and Terminology

   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 [RFC2119].

3.  Algorithm Requirements

   This section presents the main requirements that drove this algorithm
   design.  A lot of emphasis was placed on flexibility and usability,
   under the constraints and specificity of the HMAC-based One-Time
   Password (HOTP) algorithm [RFC4226] and hardware token capabilities.

   R1 - The algorithm MUST support challenge-response-based
   authentication.

   R2 - The algorithm MUST be capable of supporting symmetric key-based
   short electronic signatures.  Essentially, this is a variation of
   challenge-response where the challenge is derived from the data that
   needs to be signed.

   R3 - The algorithm MUST be capable of supporting server
   authentication, whereby the user can verify that he/she is talking to
   a trusted server.



M'Raihi, et al.               Informational                     [Page 3]
^L
RFC 6287                          OCRA                         June 2011


   R4 - The algorithm SHOULD use HOTP [RFC4226] as a key building block.

   R5 - The length and format of the input challenge SHOULD be
   configurable.

   R6 - The output length and format of the generated response SHOULD be
   configurable.

   R7 - The challenge MAY be generated with integrity checking (e.g.,
   parity bits).  This will allow tokens with pin pads to perform simple
   error checking when the user enters the challenge value into a token.

   R8 - There MUST be a unique secret (key) for each token/soft token
   that is shared between the token and the authentication server.  The
   keys MUST be randomly generated or derived using a key derivation
   algorithm.

   R9 - The algorithm MAY enable additional data attributes such as a
   timestamp or session information to be included in the computation.
   These data inputs MAY be used individually or all together.

4.  OCRA Background

   OATH introduced the HOTP algorithm as a first open, freely available
   building block towards strengthening authentication for end-users in
   a variety of applications.  One-time passwords are very efficient at
   solving specific security issues thanks to the dynamic nature of OTP
   computations.

   After carefully analyzing different use cases, OATH came to the
   conclusion that providing for extensions to the HOTP algorithms was
   important.  A very natural extension is to introduce a challenge mode
   for computing HOTP values based on random questions.  Equally
   beneficial is being able to perform mutual authentication between two
   parties, or short-signature computation for authenticating
   transaction to improve the security of e-commerce applications.

4.1.  HOTP Algorithm

   The HOTP algorithm, as defined in [RFC4226], is based on an
   increasing counter value and a static symmetric key known only to the
   prover and verifier parties.

   As a reminder:
                     HOTP(K,C) = Truncate(HMAC-SHA1(K,C))

   where Truncate represents the function that converts an HMAC-SHA-1
   value into an HOTP value.



M'Raihi, et al.               Informational                     [Page 4]
^L
RFC 6287                          OCRA                         June 2011


   We refer the reader to [RFC4226] for the full description and further
   details on the rationale and security analysis of HOTP.

   The present document describes the different variants based on
   similar constructions as HOTP.

5.  Definition of OCRA

   The OATH Challenge-Response Algorithm (OCRA) is a generalization of
   HOTP with variable data inputs not solely based on an incremented
   counter and secret key values.

   The definition of OCRA requires a cryptographic function, a key K and
   a set of DataInput parameters.  This section first formally
   introduces OCRA and then introduces the definitions and default
   values recommended for all parameters.

   In a nutshell,
                     OCRA = CryptoFunction(K, DataInput)

   where:

   o  K: a shared secret key known to both parties

   o  DataInput: a structure that contains the concatenation of the
      various input data values defined in details in section 5.1

   o  CryptoFunction: this is the function performing the OCRA
      computation from the secret key K and the DataInput material;

   CryptoFunction is described in details in Section 5.2

5.1.  DataInput Parameters

   This structure is the concatenation over byte array of the OCRASuite
   value as defined in section 6 with the different parameters used in
   the computation, save for the secret key K.

   DataInput = {OCRASuite | 00 | C | Q | P | S | T} where:

   o  OCRASuite is a value representing the suite of operations to
      compute an OCRA response

   o  00 is a byte value used as a separator







M'Raihi, et al.               Informational                     [Page 5]
^L
RFC 6287                          OCRA                         June 2011


   o  C is an unsigned 8-byte counter value processed high-order bit
      first, and MUST be synchronized between all parties; It loops
      around from "{Hex}0" to "{Hex}FFFFFFFFFFFFFFFF" and then starts
      over at "{Hex}0".  Note that 'C' is optional for all OCRA modes
      described in this document.

   o  Q, mandatory, is a 128-byte list of (concatenated) challenge
      question(s) generated by the parties; if Q is less than 128 bytes,
      then it should be padded with zeroes to the right

   o  P is a hash (SHA-1 [RFC3174], SHA-256 and SHA-512 [SHA2] are
      supported) value of PIN/password that is known to all parties
      during the execution of the algorithm; the length of P will depend
      on the hash function that is used

   o  S is a UTF-8 [RFC3629] encoded string of length up to 512 bytes
      that contains information about the current session; the length of
      S is defined in the OCRASuite string

   o  T is an 8-byte unsigned integer in big-endian order (i.e., network
      byte order) representing the number of time-steps (seconds,
      minutes, hours, or days depending on the specified granularity)
      since midnight UTC of January 1, 1970 [UT].  More specifically, if
      the OCRA computation includes a timestamp T, you should first
      convert your current local time to UTC time; you can then derive
      the UTC time in the proper format (i.e., seconds, minutes, hours,
      or days elapsed from epoch time); the size of the time-step is
      specified in the OCRASuite string as described in Section 6.3

   When computing a response, the concatenation order is always the
   following:

                                    C |

                OTHER-PARTY-GENERATED-CHALLENGE-QUESTION |

                    YOUR-GENERATED-CHALLENGE-QUESTION |

                                 P| S | T

   If a value is empty (i.e., a certain input is not used in the
   computation) then the value is simply not represented in the string.

   The counter on the token or client MUST be incremented every time a
   new computation is requested by the user.  The server's counter value
   MUST only be incremented after a successful OCRA authentication.





M'Raihi, et al.               Informational                     [Page 6]
^L
RFC 6287                          OCRA                         June 2011


5.2.  CryptoFunction

   The default CryptoFunction is HOTP-SHA1-6, i.e., the default mode of
   computation for OCRA is HOTP with the default 6-digit dynamic
   truncation and a combination of DataInput values as the message to
   compute the HMAC-SHA1 digest.

   We denote t as the length in decimal digits of the truncation output.
   For instance, if t = 6, then the output of the truncation is a
   6-digit (decimal) value.

   We define the HOTP family of functions as an extension to HOTP:

   1.  HOTP-H-t: these are the different possible truncated versions of
       HOTP, using the dynamic truncation method for extracting an HOTP
       value from the HMAC output

   2.  We will denote HOTP-H-t as the realization of an HOTP function
       that uses an HMAC function with the hash function H, and the
       dynamic truncation as described in [RFC4226] to extract a t-digit
       value

   3.  t=0 means that no truncation is performed and the full HMAC value
       is used for authentication purposes

   We list the following preferred modes of computation, where * denotes
   the default CryptoFunction:

   o  HOTP-SHA1-4: HOTP with SHA-1 as the hash function for HMAC and a
      dynamic truncation to a 4-digit value; this mode is not
      recommended in the general case, but it can be useful when a very
      short authentication code is needed by an application

   o  HOTP-SHA1-6: HOTP with SHA-1 as the hash function for HMAC and a
      dynamic truncation to a 6-digit value

   o  HOTP-SHA1-8: HOTP with SHA-1 as the hash function for HMAC and a
      dynamic truncation to an 8-digit value

   o  HOTP-SHA256-6: HOTP with SHA-256 as the hash function for HMAC and
      a dynamic truncation to a 6-digit value

   o  HOTP-SHA512-6: HOTP with SHA-512 as the hash function for HMAC and
      a dynamic truncation to a 6-digit value







M'Raihi, et al.               Informational                     [Page 7]
^L
RFC 6287                          OCRA                         June 2011


   This table summarizes all possible values for the CryptoFunction:

     +---------------+--------------------+-------------------------+
     |      Name     | HMAC Function Used |  Size of Truncation (t) |
     +---------------+--------------------+-------------------------+
     |  HOTP-SHA1-t  |      HMAC-SHA1     | 0 (no truncation), 4-10 |
     | HOTP-SHA256-t |     HMAC-SHA256    | 0 (no truncation), 4-10 |
     | HOTP-SHA512-t |     HMAC-SHA512    | 0 (no truncation), 4-10 |
     +---------------+--------------------+-------------------------+

                       Table 1: CryptoFunction Table

6.  The OCRASuite

   An OCRASuite value is a text string that captures one mode of
   operation for OCRA, completely specifying the various options for
   that computation.  An OCRASuite value is represented as follows:

                  <Algorithm>:<CryptoFunction>:<DataInput>


   The OCRASuite value is the concatenation of three sub-components that
   are described below.  Some example OCRASuite strings are described in
   Section 6.4.

   The client and server need to agree on one or two values of
   OCRASuite.  These values may be agreed upon at the time of token
   provisioning or, for more sophisticated client-server interactions,
   these values may be negotiated for every transaction.

   The provisioning of OCRA keys and related metadata such as OCRASuite
   is out of scope for this document.  [RFC6030] specifies one key
   container specification that facilitates provisioning of such data
   between the client and the server.

   Note that for Mutual Challenge-Response or Signature with Server
   Authentication modes, the client and server will need to agree on two
   values of OCRASuite -- one for server computation and another for
   client computation.












M'Raihi, et al.               Informational                     [Page 8]
^L
RFC 6287                          OCRA                         June 2011


6.1.  Algorithm

   Description: Indicates the version of OCRA.

   Values: OCRA-v where v represents the version number (e.g., 1, 2).
   This document specifies version 1 of OCRA.

6.2.  CryptoFunction

   Description: Indicates the function used to compute OCRA values

   Values: Permitted values are described in Section 5.2.

6.3.  DataInput

   Description: This component of the OCRASuite string captures the list
   of valid inputs for that computation; [] indicates a value is
   optional:

   [C] | QFxx | [PH | Snnn | TG] : Challenge-Response computation

   [C] | QFxx | [PH | TG] : Plain Signature computation

   Each input that is used for the computation is represented by a
   single letter (except Q), and they are separated by a hyphen.

   The input for challenge is further qualified by the formats supported
   by the client for challenge question(s).  Supported values can be:

                 +------------------+-------------------+
                 |    Format (F)    | Up to Length (xx) |
                 +------------------+-------------------+
                 | A (alphanumeric) |       04-64       |
                 |    N (numeric)   |       04-64       |
                 |  H (hexadecimal) |       04-64       |
                 +------------------+-------------------+

                      Table 2: Challenge Format Table

   The default challenge format is N08, numeric and up to 8 digits.

   The input for P is further qualified by the hash function used for
   the PIN/password.  Supported values for hash function can be:

   Hash function (H) - SHA1, SHA256, SHA512.

   The default hash function for P is SHA1.




M'Raihi, et al.               Informational                     [Page 9]
^L
RFC 6287                          OCRA                         June 2011


   The input for S is further qualified by the length of the session
   data in bytes.  The client and server could agree to any length but
   the typical values are:

   Length (nnn) - 064, 128, 256, and 512.

   The default length is 064 bytes.

   The input for timestamps is further qualified by G, size of the time-
   step.  G can be specified in number of seconds, minutes, or hours:

           +--------------------+------------------------------+
           | Time-Step Size (G) |           Examples           |
           +--------------------+------------------------------+
           |       [1-59]S      | number of seconds, e.g., 20S |
           |       [1-59]M      |  number of minutes, e.g., 5M |
           |       [0-48]H      |  number of hours, e.g., 24H  |
           +--------------------+------------------------------+

                       Table 3: Time-step Size Table

   Default value for G is 1M, i.e., time-step size is one minute and the
   T represents the number of minutes since epoch time [UT].

6.4.  OCRASuite Examples

   Here are some examples of OCRASuite strings:

   o  "OCRA-1:HOTP-SHA512-8:C-QN08-PSHA1" means version 1 of OCRA with
      HMAC-SHA512 function, truncated to an 8-digit value, using the
      counter, a random challenge, and a SHA1 digest of the PIN/password
      as parameters.  It also indicates that the client supports only
      numeric challenge up to 8 digits in length

   o  "OCRA-1:HOTP-SHA256-6:QA10-T1M" means version 1 of OCRA with HMAC-
      SHA256 function, truncated to a 6-digit value, using a random
      alphanumeric challenge up to 10 characters in length and a
      timestamp in number of minutes since epoch time

   o  "OCRA-1:HOTP-SHA1-4:QH8-S512" means version 1 of OCRA with HMAC-
      SHA1 function, truncated to a 4-digit value, using a random
      hexadecimal challenge up to 8 nibbles and a session value of 512
      bytes

7.  Algorithm Modes for Authentication

   This section describes the typical modes in which the above defined
   computation can be used for authentication.



M'Raihi, et al.               Informational                    [Page 10]
^L
RFC 6287                          OCRA                         June 2011


7.1.  One-Way Challenge-Response

   A challenge-response is a security mechanism in which the verifier
   presents a question (challenge) to the prover, who must provide a
   valid answer (response) to be authenticated.

   To use this algorithm for a one-way challenge-response, the verifier
   will communicate a challenge value (typically randomly generated) to
   the prover.  The prover will use the challenge in the computation as
   described above.  The prover then communicates the response to the
   verifier to authenticate.

   Therefore in this mode, the typical data inputs will be:

      C - Counter, optional.

      Q - Challenge question, mandatory, supplied by the verifier.

      P - Hashed version of PIN/password, optional.

      S - Session information, optional.

      T - Timestamp, optional.

   The diagram below shows the message exchange between the client
   (prover) and the server (verifier) to complete a one-way challenge-
   response authentication.

   It is assumed that the client and server have a pre-shared key K that
   is used for the computation.

              CLIENT                                   SERVER
             (PROVER)                                 VERIFIER)
                |                                        |
                |   Verifier sends challenge to prover   |
                |   Challenge = Q                        |
                |<---------------------------------------|
                |                                        |
                |   Prover Computes Response             |
                |   R = OCRA(K, {[C] | Q | [P | S | T]}) |
                |   Prover sends Response = R            |
                |--------------------------------------->|
                |                                        |
                |  Verifier Validates Response           |
                |  If Response is valid, Server sends OK |
                |  If Response is not,  Server sends NOK |
                |<---------------------------------------|
                |                                        |



M'Raihi, et al.               Informational                    [Page 11]
^L
RFC 6287                          OCRA                         June 2011


7.2.  Mutual Challenge-Response

   Mutual challenge-response is a variation of one-way challenge-
   response where both the client and server mutually authenticate each
   other.

   To use this algorithm, the client will first send a random client-
   challenge to the server.  The server computes the server-response and
   sends it to the client along with a server-challenge.

   The client will first verify the server-response to be assured that
   it is talking to a valid server.  It will then compute the client-
   response and send it to the server to authenticate.  The server
   verifies the client-response to complete the two-way authentication
   process.

   In this mode there are two computations: client-response and server-
   response.  There are two separate challenge questions, generated by
   both parties.  We denote these challenge questions Q1 and Q2.

   Typical data inputs for server-response computation will be:

      C - Counter, optional.

      QC - Challenge question, mandatory, supplied by the client.

      QS - Challenge question, mandatory, supplied by the server.

      S - Session information, optional.

      T - Timestamp, optional.

   Typical data inputs for client-response computation will be:

      C - Counter, optional.

      QS - Challenge question, mandatory, supplied by the server.

      QC - Challenge question, mandatory, supplied by the client.

      P - Hashed version of PIN/password, optional.

      S - Session information, optional.

      T - Timestamp, optional.






M'Raihi, et al.               Informational                    [Page 12]
^L
RFC 6287                          OCRA                         June 2011


   The following diagram shows the messages that are exchanged between
   the client and the server to complete a two-way mutual challenge-
   response authentication.

   It is assumed that the client and server have a pre-shared key K (or
   pair of keys if using dual-key mode of computation) that is used for
   the computation.

         CLIENT                                             SERVER
        (PROVER)                                          (VERIFIER)
           |                                                  |
           |   1. Client sends client-challenge               |
           |   QC = Client-challenge                          |
           |------------------------------------------------->|
           |                                                  |
           |   2. Server computes server-response             |
           |      and sends server-challenge                  |
           |   RS = OCRA(K, [C] | QC | QS | [S | T])          |
           |   QS = Server-challenge                          |
           |   Response = RS, QS                              |
           |<-------------------------------------------------|
           |                                                  |
           |   3. Client verifies server-response             |
           |      and computes client-response                |
           |   OCRA(K, [C] | QC | QS | [S | T]) != RS -> STOP |
           |   RC = OCRA(K, [C] | QS | QC | [P | S | T])      |
           |   Response = RC                                  |
           |------------------------------------------------->|
           |                                                  |
           |   4. Server verifies client-response             |
           |   OCRA(K, [C] | QS | QC | [P|S|T]) != RC -> STOP |
           |   Response = OK                                  |
           |<-------------------------------------------------|
           |                                                  |

7.3.  Algorithm Modes for Signature

   In this section we describe the typical modes in which the above
   defined computation can be used for electronic signatures.

7.3.1.  Plain Signature

   To use this algorithm in plain signature mode, the server will
   communicate a signature-challenge value to the client (signer).  The
   signature-challenge is either the data to be signed or derived from
   the data to be signed using a hash function, for example.





M'Raihi, et al.               Informational                    [Page 13]
^L
RFC 6287                          OCRA                         June 2011


   The client will use the signature-challenge in the computation as
   described above.  The client then communicates the signature value
   (response) to the server to authenticate.

   Therefore in this mode, the data inputs will be:

      C - Counter, optional.

      QS - Signature-challenge, mandatory, supplied by the server.

      P - Hashed version of PIN/password, optional.

      T - Timestamp, optional.

   The picture below shows the messages that are exchanged between the
   client (prover) and the server (verifier) to complete a plain
   signature operation.

   It is assumed that the client and server have a pre-shared key K that
   is used for the computation.

             CLIENT                                     SERVER
            (PROVER)                                  (VERIFIER)
               |                                           |
               |    Verifier sends signature-challenge     |
               |    Challenge = QS                         |
               |<------------------------------------------|
               |                                           |
               |    Client Computes Response               |
               |    SIGN = OCRA(K, [C] | QS | [P | T])     |
               |    Response = SIGN                        |
               |------------------------------------------>|
               |                                           |
               |    Verifier Validates Response            |
               |    Response = OK                          |
               |<------------------------------------------|
               |                                           |

7.3.2.  Signature with Server Authentication

   This mode is a variation of the plain signature mode where the client
   can first authenticate the server before generating a electronic
   signature.

   To use this algorithm, the client will first send a random client-
   challenge to the server.  The server computes the server-response and
   sends it to the client along with a signature-challenge.




M'Raihi, et al.               Informational                    [Page 14]
^L
RFC 6287                          OCRA                         June 2011


   The client will first verify the server-response to authenticate that
   it is talking to a valid server.  It will then compute the signature
   and send it to the server.

   In this mode there are two computations: client-signature and server-
   response.

   Typical data inputs for server-response computation will be:

      C - Counter, optional.

      QC - Challenge question, mandatory, supplied by the client.

      QS - Signature-challenge, mandatory, supplied by the server.

      T - Timestamp, optional.

   Typical data inputs for client-signature computation will be:

      C - Counter, optional.

      QC - Challenge question, mandatory, supplied by the client.

      QS - Signature-challenge, mandatory, supplied by the server.

      P - Hashed version of PIN/password, optional.

      T - Timestamp, optional.

   The diagram below shows the messages that are exchanged between the
   client and the server to complete a signature with server
   authentication transaction.

   It is assumed that the client and server have a pre-shared key K (or
   pair of keys if using dual-key mode of computation) that is used for
   the computation.















M'Raihi, et al.               Informational                    [Page 15]
^L
RFC 6287                          OCRA                         June 2011


        CLIENT                                              SERVER
       (PROVER)                                            VERIFIER)
          |                                                   |
          |    1. Client sends client-challenge               |
          |    QC = Client-challenge                          |
          |-------------------------------------------------->|
          |                                                   |
          |    2. Server computes server-response             |
          |       and sends signature-challenge               |
          |    RS = OCRA(K, [C] | QC | QS | [T])              |
          |    QS = signature-challenge                       |
          |    Response = RS, QS                              |
          |<--------------------------------------------------|
          |                                                   |
          |    3. Client verifies server-response             |
          |       and computes signature                      |
          |    OCRA(K, [C] | QC | QS | [T]) != RS -> STOP     |
          |    SIGN = OCRA( K, [C] | QS | QC | [P | T])       |
          |    Response = SIGN                                |
          |-------------------------------------------------->|
          |                                                   |
          |    4. Server verifies Signature                   |
          |    OCRA(K, [C] | QS | QC | [P|T]) != SIGN -> STOP |
          |    Response = OK                                  |
          |<--------------------------------------------------|
          |                                                   |

8.  Security Considerations

   Any algorithm is only as secure as the application and the
   authentication protocols that implement it.  Therefore, this section
   discusses the critical security requirements that our choice of
   algorithm imposes on the authentication protocol and validation
   software.

8.1.  Security Analysis of OCRA

   The security and strength of this algorithm depend on the properties
   of the underlying building block HOTP, which is a construction based
   on HMAC [RFC2104] using SHA-1 [RFC3174] (or SHA-256 or SHA-512
   [SHA2]) as the hash function.

   The conclusion of the security analysis detailed in [RFC4226] is
   that, for all practical purposes, the outputs of the dynamic
   truncation on distinct counter inputs are uniformly and independently
   distributed strings.





M'Raihi, et al.               Informational                    [Page 16]
^L
RFC 6287                          OCRA                         June 2011


   The analysis demonstrates that the best possible attack against the
   HOTP function is the brute force attack.

8.2.  Implementation Considerations

   IC1 - In the authentication mode, the client MUST support two-factor
   authentication, i.e., the communication and verification of something
   you know (secret code such as a password, pass phrase, PIN code,
   etc.) and something you have (token).  The secret code is known only
   to the user and usually entered with the Response value for
   authentication purpose (two-factor authentication).  Alternatively,
   instead of sending something you know to the server, the client may
   use a hash of the password or PIN code in the computation itself,
   thus implicitly enabling two-factor authentication.

   IC2 - Keys SHOULD be of the length of the CryptoFunction output to
   facilitate interoperability.

   IC3 - Keys SHOULD be chosen at random or using a cryptographically
   strong pseudo-random generator properly seeded with a random value.
   We RECOMMEND following the recommendations in [RFC4086] for all
   pseudo-random and random generations.  The pseudo-random numbers used
   for generating the keys SHOULD successfully pass the randomness test
   specified in [CN].

   IC4 - Challenge questions SHOULD be 20-byte values and MUST be at
   least t-byte values where t stands for the digit-length of the OCRA
   truncation output.

   IC5 - On the client side, the keys SHOULD be embedded in a tamper-
   resistant device or securely implemented in a software application.
   Additionally, by embedding the keys in a hardware device, you also
   have the advantage of improving the flexibility (mobility) of the
   authentication system.

   IC6 - All the communications SHOULD take place over a secure channel,
   e.g., SSL/TLS [RFC5246], IPsec connections.

   IC7 - OCRA, when used in mutual authentication mode or in signature
   with server authentication mode, MAY use dual-key mode -- i.e., there
   are two keys that are shared between the client and the server.  One
   shared key is used to generate the server response on the server side
   and to verify it on the client side.  The other key is used to create
   the response or signature on the client side and to verify it on the
   server side.






M'Raihi, et al.               Informational                    [Page 17]
^L
RFC 6287                          OCRA                         June 2011


   IC8 - We recommend that implementations MAY use the session
   information, S, as an additional input in the computation.  For
   example, S could be the session identifier from the TLS session.

   This will mitigate against certain types of man-in-the-middle
   attacks.  However, this will introduce the additional dependency that
   first of all the prover needs to have access to the session
   identifier to compute the response and the verifier will need access
   to the session identifier to verify the response.  [RFC5056] contains
   a relevant discussion of using Channel Bindings to Secure Channels.

   IC9 - In the signature mode, whenever the counter or time (defined as
   optional elements) are not used in the computation, there might be a
   risk of replay attack and the implementers should carefully consider
   this issue in the light of their specific application requirements
   and security guidelines.  The server SHOULD also provide whenever
   possible a mean for the client (if able) to verify the validity of
   the signature challenge.

   IC10 - We also RECOMMEND storing the keys securely in the validation
   system, and more specifically, encrypting them using tamper-resistant
   hardware encryption and exposing them only when required: for
   example, the key is decrypted when needed to verify an OCRA response,
   and re-encrypted immediately to limit exposure in the RAM for a short
   period of time.  The key store MUST be in a secure area, to avoid as
   much as possible direct attack on the validation system and secrets
   database.  Particularly, access to the key material should be limited
   to programs and processes required by the validation system only.

9.  Conclusion

   This document introduced several variants of HOTP for challenge-
   response-based authentication and short signature-like computations.

   The OCRASuite provides for an easy integration and support of
   different flavors within an authentication and validation system.

   Finally, OCRA should enable mutual authentication both in connected
   and off-line modes, with the support of different response sizes and
   mode of operations.

10.  Acknowledgements

   We would like to thank Jeff Burstein, Shuh Chang, Oanh Hoang, Philip
   Hoyer, Jon Martinsson, Frederik Mennes, Mingliang Pei, Jonathan
   Tuliani, Stu Vaeth, Enrique Rodriguez, and Robert Zuccherato for
   their comments and suggestions to improve this document.




M'Raihi, et al.               Informational                    [Page 18]
^L
RFC 6287                          OCRA                         June 2011


11.  References

11.1.  Normative References

   [RFC2104]  Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed-
              Hashing for Message Authentication", RFC 2104,
              February 1997.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [RFC3174]  Eastlake, D. and P. Jones, "US Secure Hash Algorithm 1
              (SHA1)", RFC 3174, September 2001.

   [RFC3629]  Yergeau, F., "UTF-8, a transformation format of ISO
              10646", STD 63, RFC 3629, November 2003.

   [RFC4086]  Eastlake, D., Schiller, J., and S. Crocker, "Randomness
              Requirements for Security", BCP 106, RFC 4086, June 2005.

   [RFC4226]  M'Raihi, D., Bellare, M., Hoornaert, F., Naccache, D., and
              O. Ranen, "HOTP: An HMAC-Based One-Time Password
              Algorithm", RFC 4226, December 2005.

   [SHA2]     NIST, "FIPS PUB 180-3: Secure Hash Standard (SHS)",
              October 2008, <http://csrc.nist.gov/publications/fips/
              fips180-3/fips180-3_final.pdf>.

11.2.  Informative References

   [CN]       Coron, J. and D. Naccache, "An accurate evaluation of
              Maurer's universal test", LNCS 1556, February 1999, <http:
              //www.gemplus.com/smart/rd/publications/pdf/CN99maur.pdf>.

   [OATH]     Initiative for Open Authentication, "OATH Vision",
              <http://www.openauthentication.org/about>.

   [RFC5056]  Williams, N., "On the Use of Channel Bindings to Secure
              Channels", RFC 5056, November 2007.

   [RFC5246]  Dierks, T. and E. Rescorla, "The Transport Layer Security
              (TLS) Protocol Version 1.2", RFC 5246, August 2008.

   [RFC6030]  Hoyer, P., Pei, M., and S. Machani, "Portable Symmetric
              Key Container (PSKC)", RFC 6030, October 2010.

   [UT]       Wikipedia, "Unix time",
              <http://en.wikipedia.org/wiki/Unix_time>.



M'Raihi, et al.               Informational                    [Page 19]
^L
RFC 6287                          OCRA                         June 2011


Appendix A.  Reference Implementation

  <CODE BEGINS>

  /**
     Copyright (c) 2011 IETF Trust and the persons identified as
     authors of the code. All rights reserved.

     Redistribution and use in source and binary forms, with or without
     modification, is permitted pursuant to, and subject to the license
     terms contained in, the Simplified BSD License set forth in Section
     4.c of the IETF Trust's Legal Provisions Relating to IETF Documents
     (http://trustee.ietf.org/license-info).
   */

  import javax.crypto.Mac;
  import javax.crypto.spec.SecretKeySpec;
  import java.math.BigInteger;

  /**
   * This an example implementation of OCRA.
   * Visit www.openauthentication.org for more information.
   *
   * @author Johan Rydell, PortWise
   */
  public class OCRA {

      private OCRA() {}

      /**
       * This method uses the JCE to provide the crypto
       * algorithm.
       * HMAC computes a Hashed Message Authentication Code with the
       * crypto hash algorithm as a parameter.
       *
       * @param crypto     the crypto algorithm (HmacSHA1, HmacSHA256,
       *                                   HmacSHA512)
       * @param keyBytes   the bytes to use for the HMAC key
       * @param text       the message or text to be authenticated.
       */

      private static byte[] hmac_sha1(String crypto,
                       byte[] keyBytes, byte[] text){
          Mac hmac = null;
          try {
              hmac = Mac.getInstance(crypto);
              SecretKeySpec macKey =
                  new SecretKeySpec(keyBytes, "RAW");



M'Raihi, et al.               Informational                    [Page 20]
^L
RFC 6287                          OCRA                         June 2011


              hmac.init(macKey);
              return hmac.doFinal(text);
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }


      private static final int[] DIGITS_POWER
      // 0 1  2   3    4     5      6       7        8
      = {1,10,100,1000,10000,100000,1000000,10000000,100000000 };

      /**
       * This method converts HEX string to Byte[]
       *
       * @param hex   the HEX string
       *
       * @return      A byte array
       */
      private static byte[] hexStr2Bytes(String hex){
          // Adding one byte to get the right conversion
          // values starting with "0" can be converted
          byte[] bArray = new BigInteger("10" + hex,16).toByteArray();

          // Copy all the REAL bytes, not the "first"
          byte[] ret = new byte[bArray.length - 1];
          System.arraycopy(bArray, 1, ret, 0, ret.length);
          return ret;
      }


      /**
       * This method generates an OCRA HOTP value for the given
       * set of parameters.
       *
       * @param ocraSuite    the OCRA Suite
       * @param key          the shared secret, HEX encoded
       * @param counter      the counter that changes on a per use
       *                     basis, HEX encoded
       * @param question     the challenge question, HEX encoded
       * @param password     a password that can be used, HEX encoded
       * @param sessionInformation Static information that identifies
       *                     the current session, Hex encoded
       * @param timeStamp    a value that reflects a time
       *
       * @return A numeric String in base 10 that includes
       * {@link truncationDigits} digits



M'Raihi, et al.               Informational                    [Page 21]
^L
RFC 6287                          OCRA                         June 2011


       */
      static public String generateOCRA(String ocraSuite,
              String key,
              String counter,
              String question,
              String password,
              String sessionInformation,
              String timeStamp){

          int codeDigits = 0;
          String crypto = "";
          String result = null;
          int ocraSuiteLength = (ocraSuite.getBytes()).length;
          int counterLength = 0;
          int questionLength = 0;
          int passwordLength = 0;
          int sessionInformationLength = 0;
          int timeStampLength = 0;

          // The OCRASuites components
          String CryptoFunction = ocraSuite.split(":")[1];
          String DataInput = ocraSuite.split(":")[2];


          if(CryptoFunction.toLowerCase().indexOf("sha1") > 1)
              crypto = "HmacSHA1";
          if(CryptoFunction.toLowerCase().indexOf("sha256") > 1)
              crypto = "HmacSHA256";
          if(CryptoFunction.toLowerCase().indexOf("sha512") > 1)
              crypto = "HmacSHA512";

          // How many digits should we return
          codeDigits = Integer.decode(CryptoFunction.substring(
                  CryptoFunction.lastIndexOf("-")+1));

          // The size of the byte array message to be encrypted
          // Counter
          if(DataInput.toLowerCase().startsWith("c")) {
              // Fix the length of the HEX string
              while(counter.length() < 16)
                  counter = "0" + counter;
              counterLength=8;
          }
          // Question - always 128 bytes
          if(DataInput.toLowerCase().startsWith("q") ||
                  (DataInput.toLowerCase().indexOf("-q") >= 0)) {
              while(question.length() < 256)
                  question = question + "0";



M'Raihi, et al.               Informational                    [Page 22]
^L
RFC 6287                          OCRA                         June 2011


              questionLength=128;
          }

          // Password - sha1
          if(DataInput.toLowerCase().indexOf("psha1") > 1){
              while(password.length() < 40)
                  password = "0" + password;
              passwordLength=20;
          }

          // Password - sha256
          if(DataInput.toLowerCase().indexOf("psha256") > 1){
              while(password.length() < 64)
                  password = "0" + password;
              passwordLength=32;
          }

          // Password - sha512
          if(DataInput.toLowerCase().indexOf("psha512") > 1){
              while(password.length() < 128)
                  password = "0" + password;
              passwordLength=64;
          }

          // sessionInformation - s064
          if(DataInput.toLowerCase().indexOf("s064") > 1){
              while(sessionInformation.length() < 128)
                  sessionInformation = "0" + sessionInformation;
              sessionInformationLength=64;
          }

          // sessionInformation - s128
          if(DataInput.toLowerCase().indexOf("s128") > 1){
              while(sessionInformation.length() < 256)
                  sessionInformation = "0" + sessionInformation;
              sessionInformationLength=128;
          }

          // sessionInformation - s256
          if(DataInput.toLowerCase().indexOf("s256") > 1){
              while(sessionInformation.length() < 512)
                  sessionInformation = "0" + sessionInformation;
              sessionInformationLength=256;
          }

          // sessionInformation - s512
          if(DataInput.toLowerCase().indexOf("s512") > 1){
              while(sessionInformation.length() < 1024)



M'Raihi, et al.               Informational                    [Page 23]
^L
RFC 6287                          OCRA                         June 2011


                  sessionInformation = "0" + sessionInformation;
              sessionInformationLength=512;
          }

          // TimeStamp
          if(DataInput.toLowerCase().startsWith("t") ||
                  (DataInput.toLowerCase().indexOf("-t") > 1)){
              while(timeStamp.length() < 16)
                  timeStamp = "0" + timeStamp;
              timeStampLength=8;
          }

          // Remember to add "1" for the "00" byte delimiter
          byte[] msg = new byte[ocraSuiteLength +
                        counterLength +
                        questionLength +
                        passwordLength +
                        sessionInformationLength +
                        timeStampLength +
                        1];


          // Put the bytes of "ocraSuite" parameters into the message
          byte[] bArray = ocraSuite.getBytes();
          System.arraycopy(bArray, 0, msg, 0, bArray.length);

          // Delimiter
          msg[bArray.length] = 0x00;

          // Put the bytes of "Counter" to the message
          // Input is HEX encoded
          if(counterLength > 0 ){
              bArray = hexStr2Bytes(counter);
              System.arraycopy(bArray, 0, msg, ocraSuiteLength + 1,
                      bArray.length);
          }


          // Put the bytes of "question" to the message
          // Input is text encoded
          if(questionLength > 0 ){
              bArray = hexStr2Bytes(question);
              System.arraycopy(bArray, 0, msg, ocraSuiteLength + 1 +
                      counterLength, bArray.length);
          }

          // Put the bytes of "password" to the message
          // Input is HEX encoded



M'Raihi, et al.               Informational                    [Page 24]
^L
RFC 6287                          OCRA                         June 2011


          if(passwordLength > 0){
              bArray = hexStr2Bytes(password);
              System.arraycopy(bArray, 0, msg, ocraSuiteLength + 1 +
                      counterLength +    questionLength, bArray.length);

          }

          // Put the bytes of "sessionInformation" to the message
          // Input is text encoded
          if(sessionInformationLength > 0 ){
              bArray = hexStr2Bytes(sessionInformation);
              System.arraycopy(bArray, 0, msg, ocraSuiteLength + 1 +
                      counterLength +     questionLength +
                      passwordLength, bArray.length);
          }

          // Put the bytes of "time" to the message
          // Input is text value of minutes
          if(timeStampLength > 0){
              bArray = hexStr2Bytes(timeStamp);
              System.arraycopy(bArray, 0, msg, ocraSuiteLength + 1 +
                      counterLength + questionLength +
                      passwordLength + sessionInformationLength,
                      bArray.length);
          }

          bArray = hexStr2Bytes(key);

          byte[] hash = hmac_sha1(crypto, bArray, msg);

          // put selected bytes into result int
          int offset = hash[hash.length - 1] & 0xf;

          int binary =
              ((hash[offset] & 0x7f) << 24) |
              ((hash[offset + 1] & 0xff) << 16) |
              ((hash[offset + 2] & 0xff) << 8) |
              (hash[offset + 3] & 0xff);

          int otp = binary % DIGITS_POWER[codeDigits];

          result = Integer.toString(otp);
          while (result.length() < codeDigits) {
              result = "0" + result;
          }
          return result;
      }
  }



M'Raihi, et al.               Informational                    [Page 25]
^L
RFC 6287                          OCRA                         June 2011


  <CODE ENDS>

Appendix B.  Test Vectors Generation

  <CODE BEGINS>

  /**
     Copyright (c) 2011 IETF Trust and the persons identified as
     authors of the code. All rights reserved.

     Redistribution and use in source and binary forms, with or without
     modification, is permitted pursuant to, and subject to the license
     terms contained in, the Simplified BSD License set forth in Section
     4.c of the IETF Trust's Legal Provisions Relating to IETF Documents
     (http://trustee.ietf.org/license-info).
   */

  import java.math.BigInteger;
  import java.util.*;
  import java.text.DateFormat;
  import java.text.SimpleDateFormat;

  public class TestOCRA {

  public static String asHex (byte buf[]) {
      StringBuffer strbuf = new StringBuffer(buf.length * 2);
      int i;

      for (i = 0; i < buf.length; i++) {
          if (((int) buf[i] & 0xff) < 0x10)
              strbuf.append("0");
          strbuf.append(Long.toString((int) buf[i] & 0xff, 16));
      }
      return strbuf.toString();
  }

  /**
   * @param args
   */
  public static void main(String[] args) {

      String ocra = "";
      String seed = "";
      String ocraSuite = "";
      String counter = "";
      String password = "";
      String sessionInformation = "";
      String question = "";



M'Raihi, et al.               Informational                    [Page 26]
^L
RFC 6287                          OCRA                         June 2011


      String qHex = "";
      String timeStamp = "";

      // PASS1234 is SHA1 hash of "1234"
      String PASS1234 = "7110eda4d09e062aa5e4a390b0a572ac0d2c0220";

      String SEED = "3132333435363738393031323334353637383930";
      String SEED32 = "31323334353637383930313233343536373839" +
          "30313233343536373839303132";
      String SEED64 = "31323334353637383930313233343536373839" +
          "3031323334353637383930313233343536373839" +
          "3031323334353637383930313233343536373839" +
          "3031323334";
      int STOP = 5;

      Date myDate = Calendar.getInstance().getTime();
      BigInteger b = new BigInteger("0");
      String sDate = "Mar 25 2008, 12:06:30 GMT";

      try{
          DateFormat df =
              new SimpleDateFormat("MMM dd yyyy, HH:mm:ss zzz");
          myDate = df.parse(sDate);
          b = new BigInteger("0" + myDate.getTime());
          b = b.divide(new BigInteger("60000"));


          System.out.println("Time of \"" + sDate + "\" is in");
          System.out.println("milli sec: " + myDate.getTime());
          System.out.println("minutes: " + b.toString());
          System.out.println("minutes (HEX encoded): "
              + b.toString(16).toUpperCase());
          System.out.println("Time of \"" + sDate
              + "\" is the same as this localized");
          System.out.println("time, \""
              + new Date(myDate.getTime()) + "\"");

          System.out.println();
          System.out.println("Standard 20Byte key: " +
              "3132333435363738393031323334353637383930");
          System.out.println("Standard 32Byte key: " +
              "3132333435363738393031323334353637383930");
          System.out.println("                     " +
              "313233343536373839303132");
          System.out.println("Standard 64Byte key: 313233343536373839"
              + "3031323334353637383930");
          System.out.println("                     313233343536373839"
              + "3031323334353637383930");



M'Raihi, et al.               Informational                    [Page 27]
^L
RFC 6287                          OCRA                         June 2011


          System.out.println("                     313233343536373839"
              + "3031323334353637383930");
          System.out.println("                     31323334");

          System.out.println();
          System.out.println("Plain challenge response");
          System.out.println("========================");
          System.out.println();

          ocraSuite = "OCRA-1:HOTP-SHA1-6:QN08";
          System.out.println(ocraSuite);
          System.out.println("=======================");
          seed = SEED;
          counter = "";
          question = "";
          password = "";
          sessionInformation = "";
          timeStamp = "";
          for(int i=0; i < 10; i++){
              question = "" + i + i + i + i + i + i + i + i;
              qHex = new String((new BigInteger(question,10))
                         .toString(16)).toUpperCase();
              ocra = OCRA.generateOCRA(ocraSuite,seed,counter,
                             qHex,password,
                             sessionInformation,timeStamp);
               System.out.println("Key: Standard 20Byte  Q: "
                      + question + "  OCRA: " + ocra);
          }
          System.out.println();

          ocraSuite = "OCRA-1:HOTP-SHA256-8:C-QN08-PSHA1";
          System.out.println(ocraSuite);
          System.out.println("=================================");
          seed = SEED32;
          counter = "";
          question = "12345678";
          password = PASS1234;
          sessionInformation = "";
          timeStamp = "";
          for(int i=0; i < 10; i++){
              counter = "" + i;
              qHex = new String((new BigInteger(question,10))
                         .toString(16)).toUpperCase();
              ocra = OCRA.generateOCRA(ocraSuite,seed,counter,
                         qHex,password,sessionInformation,timeStamp);
              System.out.println("Key: Standard 32Byte  C: "
                           + counter + "  Q: "
                           + question + "  PIN(1234): ");



M'Raihi, et al.               Informational                    [Page 28]
^L
RFC 6287                          OCRA                         June 2011


              System.out.println(password + "  OCRA: " + ocra);
          }
          System.out.println();

          ocraSuite = "OCRA-1:HOTP-SHA256-8:QN08-PSHA1";
          System.out.println(ocraSuite);
          System.out.println("===============================");
          seed = SEED32;
          counter = "";
          question = "";
          password = PASS1234;
          sessionInformation = "";
          timeStamp = "";
          for(int i=0; i < STOP; i++){
              question = "" + i + i + i + i + i + i + i + i;

              qHex = new String((new BigInteger(question,10))
                          .toString(16)).toUpperCase();
              ocra = OCRA.generateOCRA(ocraSuite,seed,counter,
                       qHex,password,sessionInformation,timeStamp);
              System.out.println("Key: Standard 32Byte  Q: "
                          + question + "  PIN(1234): ");
              System.out.println(password + "  OCRA: " + ocra);
          }
          System.out.println();

          ocraSuite = "OCRA-1:HOTP-SHA512-8:C-QN08";
          System.out.println(ocraSuite);
          System.out.println("===========================");
          seed = SEED64;
          counter = "";
          question = "";
          password = "";
          sessionInformation = "";
          timeStamp = "";
          for(int i=0; i < 10; i++){
              question = "" + i + i + i + i + i + i + i + i;
              qHex = new String((new BigInteger(question,10))
                          .toString(16)).toUpperCase();
              counter = "0000" + i;
              ocra = OCRA.generateOCRA(ocraSuite,seed,counter,
                       qHex,password,sessionInformation,timeStamp);
              System.out.println("Key: Standard 64Byte  C: "
                       + counter + "  Q: "
                       + question + "  OCRA: " + ocra);
          }
          System.out.println();




M'Raihi, et al.               Informational                    [Page 29]
^L
RFC 6287                          OCRA                         June 2011


          ocraSuite = "OCRA-1:HOTP-SHA512-8:QN08-T1M";
          System.out.println(ocraSuite);
          System.out.println("=============================");
          seed = SEED64;
          counter = "";
          question = "";
          password = "";
          sessionInformation = "";
          timeStamp = b.toString(16);
          for(int i=0; i < STOP; i++){
              question = "" + i + i + i + i + i + i + i + i;
              counter = "";
              qHex = new String((new BigInteger(question,10))
                          .toString(16)).toUpperCase();
              ocra = OCRA.generateOCRA(ocraSuite,seed,counter,
                       qHex,password,sessionInformation,timeStamp);

              System.out.println("Key: Standard 64Byte  Q: "
                          + question +"  T: "
                            + timeStamp.toUpperCase()
                          + "  OCRA: " + ocra);
          }
          System.out.println();

          System.out.println();
          System.out.println("Mutual Challenge Response");
          System.out.println("=========================");
          System.out.println();

          ocraSuite = "OCRA-1:HOTP-SHA256-8:QA08";
          System.out.println("OCRASuite (server computation) = "
                             + ocraSuite);
          System.out.println("OCRASuite (client computation) = "
                             + ocraSuite);
          System.out.println("===============================" +
              "===========================");
          seed = SEED32;
          counter = "";
          question = "";
          password = "";
          sessionInformation = "";
          timeStamp = "";
          for(int i=0; i < STOP; i++){
              question = "CLI2222" + i + "SRV1111" + i;
              qHex = asHex(question.getBytes());
              ocra = OCRA.generateOCRA(ocraSuite,seed,counter,qHex,
                           password,sessionInformation,timeStamp);
              System.out.println(



M'Raihi, et al.               Informational                    [Page 30]
^L
RFC 6287                          OCRA                         June 2011


                       "(server)Key: Standard 32Byte  Q: "
                       + question + "  OCRA: "
                       + ocra);
              question = "SRV1111" + i + "CLI2222" + i;
              qHex = asHex(question.getBytes());
              ocra = OCRA.generateOCRA(ocraSuite,seed,counter,qHex,
                           password,sessionInformation,timeStamp);
              System.out.println(
                       "(client)Key: Standard 32Byte  Q: "
                       + question + "  OCRA: "
                       + ocra);
          }
          System.out.println();

          String ocraSuite1 = "OCRA-1:HOTP-SHA512-8:QA08";
          String ocraSuite2 = "OCRA-1:HOTP-SHA512-8:QA08-PSHA1";
          System.out.println("OCRASuite (server computation) = "
                             + ocraSuite1);
          System.out.println("OCRASuite (client computation) = "
                             + ocraSuite2);
          System.out.println("===============================" +
              "=================================");
          ocraSuite = "";
          seed = SEED64;
          counter = "";
          question = "";
          password = "";
          sessionInformation = "";
          timeStamp = "";
          for(int i=0; i < STOP; i++){
              ocraSuite = ocraSuite1;
              question = "CLI2222" + i + "SRV1111" + i;
              qHex = asHex(question.getBytes());
              password = "";
              ocra = OCRA.generateOCRA(ocraSuite,seed,counter,qHex,
                           password,sessionInformation,timeStamp);
              System.out.println(
                          "(server)Key: Standard 64Byte  Q: "
                          + question + "  OCRA: "
                          + ocra);
              ocraSuite = ocraSuite2;
              question = "SRV1111" + i + "CLI2222" + i;
              qHex = asHex(question.getBytes());
              password = PASS1234;
              ocra = OCRA.generateOCRA(ocraSuite,seed,counter,qHex,
                           password,sessionInformation,timeStamp);
              System.out.println("(client)Key: Standard 64Byte  Q: "
                           + question);



M'Raihi, et al.               Informational                    [Page 31]
^L
RFC 6287                          OCRA                         June 2011


              System.out.println("P: " + password.toUpperCase()
                           + "  OCRA: " + ocra);
          }
          System.out.println();

          System.out.println();
          System.out.println("Plain Signature");
          System.out.println("===============");
          System.out.println();
          ocraSuite = "OCRA-1:HOTP-SHA256-8:QA08";
          System.out.println(ocraSuite);
          System.out.println("=========================");
          seed = SEED32;
          counter = "";
          question = "";
          password = "";
          sessionInformation = "";
          timeStamp = "";
          for(int i=0; i < STOP; i++){
              question = "SIG1" + i + "000";
              qHex = asHex(question.getBytes());
              ocra = OCRA.generateOCRA(ocraSuite,seed,counter,qHex,
                           password,sessionInformation,timeStamp);
              System.out.println(
                      "Key: Standard 32Byte  Q(Signature challenge): "
                      + question);
              System.out.println("   OCRA: " + ocra);
          }
          System.out.println();

          ocraSuite = "OCRA-1:HOTP-SHA512-8:QA10-T1M";
          System.out.println(ocraSuite);
          System.out.println("=============================");
          seed = SEED64;
          counter = "";
          question = "";
          password = "";
          sessionInformation = "";
          timeStamp = b.toString(16);
          for(int i=0; i < STOP; i++){
              question = "SIG1" + i + "00000";
              qHex = asHex(question.getBytes());
              ocra = OCRA.generateOCRA(ocraSuite,seed,counter,
                           qHex,password,sessionInformation,timeStamp);
              System.out.println(
                      "Key: Standard 64Byte  Q(Signature challenge): "
                      + question);
              System.out.println("   T: "



M'Raihi, et al.               Informational                    [Page 32]
^L
RFC 6287                          OCRA                         June 2011


                      + timeStamp.toUpperCase() + "  OCRA: "
                      + ocra);
          }

      }catch (Exception e){
                System.out.println("Error : " + e);
      }
  }
  }
  <CODE ENDS>

Appendix C.  Test Vectors

   This section provides test values that can be used for the OCRA
   interoperability test.

   Standard 20Byte key:

   3132333435363738393031323334353637383930

   Standard 32Byte key:

   3132333435363738393031323334353637383930313233343536373839303132

   Standard 64Byte key:

   313233343536373839303132333435363738393031323334353637383930313233343
   53637383930313233343536373839303132333435363738393031323334

   PIN (1234) SHA1 hash value:

   7110eda4d09e062aa5e4a390b0a572ac0d2c0220



















M'Raihi, et al.               Informational                    [Page 33]
^L
RFC 6287                          OCRA                         June 2011


C.1.  One-Way Challenge Response

                +-----------------+----------+------------+
                |       Key       |     Q    | OCRA Value |
                +-----------------+----------+------------+
                | Standard 20Byte | 00000000 |   237653   |
                | Standard 20Byte | 11111111 |   243178   |
                | Standard 20Byte | 22222222 |   653583   |
                | Standard 20Byte | 33333333 |   740991   |
                | Standard 20Byte | 44444444 |   608993   |
                | Standard 20Byte | 55555555 |   388898   |
                | Standard 20Byte | 66666666 |   816933   |
                | Standard 20Byte | 77777777 |   224598   |
                | Standard 20Byte | 88888888 |   750600   |
                | Standard 20Byte | 99999999 |   294470   |
                +-----------------+----------+------------+

                          OCRA-1:HOTP-SHA1-6:QN08

              +-----------------+---+----------+------------+
              |       Key       | C |     Q    | OCRA Value |
              +-----------------+---+----------+------------+
              | Standard 32Byte | 0 | 12345678 |  65347737  |
              | Standard 32Byte | 1 | 12345678 |  86775851  |
              | Standard 32Byte | 2 | 12345678 |  78192410  |
              | Standard 32Byte | 3 | 12345678 |  71565254  |
              | Standard 32Byte | 4 | 12345678 |  10104329  |
              | Standard 32Byte | 5 | 12345678 |  65983500  |
              | Standard 32Byte | 6 | 12345678 |  70069104  |
              | Standard 32Byte | 7 | 12345678 |  91771096  |
              | Standard 32Byte | 8 | 12345678 |  75011558  |
              | Standard 32Byte | 9 | 12345678 |  08522129  |
              +-----------------+---+----------+------------+

                     OCRA-1:HOTP-SHA256-8:C-QN08-PSHA1

                +-----------------+----------+------------+
                |       Key       |     Q    | OCRA Value |
                +-----------------+----------+------------+
                | Standard 32Byte | 00000000 |  83238735  |
                | Standard 32Byte | 11111111 |  01501458  |
                | Standard 32Byte | 22222222 |  17957585  |
                | Standard 32Byte | 33333333 |  86776967  |
                | Standard 32Byte | 44444444 |  86807031  |
                +-----------------+----------+------------+

                      OCRA-1:HOTP-SHA256-8:QN08-PSHA1




M'Raihi, et al.               Informational                    [Page 34]
^L
RFC 6287                          OCRA                         June 2011


            +-----------------+-------+----------+------------+
            |       Key       |   C   |     Q    | OCRA Value |
            +-----------------+-------+----------+------------+
            | Standard 64Byte | 00000 | 00000000 |  07016083  |
            | Standard 64Byte | 00001 | 11111111 |  63947962  |
            | Standard 64Byte | 00002 | 22222222 |  70123924  |
            | Standard 64Byte | 00003 | 33333333 |  25341727  |
            | Standard 64Byte | 00004 | 44444444 |  33203315  |
            | Standard 64Byte | 00005 | 55555555 |  34205738  |
            | Standard 64Byte | 00006 | 66666666 |  44343969  |
            | Standard 64Byte | 00007 | 77777777 |  51946085  |
            | Standard 64Byte | 00008 | 88888888 |  20403879  |
            | Standard 64Byte | 00009 | 99999999 |  31409299  |
            +-----------------+-------+----------+------------+

                        OCRA-1:HOTP-SHA512-8:C-QN08

           +-----------------+----------+---------+------------+
           |       Key       |     Q    |    T    | OCRA Value |
           +-----------------+----------+---------+------------+
           | Standard 64Byte | 00000000 | 132d0b6 |  95209754  |
           | Standard 64Byte | 11111111 | 132d0b6 |  55907591  |
           | Standard 64Byte | 22222222 | 132d0b6 |  22048402  |
           | Standard 64Byte | 33333333 | 132d0b6 |  24218844  |
           | Standard 64Byte | 44444444 | 132d0b6 |  36209546  |
           +-----------------+----------+---------+------------+

                       OCRA-1:HOTP-SHA512-8:QN08-T1M

C.2.  Mutual Challenge-Response

   OCRASuite (server computation) = OCRA-1:HOTP-SHA256-8:QA08

   OCRASuite (client computation) = OCRA-1:HOTP-SHA256-8:QA08

            +-----------------+------------------+------------+
            |       Key       |         Q        | OCRA Value |
            +-----------------+------------------+------------+
            | Standard 32Byte | CLI22220SRV11110 |  28247970  |
            | Standard 32Byte | CLI22221SRV11111 |  01984843  |
            | Standard 32Byte | CLI22222SRV11112 |  65387857  |
            | Standard 32Byte | CLI22223SRV11113 |  03351211  |
            | Standard 32Byte | CLI22224SRV11114 |  83412541  |
            +-----------------+------------------+------------+

                    Server -- OCRA-1:HOTP-SHA256-8:QA08





M'Raihi, et al.               Informational                    [Page 35]
^L
RFC 6287                          OCRA                         June 2011


            +-----------------+------------------+------------+
            |       Key       |         Q        | OCRA Value |
            +-----------------+------------------+------------+
            | Standard 32Byte | SRV11110CLI22220 |  15510767  |
            | Standard 32Byte | SRV11111CLI22221 |  90175646  |
            | Standard 32Byte | SRV11112CLI22222 |  33777207  |
            | Standard 32Byte | SRV11113CLI22223 |  95285278  |
            | Standard 32Byte | SRV11114CLI22224 |  28934924  |
            +-----------------+------------------+------------+

                    Client -- OCRA-1:HOTP-SHA256-8:QA08

   OCRASuite (server computation) = OCRA-1:HOTP-SHA512-8:QA08

   OCRASuite (client computation) = OCRA-1:HOTP-SHA512-8:QA08-PSHA1

            +-----------------+------------------+------------+
            |       Key       |         Q        | OCRA Value |
            +-----------------+------------------+------------+
            | Standard 64Byte | CLI22220SRV11110 |  79496648  |
            | Standard 64Byte | CLI22221SRV11111 |  76831980  |
            | Standard 64Byte | CLI22222SRV11112 |  12250499  |
            | Standard 64Byte | CLI22223SRV11113 |  90856481  |
            | Standard 64Byte | CLI22224SRV11114 |  12761449  |
            +-----------------+------------------+------------+

                    Server -- OCRA-1:HOTP-SHA512-8:QA08

            +-----------------+------------------+------------+
            |       Key       |         Q        | OCRA Value |
            +-----------------+------------------+------------+
            | Standard 64Byte | SRV11110CLI22220 |  18806276  |
            | Standard 64Byte | SRV11111CLI22221 |  70020315  |
            | Standard 64Byte | SRV11112CLI22222 |  01600026  |
            | Standard 64Byte | SRV11113CLI22223 |  18951020  |
            | Standard 64Byte | SRV11114CLI22224 |  32528969  |
            +-----------------+------------------+------------+

                 Client -- OCRA-1:HOTP-SHA512-8:QA08-PSHA1












M'Raihi, et al.               Informational                    [Page 36]
^L
RFC 6287                          OCRA                         June 2011


C.3.  Plain Signature

   In this mode of operation, Q represents the signature challenge.

                +-----------------+----------+------------+
                |       Key       |     Q    | OCRA Value |
                +-----------------+----------+------------+
                | Standard 32Byte | SIG10000 |  53095496  |
                | Standard 32Byte | SIG11000 |  04110475  |
                | Standard 32Byte | SIG12000 |  31331128  |
                | Standard 32Byte | SIG13000 |  76028668  |
                | Standard 32Byte | SIG14000 |  46554205  |
                +-----------------+----------+------------+

                         OCRA-1:HOTP-SHA256-8:QA08

          +-----------------+------------+---------+------------+
          |       Key       |      Q     |    T    | OCRA Value |
          +-----------------+------------+---------+------------+
          | Standard 64Byte | SIG1000000 | 132d0b6 |  77537423  |
          | Standard 64Byte | SIG1100000 | 132d0b6 |  31970405  |
          | Standard 64Byte | SIG1200000 | 132d0b6 |  10235557  |
          | Standard 64Byte | SIG1300000 | 132d0b6 |  95213541  |
          | Standard 64Byte | SIG1400000 | 132d0b6 |  65360607  |
          +-----------------+------------+---------+------------+

                       OCRA-1:HOTP-SHA512-8:QA10-T1M
























M'Raihi, et al.               Informational                    [Page 37]
^L
RFC 6287                          OCRA                         June 2011


Authors' Addresses

   David M'Raihi
   Verisign, Inc.
   487 E. Middlefield Road
   Mountain View, CA  94043
   USA

   EMail: davidietf@gmail.com


   Johan Rydell
   Portwise, Inc.
   275 Hawthorne Ave, Suite 119
   Palo Alto, CA  94301
   USA

   EMail: johanietf@gmail.com


   Siddharth Bajaj
   Symantec Corp.
   350 Ellis Street
   Mountain View, CA  94043
   USA

   EMail: siddharthietf@gmail.com


   Salah Machani
   Diversinet Corp.
   2225 Sheppard Avenue East, Suite 1801
   Toronto, Ontario  M2J 5C2
   Canada

   EMail: smachani@diversinet.com


   David Naccache
   Ecole Normale Superieure
   ENS DI, 45 rue d'Ulm
   Paris,   75005
   France

   EMail: david.naccache@ens.fr






M'Raihi, et al.               Informational                    [Page 38]
^L