# README

NOTE

This implementation is direct fork of Kylom's implementation. I claim no authorship over this code apart from some minor modifications. Please be aware this code has not yet been reviewed.

ecies implements the Elliptic Curve Integrated Encryption Scheme.

The package is designed to be compliant with the appropriate NIST standards, and therefore doesn't support the full SEC 1 algorithm set.

STATUS:

ecies should be ready for use. The ASN.1 support is only complete so far as to supported the listed algorithms before.

CAVEATS

  1. CMAC support is currently not present.

SUPPORTED ALGORITHMS

    SYMMETRIC CIPHERS               HASH FUNCTIONS
         AES128                         SHA-1
         AES192                        SHA-224
         AES256                        SHA-256
                                       SHA-384
    ELLIPTIC CURVE                     SHA-512
         P256
         P384		    KEY DERIVATION FUNCTION
         P521	       NIST SP 800-65a Concatenation KDF

Curve P224 isn't supported because it does not provide a minimum security level of AES128 with HMAC-SHA1. According to NIST SP 800-57, the security level of P224 is 112 bits of security. Symmetric ciphers use CTR-mode; message tags are computed using HMAC- function.

CURVE SELECTION

According to NIST SP 800-57, the following curves should be selected:

+----------------+-------+
| SYMMETRIC SIZE | CURVE |
+----------------+-------+
|     128-bit    |  P256 |
+----------------+-------+
|     192-bit    |  P384 |
+----------------+-------+
|     256-bit    |  P521 |
+----------------+-------+

TODO

  1. Look at serialising the parameters with the SEC 1 ASN.1 module.
  2. Validate ASN.1 formats with SEC 1.

TEST VECTORS

The only test vectors I've found so far date from 1993, predating AES and including only 163-bit curves. Therefore, there are no published test vectors to compare to.

LICENSE

ecies is released under the same license as the Go source code. See the LICENSE file for details.

REFERENCES

# Functions

Encrypt encrypts a message using ECIES as specified in SEC 1, 5.1.
MarshalPublicKey converts public key into the uncompressed form specified in section 4.3.6 of ANSI X9.62.
Must is a helper that wraps a call to a function returning (*ECIES, error) and panics if the error is non-nil.
New creates an instance of ECIES from specified private key, it tries automatically select appropriate parameters for encryption scheme.
NewGenerate creates an instance of ECIES by generating a public and private key pair for specified elliptic curve, and selecting default parameters for encryption scheme.
NewWithParams creates an instance of ECIES from specified private key and params.
ParamsFromCurve selects parameters optimal for the selected elliptic curve.
UnmarshalPublicKey converts a point, serialized by MarshalPublicKey, into a public key.

# Variables

Aes128Sha256Params using AES128 and HMAC-SHA-256-16.
Aes256Sha256Params using AES256 and HMAC-SHA-256-32.
Aes256Sha384Params using AES256 and HMAC-SHA-384-48.
Aes256Sha512Params using AES256 and HMAC-SHA-512-64.
DefaultCurve is an instance of the secp256k1 curve.
DefaultParams holds default parameters for the default curve.
Errors returned by the package.
Errors returned by the package.
Errors returned by the package.
Errors returned by the package.
Errors returned by the package.
Errors returned by the package.
Errors returned by the package.
Errors returned by the package.
Errors returned by the package.
Errors returned by the package.

# Structs

CipherText holds parts of encrypted message.
ECIES implements Elliptic Curve Integrated Encryption Scheme.
EncryptedAuthenticatedMessage holds the encrypted message and HMAC.
Params holds all the parameters of selected encryption scheme.
SecretKeyringMaterial hold the encryption key and MAC key.

# Type aliases

NewCipherFun is a function type that creates and returns a new cipher.Block The key argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.
NewHashFun is a function type that returns a new hash.Hash computing the checksum.