Internet Engineering Task Force D. Atkins
Internet-Draft SecureRF Corporation
Intended status: Standards Track September 15, 2014
Expires: March 19, 2015

Using Algebraic Eraser in OpenPGP
draft-atkins-openpgp-algebraic-eraser-02

Abstract

The Algebraic Eraser(TM) is an encryption engine that supports, among other configurations, a Diffie-Hellman-like key agreement protocol. This draft specifies how to encode, store, share, and use Algebraic Eraser Key Agreement Protocol keys in OpenPGP.

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 March 19, 2015.

Copyright Notice

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

The OpenPGP specification in [RFC4880] defines the use of RSA, Elgamal, and DSA public key algorithms. [RFC6637] adds support for Elliptic Curve Cryptography and specifies the ECDSA and ECDH algorithms.

The Algebraic Eraser was first introduced in Key agreement, the Algebraic Eraser, and lightweight cryptography [AAGL] published by the American Mathematical Society in 2004. It describes "a new key agreement protocol suitable for implementation on low-cost platforms which constrain the use of computational resources." It is further compared to other algorithims in [AEIntro]. This document specifies how to encode, store, and use the Algebraic Eraser(TM) Key Agreement Protocol (AEKAP) in OpenPGP.

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

2. The Algebraic Eraser

The Algebraic Eraser brings together the Braid Group, Matrices, and operations over small Finite Fields to produce an algorithm that executes linear in time with the increase in key size.

A complete description of the Algebraic Eraser is available in [AAGL].

2.1. E-Multiplication

The Algebraic Eraser defines an operation called "E-Multiplication" upon which the algorithm is based (see [AAGL]). E-Multiplication (denoted herein by *) takes one matrix (M0) and permutation (S0) and operates on a second matrix (M1) and permutation (S1), resulting in another matrix (M2) and permutation (S2). In other words: (M0,S0) * (M1,S1) = (M2,S2).

The secret to E-multiplication is that you can take a Braid element (an "Artin generator") and map that to a matrix and permutation upon which you can operate. Specifically, each Artin generator is associated to a specific Colored Burau (CB) matrix and permutation (see [AAGL]). The E-multiplication process involves permuting the variables in the CB matrix using the current permutation, substituting those variables with the TValues from the Keyset (see Section 2.2), then multiplying that against the starting matrix resulting in the another matrix. Then you multiply the permutations, resulting in a new permutation. This new matrix and permutation is the the result of the E-Multiplication.

2.2. AEKAP Keyset Parameters

AEKAP Keyset Parameters are similar to Diffie-Hellman cyclic groups of prime order or ECC curves. Just as users must choose the same DH prime or ECC curve in order to communicate, similarly participants in the AEKAP must be using the same Keyset Parameters.

The first basic set of parameters is the chosen Braid Group and Field Size, BnFq, where n is the number of strands in the chosen braid (also called the braid index) and q is the size of the field in use. The field size, q, must be a power of a prime. Generally it is 2^r (where r is a small integer) although this is not a requirement. For example, one might choose B10F8 or B16F32. This is like choosing how many bits to use when generating a prime for Diffie-Hellman.

Once the BnFq space is chosen then the Keyset Parameters can be generated by a trusted third party (TTP). First they generate an n-by-n matrix (M) where each entry in the matrix is a member of the field Fq. Second, the TTP generates a set of TValues, which is an array of n invertable entries within the field Fq (i.e., values 1 to Fq-1). Finally, the TTP generates at least two sets of braid conjugates, Ca and Cb, where each conjugate in Ca commutes with each conjugate in Cb. The conjugates are lists of "braid words", or "Artin generators" within the Bn braid group. The TTP generates La conjugates for set Ca and Lb conjugates for set Cb, where the numbers La and Lb MAY be different.

The public Keyset Parameters are the Matrix (M), TValues array, and conjugate sets and must be available to generate keys that can communicate. Moreover, the TValue array must be available to anyone using the Keyset. These Keysets MAY be published and named, but MUST be numbered with an OID.

For two users to execute the AEKAP they MUST generate keys from the same Keyset and they MUST choose from different conjugate sets within that Keyset. I.e., for Alice and Bob to complete the AEKAP Alice must generate her key from Ca and Bob must generate his key from Cb.

This document does not specify any particular Keyset Parameters that MUST be implemented.

2.3. Generating Key Pairs

The Algebraic Eraser has a two-part Private Key and a two-part Public Key. The Public key is then generated from the two Private Keys.

To generate the 1st private key you generate a random polynomial and apply that to the public matrix from the keyset within the keyset field. This results in an n-by-n matrix where each entry in the matrix is a member of the field Fq (although the last row of the matrix contains n-1 zeros). The key search space for the 1st private key is q^(n-1). Note that the 1st private key permutation is always the identity permutation, so there is no need to store it.

