| Title: | Korean Post-Quantum Cryptography Algorithms |
|---|---|
| Description: | Provides synchronous interfaces to four algorithms for post-quantum cryptography: 'AIMer', a digital-signature algorithm based on symmetric primitives; 'HAETAE', a module-lattice-based digital-signature algorithm; and 'NTRU+' and 'SMAUG-T', lattice-based key-encapsulation algorithms. These algorithms were selected by the Korean Post-Quantum Cryptography competition. Native reference implementations are compiled into the package and use operating-system entropy for key generation, signing, and encapsulation. |
| Authors: | Owen Suolfou [aut, cre] |
| Maintainer: | Owen Suolfou <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-11-05 01:36:10 UTC |
| Source: | https://github.com/cran/kpqc |
Synchronous R interfaces to AIMer and HAETAE signatures and NTRU+ and SMAUG-T key encapsulation mechanisms (KEMs).
Binary values are represented as raw vectors. Use charToRaw() when a
text message must be converted explicitly.
Construct algorithm descriptors for every supported KpqC parameter set.
aimer128f() aimer128s() aimer192f() aimer192s() aimer256f() aimer256s() haetae2() haetae3() haetae5() ntruplus768() ntruplus864() ntruplus1152() smaugt128() smaugt192() smaugt256() timer() signature_algorithms() kem_algorithms()aimer128f() aimer128s() aimer192f() aimer192s() aimer256f() aimer256s() haetae2() haetae3() haetae5() ntruplus768() ntruplus864() ntruplus1152() smaugt128() smaugt192() smaugt256() timer() signature_algorithms() kem_algorithms()
An accessor returns a kpqc_algorithm object containing the algorithm
identifier, type, and byte sizes. The collection functions return lists of
all signature or KEM algorithms.
algorithm <- aimer128f() algorithm$id algorithm$sizes length(signature_algorithms()) length(kem_algorithms())algorithm <- aimer128f() algorithm$id algorithm$sizes length(signature_algorithms()) length(kem_algorithms())
Generate key pairs, create and verify detached signatures, and establish shared secrets using a key encapsulation mechanism (KEM).
generate_key_pair(algorithm) sign_message(algorithm, message, secret_key, context = raw()) verify_signature( algorithm, message, signature, public_key, context = raw() ) encapsulate_secret(algorithm, public_key) decapsulate_secret(algorithm, ciphertext, secret_key)generate_key_pair(algorithm) sign_message(algorithm, message, secret_key, context = raw()) verify_signature( algorithm, message, signature, public_key, context = raw() ) encapsulate_secret(algorithm, public_key) decapsulate_secret(algorithm, ciphertext, secret_key)
algorithm |
A KpqC algorithm object returned by an accessor. |
message |
A raw vector containing the message. |
secret_key |
A raw vector containing the secret key. |
context |
An optional raw vector of at most 255 bytes. |
signature |
A raw vector containing a detached signature. |
public_key |
A raw vector containing the public key. |
ciphertext |
A raw vector containing a KEM ciphertext. |
generate_key_pair() returns a list with public_key and
secret_key. sign_message() returns a signature raw vector and
verify_signature() returns one logical value.
encapsulate_secret() returns a list with ciphertext and
shared_secret; decapsulate_secret() returns a shared-secret raw
vector.
algorithm <- aimer128f() keys <- generate_key_pair(algorithm) message <- charToRaw("hello") signature <- sign_message(algorithm, message, keys$secret_key) verify_signature(algorithm, message, signature, keys$public_key) kem <- ntruplus768() recipient <- generate_key_pair(kem) outbound <- encapsulate_secret(kem, recipient$public_key) inbound <- decapsulate_secret(kem, outbound$ciphertext, recipient$secret_key) stopifnot(identical(inbound, outbound$shared_secret))algorithm <- aimer128f() keys <- generate_key_pair(algorithm) message <- charToRaw("hello") signature <- sign_message(algorithm, message, keys$secret_key) verify_signature(algorithm, message, signature, keys$public_key) kem <- ntruplus768() recipient <- generate_key_pair(kem) outbound <- encapsulate_secret(kem, recipient$public_key) inbound <- decapsulate_secret(kem, outbound$ciphertext, recipient$secret_key) stopifnot(identical(inbound, outbound$shared_secret))
Print compact summaries without displaying secret key or shared-secret bytes.
## S3 method for class 'kpqc_algorithm' print(x, ...) ## S3 method for class 'kpqc_key_pair' print(x, ...) ## S3 method for class 'kpqc_encapsulated_secret' print(x, ...)## S3 method for class 'kpqc_algorithm' print(x, ...) ## S3 method for class 'kpqc_key_pair' print(x, ...) ## S3 method for class 'kpqc_encapsulated_secret' print(x, ...)
x |
A KpqC algorithm or result object. |
... |
Additional arguments, currently ignored. |
The input object, invisibly.