CKKS
Special thanks to Janmajaya Mall for proofreading and providing valulabe feedback for the article.
FHE enables arithmetic operations, such as addition and multiplication, on encrypted data. Unlike ZK proofs, which is another cryptographic primitive for handling private data, FHE does not involve revealing any information about the plaintext. We are not going to deep dive into their differences. This article will concentrate on CKKS scheme, specifically focusing on the encoding processes utilized in the CKKS scheme. Future discussions will expand into CKKS encryption, decryption and intermediate evaluations methods.
Lattices can be thought of as a grid space which is form formed out of random linear combinations of multiple basis vectors. Lattices are fundamental to the security of many FHE schemes, Since it's the basis of hard problems like shortest vector problem and closest vector problem, These hardness problems provides a framework for constructing robust novel encryption schemes which are homomorphic in nature. Among which once of them is CKKS.
Understanding the difference between rings and fields is crucial in polynomial arithmetic and integral to the operations within schemes like CKKS.
A ring is a set equipped with two binary operations addition and multiplication and which follows certain properties which are:
Addition is commutative and associative, and there exists an additive identity (often denoted as 0) such that adding this identity to any element of the ring returns the element itself.
Addition has inverses: For every element
Associative Multiplication and Identity: Multiplication is associative and there is a multiplicative identity (often denoted as 1) such that multiplying any element by this identity leaves it unchanged.
Field are specialised form of rings fields satisfy all the properties followed by ring but in addition Field also has inverses for every non-zero element as well as in field multiplication is commutative whereas in rings it is not.
These polynomials are essential for defining the ring structure in CKKS, enabling efficient ring operations crucial for encryption and decryption processes.
CKKS uses SIMD encoding to process multiple data points simultaneously within a single operation, enhancing performance in practical applications.
In homomorphic encryption, ring isomorphisms preserve algebraic operations such as addition and multiplication between two rings. They are pivotal in transforming data between different algebraic structures without altering the underlying relationships, thereby adapting the data for cryptographic needs.
The Cheon-Kim-Kim-Song (CKKS) homomorphic encryption scheme is distinguished by its use of polynomial arithmetic, balancing computational efficiency with robust security. It is particularly well-suited for operations on encrypted data, enabling complex calculations directly on ciphertexts without decryption.
In CKKS, plaintexts are typically vectors of floating-point numbers which are encoded into plaintext polynomials,
Unlike many homomorphic encryption methods that approximated integer values through rounding, CKKS inherently supports floating-point arithmetic. This feature is critical because rounding operations in homomorphic encryption are challenging to implement effectively due to their requirement for complex polynomial operations.
Earlier homomorphic encryption schemes often necessitated exponentially large ciphertext moduli to manage error growth, particularly evident in schemes using ciphertexts as matrices of integers or integral polynomials. CKKS introduces an innovative method that incorporates encryption noise as an integral part of the errors occurring during computations.
A key component of CKKS is the rescaling operation, which is crucial for emulating traditional approximate arithmetic on encrypted data. This technique ensures that the size of the ciphertext modulus required grows linearly with the depth of the computation circuit, rather than exponentially. Such linear growth markedly improves the scheme's efficiency, making it highly effective for complex arithmetic circuits.
The design of CKKS enables precise computations on encrypted data, establishing it as an essential tool for privacy-preserving data analysis and secure computation. Its ability to handle floating-point arithmetic with high accuracy and efficiency makes CKKS indispensable in scenarios where data privacy and computational integrity are paramount.
Encoding in CKKS scheme is the process of converting the message into the plaintext polynomial. Traditionally, the plaintext space of RLWE-based HE schemes is situated in a cyclotomic polynomial ring
A significant advancement in the CKKS encryption scheme is its capability to transform plaintext data, initially encoded into polynomials within the polynomial ring
Data or messages is first encoded into polynomials in the ring
Matrix Representation:
Efficiency and Practical Application:
By incorporating both SIMD encoding and FFT-based transformations, CKKS offers an optimized framework for executing complex arithmetic operations on encrypted data with high efficiency and minimal computational overhead. This dual optimization makes CKKS a powerful tool for privacy-preserving computations in resource-intensive applications.
CKKS leverages the structure of integer polynomial rings to encode vectors of complex numbers into polynomial forms suitable for encrypted computations. Below, we outline the formal steps for this transformation, using both vanilla and canonical embedding methods.
Vanilla encoding in the CKKS scheme involves encoding a complex vector into a polynomial representation. Here are the detailed steps and equations used in the encoding process:
Let
The target is to represent
Roots X^4 +1 (source: Cryptography from Rings, HEAT summer school 2016)
Use the canonical embedding
To decode a polynomial
Note that
The encoding process involves the inverse of the canonical embedding,
Pursuing this thread further, we end up with the following system:
The system can be expressed using the Vandermonde matrix, which is defined as follows:
This matrix, denoted as
Where
Solve the linear system using the matrix inversion or other numerical methods to find the coefficients
To verify, apply the canonical embedding
The above steps outline the encoding of a vector into a polynomial using the canonical embedding in the CKKS scheme for homomorphic encryption.
An important aspect of CKKS's security is the deliberate introduction of an error separate from the plaintext space during the encryption process.
But unlike in some other homomorphic encryption schemes, the error in CKKS does not grow exponentially with each operation performed. Instead, it is meticulously controlled through techniques such as rescaling, which helps to maintain the error at a manageable level throughout the computational process.
The plaintext data, represented as an element of a cyclotomic ring of characteristic zero, inherently includes this small error. This is critical for ensuring that while the data remains encrypted, operations performed on the ciphertext result in accurate and secure outcomes when decrypted.
In addition to sophisticated error management, CKKS also utlizes techniques to ensure the preservation of polynomial size during cryptographic operations:
Here,
In actual encoding, the native plaintext space of our scheme is the set of polynomials in the cyclotomic ring
where
In this article we tried to cover the background of CKKS scheme, along with how to perform encoding in CKKS scheme in next sets of article we will discuss more about encryption, decryption, rescaling etc.
If you find any mistakes or unexpected results, please contact me on Telegram(@rishotics).