To generate the 2nd private key you choose a random set of conjugates (and inverses) and string them together. This results in a long string of Artin generators (and inverses). You MAY reduce the string if you so choose using the Dehornoy reduction [Dehornoy]. The search space of the 2nd private key is (2l)^k (where l is the number of published conjugates (La or Lb), and k the number of chosen conjugates and inverses).

The Public Key is computed by an E-Multiplication of the 1st private key and the 2nd private key, where the 2nd private key is iteratively processed (see Section 2.1. The result (the public key) is an n-by-n matrix of Fq and another permutation.

Note that the last row of the Public Key Matrix is all zero except for the last entry. When encoding the Public Key you SHOULD ignore those zeros.

2.4. Computing the Shared Secret

To compute the shared secret you first perform regular matrix multiplication of the 1st private key against the matrix component of the public key you receive from the other person. This results in another matrix. The permutation of the 1st private key is the identity, hence the result of multiplying it against the permutation of the public key leaves the permutation of the public key unchanged and you can just use it directly. Then you perform E-multiplication of this matrix/permutation result against the 2nd private key. The resulting matrix/permutation is the shared secret.

3. Encoding of Public and Private Keys

Each portion of a key can be reduced to a byte-string (or, more accurately, multiple byte strings). Each matrix can be encoded by stringing together each field element in each row and then stringing each row together. A permutation can be encoded by stringing together each element in the list. The conjugates are also encoded by stringing together each element.

The following public key algorithm IDs are added to expand section 9.1 of [RFC4880], "Public-Key Algorithms":

ID Description of Algorithm
TBD1 AEKAP public key algorithm

Encoding of Public and Private keys MUST use the version 4 packet format (or newer).

3.1. Encoding Bit-Strings

The Algebraic eraser uses matrices, fields, and braids that are denoted in bits, particular strings of bits. These objects need to be encoded into bit strings for storage and transmission. The most simplistic method of encoding is to take each field as a byte (or multi-byte word) and string them together. The following sections detail multiple (alternate) ways these bit strings can be encoded to possibly reduce the space used.

3.1.1. Encoding Techniques

Depending on the number of bits used per element (which is defined by the braid index and field size), using different encodings of these strings may result in reducing storage space by dropping extra bits and combining elements.

For example, when using the finite field F16 each entry can be encoded in exactly one nibble of four (4) bits, so you can easily combine two entries into a single 8-bit byte (called nibble-encoding). This technique could also be used for entries smaller than a nibble, although then you would still have extra (unused) bits. When using the nibble-encoding of an odd number of nibbles the encoding rules MUST specify whether the extra nibble is at the leading or trailing byte.

Another encoding option is bit-stealing. This merges all bits together and then cuts it up into 8-bit bytes. For example if the entries are 5 bits each you might steal 3 bits from the second entry to merge into the first, then shift the remaining 2 bits of the second entry, combine with the next 5 bits from the third, and then steal one bit from the fourth entry, and so on, until you've reached the end. This could end up with unused bits at the end of the string.

Yet another option is the reverse-bit-stealing, where you start at the end of the string and work your way to the front. This could leave you with unused bits a the front of the string.

Assume you require five (5) bits to encode your numbers, the following table shows how you could could use bit stealing and reverse bit stealing to encode them (where a, b, c, and d are the bits in the first, second, third, and fourth entries)

Full Bytes: 000aaaaa 000bbbbb 000ccccc 000ddddd
Bit stealing: aaaaabbb bbcccccd dddd0000
Reverse bit stealing: 0000aaaa abbbbbcc cccddddd

Any unused bits MUST be left as zero (and MUST be checked to be zero).

The actual encoding method MUST be defined by the Keyset parameter definition and may change from one keyset parameter to another.

The row of zeros in the matrix SHOULD be assumed to "not exist". When using these encoding techniques you SHOULD just tack the last entry of the final row onto the end of the list of entries of the rest of the matrix. This could result in an odd number of entries depending on your n and q choices potentially requiring passing at the start or end of the bit string.

3.1.2. Multi-Byte Entries

In the case of entries wider than 8 bits (e.g. a Field parameter greater than 256), the bits are combined in network byte order. However they can still be merged together using the same encoding algorithms from Section 3.1.1 in the case of entries that are not 8-bit multiples. For example, a 12-bit field (F4096) could be combined a nibble at a time, or a 10-bit field (F1024) could use bit-stealing.

3.2. Encoding Public Keys

The following algorithm specific packets are added to Section 5.5.2 of [RFC4880], "Public-Key Packet Formats", to support AEKAP:

3.3. Encoding Private Keys

The following algorithm specific packets are added to Section 5.5.3 of [RFC4880], "Secret-Key Packet Formats", to support AEKAP:

4. Acknowledgements

The term "Algebraic Eraser" is a trademark of SecureRF Corporation and is used herein with permission.

The author would like to thank Paul Gunnells, Dorian Goldfeld, and Iris Anshel for their tireless efforts to review this document, suggest improvements, and explain to me how to improve my description of how AE works. Big thanks also to Werner Koch and Vedaal for their comments and suggestions.

5. IANA Considerations

IANA is requested to assign an algorithm number from the OpenPGP Public-Key Algorithms range, or the "namespace" in the terminology of [RFC5226], that was created by [RFC4880]. See Section 3.

ID Algorithm Reference
TBD1 AEKAP public key algorithm This doc

[Notes to RFC-Editor: Please remove the table above on publication. It is desirable not to reuse old or reserved algorithms because some existing tools might print a wrong description. A higher number is also an indication for a newer algorithm. As of now 22 is the next free number, but we request the selection of 23.]

6. Security Considerations

The security considerations of [RFC4880] apply accordingly.

AEKAP will generate the same session key when used with the same two public/private key pairs. The authors of AE generally recommend that at least one party use an ephemeral key pair in order to prevent the same session key being generated every time.

AEKAP is an encryption-only algorithm, therefore it cannot self-certify a key. To have an AEKAP master key you MUST implement [I-D.atkins-openpgp-device-certificates].

When using the generated session key, you MUST only use the bits included in the protocol. You should MUST NOT use any always-zero bits, including those in the last row of the matrix.

7. References

7.1. Normative References

[AAGL] Anshel, I., Anshel, M., Goldfeld, D. and S. Lemieux, "Key agreement, the Algebraic Eraser, and lightweight cryptography", Contemporary Mathematics 418, 2004.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC4880] Callas, J., Donnerhacke, L., Finney, H., Shaw, D. and R. Thayer, "OpenPGP Message Format", RFC 4880, November 2007.
[RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 5226, May 2008.
[RFC6637] Jivsov, A., "Elliptic Curve Cryptography (ECC) in OpenPGP", RFC 6637, June 2012.

7.2. Informative References

[AEIntro] SecureRF Corporation, SRF., "An Introduction to Cryptographic Security Methods and Their Role in Securing Low Resource Computing Devices", 2011.
[Dehornoy] Dehornoy, P., "A fast method for comparing braids", Advances in Mathematics 123, 1997.
[I-D.atkins-openpgp-device-certificates] Atkins, D., "OpenPGP Extensions for Device Certificates", Internet-Draft draft-atkins-openpgp-device-certificates-01, September 2014.

Appendix A. Test Vectors

To help implementing this specification a non-normative example is provided. This example assumes:

A.1. Sample key

The secret key used for this example is:

1st Private Key Matrix:

	  4 2 7 4 1 2 7 7 3 5
	  1 1 5 4 0 5 0 0 3 1
	  2 7 5 3 4 0 6 0 0 4
	  6 1 0 7 4 7 7 4 1 1
	  1 1 7 6 6 2 4 6 5 7
	  7 5 4 1 7 3 7 5 0 7
	  1 6 0 7 3 6 4 2 5 6
	  7 2 3 6 6 6 4 2 7 7
	  3 7 5 2 2 2 0 7 5 2
	                    6
            

2nd Private key (in hex):

The key was created on 2014-09-09 16:35:36 from the tag conjugates (type 1), and thus the fingerprint of the OpenPGP key is:

	  98 4a 04 54 0f 64 98 17  0b 2b 06 01 04 01 82 d9
	  24 01 00 00 01 01 6e 26  44 05 46 10 02 50 43 37
	  56 66 37 42 40 10 72 06  14 44 16 67 13 02 70 73
	  11 00 30 27 47 21 75 35  76 13 13 31 00 60 52 75
	  24 50 57 23 60 00 25 12  35 76 a8 94
	

and the entire public key packet is:

A.2. Sample key agreement

The key agreement is created using the sample key against a second (reader) public key. The reader public key has the following data:

	  24 14 13 22 14 67 30 02  20 23 11 26 26 51 20 11
	  67 40 56 57 60 77 01 04  66 56 71 35 21 27 57 00
	  55 75 16 40 07 75 05 12  31 35 75 45 66 40
	

Matrix (in nibbled-packed hex with trailing zeros):

Permutation (in nibble-packed hex): 32 14 56 78 9a

Which results in the following shared secret:

	  4 0 6 5 2 3 0 5 6 0 
	  6 5 5 0 2 0 1 7 5 5 
	  2 0 2 1 1 1 2 7 2 0 
	  4 0 1 2 5 6 6 6 1 2 
	  5 0 1 0 7 4 3 3 3 4 
	  5 1 2 5 3 3 5 5 7 1 
	  1 0 7 1 6 3 4 0 2 1 
	  2 7 5 4 6 7 1 4 7 4 
	  7 1 5 5 3 6 1 4 1 6 
	                    5
	

Matrix:

Permutation (decimal): 3 2 1 5 7 6 10 8 9 4

Author's Address

Derek Atkins SecureRF Corporation 100 Beard Sawmill Rd, Suite 350 Shelton, CT 06484 US Phone: +1 617 623 3745 EMail: datkins@securerf.com, derek@ihtfp.com