Recursive AI

Coming from PgpCore

All onecrypto docs

PgpCore wraps one library's OpenPGP classes behind a few file and string helpers (PGP, EncryptFile, DecryptFile, SignFile, VerifyFile, GenerateKey, EncryptFileAndSign, DecryptFileAndVerify, InlineSign, ClearSign). OneCrypto's Pgp class covers the same tasks directly, on an OpenPGP implementation of its own with no other dependency. There is no compatibility layer. The PgpCore names below come from its public documentation.

Differences to know first:

  • Keys are objects, not files. A certificate (public key with its User IDs and signatures) or a certificate with its secret keys is a PgpCertificate. Read it with PgpCertificate.Parse(bytes) (binary or armored); write it with Export() or ExportPublic(). Nothing needs a file path, and stream overloads take streams.
  • The passphrase is a parameter, the algorithm is not. Ciphers, hashes, the container (SEIPD v2 with AEAD, or v1 with an integrity check) and compression come from the recipients' key preferences and the policy.
  • Integrity is not optional. Plaintext is released only after the AEAD tag or the MDC has verified; unauthenticated messages are refused unless you opt in with the layered PgpReadOptions.AllowUnauthenticatedEncryption.
  • Signatures are reported, never thrown. Verify* returns a verdict per signature, with the reasons (unknown signer, expired key, weak hash, wrong data) and the signer's key.
  • Time is explicit. Calls take a TimeProvider (the system clock when null).
TaskPgpCoreOneCrypto
Generate a key pairGenerateKey(publicOut, privateOut, username, password)PgpCertificate key = Pgp.GenerateKey("Name <mail>", password); key.ExportPublic(armor: true), key.Export(armor: true)
A post-quantum keynot availablePgp.GenerateKey("Name <mail>", CryptoPolicy.Cnsa2) (ML-DSA-87 with Ed448, ML-KEM-1024 with X448); onecrypto fix adds a hybrid encryption subkey to an existing key
Load keysEncryptionKeys, SigningKeys from files or stringsPgpCertificate.Parse(File.ReadAllBytes(path)); a GnuPG home or cert-d store through GnuPGHome and CertDirectory
Encrypt a fileEncryptFile(input, output, publicKeyFile, armor)File.WriteAllBytes(output, Pgp.Encrypt(File.ReadAllBytes(input), recipient, armor: true)); for large files Pgp.Encrypt(inStream, outStream, [recipient]) in constant memory
Encrypt to several recipientsEncryptionKeys with several keysPgp.Encrypt(data, [alice, bob], signer: null)
Encrypt with a passwordEncryptFile with a symmetric optionPgp.EncryptWithPassword(data, password)
DecryptDecryptFile(input, output, privateKeyFile, passphrase)Pgp.Decrypt(message, secretKey, passphrase).Content; stream overload for large files
Sign (detached)SignFile(input, output, privateKey, passphrase)Pgp.SignDetached(data, secretKey, passphrase, armor: true)
Sign (inline) and clear-signInlineSign, ClearSignPgp.Sign(data, secretKey, passphrase); clear-signing through the layered PgpMessageWriter.SignCleartext
VerifyVerifyFile, VerifyClearFile returning a boolPgp.VerifyDetached(data, signature, [signerCertificate]), Pgp.Verify(message, certificates); read HasValidSignature or each Signatures[i].Status and Reasons
Encrypt and signEncryptFileAndSignPgp.Encrypt(data, [recipient], signerCertificate, signerPassphrase)
Decrypt and verifyDecryptFileAndVerifyPgp.Decrypt(message, secretKey, passphrase, signers: [signerCertificate]): Content and HasValidSignature
Key serversnot part of itHkpClient, VksClient, WkdClient in RecursiveAI.OneCrypto.Online; nothing fetches unless you call them

Migrating keys: keys made by PgpCore are ordinary OpenPGP keys. PgpCertificate.Parse reads them whatever made them (version 4 keys, RSA, ECDSA, EdDSA, ECDH, and the newer version 6 and post-quantum keys). Keys that GnuPG keeps in its home are read from there directly.