Difference between revisions of "Extend RFC-7427 Signature Authentication support to IKEv2 with ECDSA"

From Libreswan
Jump to navigation Jump to search
Line 15: Line 15:
  
 
Major code changes were done in ikev2_keys.c , x509.c and secrets.c. New structures are defined for Private and public ECDSA key parameters.
 
Major code changes were done in ikev2_keys.c , x509.c and secrets.c. New structures are defined for Private and public ECDSA key parameters.
Most functions that had a specific check for rsa are now able to also handle ecdsa as public key algorithm. This involves checking if a certificate is of type ecdsa and extracting the public key from it and storing in the NSS Database. Code changes are made to obtain the ckaid and keyid of the ECDSA public keys. These IDs are used to retrieve the public key from pluto secrets and extract the private key from the certificate.
+
Most functions that had a specific check for rsa are now able to also handle ecdsa as public key algorithm. This involves checking if a certificate is of type ecdsa and extracting the public key from it and storing in the NSS Database. Code changes are made to obtain the keyid and ckaid of the ECDSA public keys. These IDs are used to retrieve the public key from pluto secrets and extract the private key from the certificate respectively.
  
 
2. Support for configuring  authby=ecdsa
 
2. Support for configuring  authby=ecdsa
 
+
Possible options for setting ecdsa as the public key to be used for Digital Signature Authentication with appropriate SHA2 hash algorithm are as follows :
 +
ecdsa/ecdsa-sha2_256, ecdsa-sha2_384, ecdsa-sha2_512
  
 
3. Signature Verification through NSS APIs
 
3. Signature Verification through NSS APIs

Revision as of 10:45, 14 August 2018

Introduction

As part of Google summer of Code work in 2017 described in , RFC-7427 Digital Signature Authentication was implemented with support for RSA. This work is an extension to support ECDSA. Implementation of ECDSA requires the modification of the existing Libreswan public key code to fix the RSA only parts so that it is able to accept different new types of keys in the future ( not just limited to ECDSA ). This will ensure compliance to RFC-7427 and RFC-8247.

As per RFC-4754, ECDSA signatures are smaller than RSA signatures of similar cryptographic strength. ECDSA public keys (and certificates) are smaller than similar strength DSA keys, resulting in improved communications efficiency. Furthermore, on many platforms, ECDSA operations can be computed more quickly than similar strength RSA or DSA operations for a security analysis of key sizes across public key algorithms.

Implementation

To make Libreswan RFC 7427 and RFC 8247 compliant, the following items have been implemented :

1. Fixing the RSA only public key code

Major code changes were done in ikev2_keys.c , x509.c and secrets.c. New structures are defined for Private and public ECDSA key parameters. Most functions that had a specific check for rsa are now able to also handle ecdsa as public key algorithm. This involves checking if a certificate is of type ecdsa and extracting the public key from it and storing in the NSS Database. Code changes are made to obtain the keyid and ckaid of the ECDSA public keys. These IDs are used to retrieve the public key from pluto secrets and extract the private key from the certificate respectively.

2. Support for configuring authby=ecdsa Possible options for setting ecdsa as the public key to be used for Digital Signature Authentication with appropriate SHA2 hash algorithm are as follows : ecdsa/ecdsa-sha2_256, ecdsa-sha2_384, ecdsa-sha2_512

3. Signature Verification through NSS APIs

4. Signature generation through NSS APIs

This part is not yet implemented fully as private key retrieval from certificates fails due

4. Test Suite changes

The Test Suite was extended by adding test cases to verify feature functionality and perform interoperability tests with strongswan.

Issues encountered

NSS looks for specific x509v3 certificate extensions in the end certificates and It is unclear which one is exactly missing in the certificates being used. This error has be be debugged further (as there is little information from the nss logs):

SECERR: 35 (0x23): Certificate extension not found.

Due to this, the private key cannot be obtained through these APIs : PK11_FindKeyByKeyID and PK11_FindKeyByAnyCert

Future work

Successful generation of ECDSA signature and verification of it through interoperability tests.

Source code

This project work was sponsored by Google as part of the Google Summer of Code 2018 Program. The implementation for this project is done by Sahana Prasad (sahana.prasad07@gmail.com) under the tutelage of Paul Wouters and Andrew Cagney

Additional Work during GSoC 2018

Implemented RSA-PSS (the work was started before GSoC 2018). The complete project page is here : https://libreswan.org/wiki/RSA-PSS_Support_in_compliance_with_RFC_7427_and_RFC_8247

Use Cases and Requirements document for ECC/ECDSA support