Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

StreamSec.DSI.PKTypes

Classes, interfaces and records

classeDSIProviderNotRegistered

inherits from eDSIError

Raised by RegisterDSIArith when handed an object that implements none of the recognised provider interfaces, and by the MustGetDSIxx accessors when the unit that implements the requested provider was never linked into the application. The message names the missing provider and the unit that supplies it, because the fix is always to add that unit to a uses clause.

(no public members)

classeSNTRUPError

inherits from eDSIError

Invalid sntrup761 key encoding, missing key, or primitive operation error. A correctly sized invalid ciphertext uses implicit rejection instead.

(no public members)

interfaceiKeyAndCertStore

function StorePrivateKey(const aPassword : iSecretKey; const aKey : iUnknown; const aAlgorithm : ObjectIdentifier; const aFriendlyName, aProviderName : UnicodeString; const aLocalKeyID : OctetString; aCompatibility: Boolean = False) : Boolean;
Stores aKey under aPassword. aCompatibility False (the default) protects it with PBES2 (PBKDF2 over HMAC-SHA-256, AES-256-CBC); True, with the legacy PKCS#12 scheme. The password's encoding is the caller's, made by the key object passed: see tDualSecretKey in stSecUtils.
function StoreCertificate(const aPassword : iSecretKey; const aCert : iUnknown; const aFriendlyName: UnicodeString; const aLocalKeyID : OctetString) : Boolean; function StoreCRL(const aPassword : iSecretKey; const aCRL : iUnknown) : Boolean; function CopyTo(const aDest : iKeyAndCertStore; const aSrcPwd: iSecretKey; const aDstPwd: iSecretKey) : Boolean;

interfaceiMPPK

inherits from iKey

iMPPK is the common base of the PKIX layer's polymorphic key wrapper: a single interface that presents an RSA/DSA/EC/ML-DSA key (of any concrete kind) to the certificate, CMS and TLS code without those callers knowing which algorithm is underneath. tMPPublicKey (StreamSec.DSI.PkixCert) and tAbstractMPPrivateKey (in this unit) implement it. The same wrapper type is used on both peers of a protocol; nothing here is client- or server-specific.

function GetData: iUnknown;
Getter for Data; see the property.
procedure SetData(const Value: iUnknown);
Setter for Data; see the property.
function GetPKI: OctetString;
Getter for PublicKeyIdentifier; see the property.
function GetPKI2: OctetString;
Getter for PublicKeyIdentifier2; see the property.
function GetSignatureDigestAlg: tHashAlgorithm;
Getter for SignatureDigestAlg; see the property.
function GetSignatureLength: Integer;
Getter for SignatureLength; see the property.
procedure SetSignatureDigestAlg(const Value: tHashAlgorithm);
Setter for SignatureDigestAlg; see the property.
property PublicKeyIdentifier: OctetString read GetPKI;
The RFC 5280 method-1 subject key identifier: the SHA-1 hash (20 bytes) of the DER-encoded subjectPublicKey BIT STRING contents. Used to match a key to a certificate/key entry and to fill the SubjectKeyIdentifier extension.
property PublicKeyIdentifier2: OctetString read GetPKI2;
The RFC 5280 method-2 subject key identifier: the SHA-1 of the public key truncated to the low 8 bytes with the top four bits set to 0100. An alternative, shorter key id used where the 64-bit form is called for.
property SignatureDigestAlg: tHashAlgorithm read GetSignatureDigestAlg write SetSignatureDigestAlg;
The hash algorithm this key signs/verifies with. Read it to learn a decoded key's digest; set it before signing when the default is not what you want.
property SignatureLength: Integer read GetSignatureLength;
The length in bytes of a signature produced by this key (e.g. the RSA modulus size in bytes). Read it to size a signature buffer.
property Data: iUnknown read GetData write SetData;
The wrapped key object: for a public-key wrapper the decoded underlying key material taken from the SubjectPublicKeyInfo; for a private-key wrapper the associated iMPPublicKey. Held as iUnknown so the wrapper stays algorithm- agnostic; callers QueryInterface it for the concrete key they need.

interfaceiMPPublicKey

inherits from iMPPK

function EncryptKeyTransport(const aKey : tBytes; aKeyOffset, aKeyLen : Integer; var aEMsg : tBytes; aMsgOffset, aMsgLen : Integer) : Boolean; overload; function EncryptKeyTransport(const aKey : tBytes; aKeyOffset, aKeyLen : Integer; var aEMsg : tBytes) : Boolean; overload; function VerBuf(const aMsg : tBytes; aMsgOffset, aMsgLen : Integer; const aSign : tBytes; aSignOffset, aSignLen : Integer) : Boolean; function VerDig(const aDigest : tBytes; aDigestOffset, aDigestLen : Integer; const aSign : tBytes; aSignOffset, aSignLen : Integer) : Boolean;

interfaceiSignPublicKey

function GetData: iUnknown; procedure SetData(const Value: iUnknown); function GetSignatureDigestAlg: tHashAlgorithm; procedure SetSignatureDigestAlg(const Value: tHashAlgorithm); function VerBuf(const aMsg : tBytes; aMsgOffset, aMsgLen : Integer; const aSign : tBytes; aSignOffset, aSignLen : Integer) : Boolean; function VerDig(const aDigest : tBytes; aDigestOffset, aDigestLen : Integer; const aSign : tBytes; aSignOffset, aSignLen : Integer) : Boolean; property SignatureDigestAlg: tHashAlgorithm read GetSignatureDigestAlg write SetSignatureDigestAlg; property Data: iUnknown read GetData write SetData;

interfaceiSignKey

function GetData: iUnknown; procedure SetData(const Value: iUnknown); function GetSignatureDigestAlg: tHashAlgorithm; procedure SetSignatureDigestAlg(const Value: tHashAlgorithm); property SignatureDigestAlg: tHashAlgorithm read GetSignatureDigestAlg write SetSignatureDigestAlg; property Data: iUnknown read GetData write SetData;

interfaceiSignKeyDL

inherits from iSignKey

function GetDEREncode: Boolean; procedure SetDEREncode(Value: Boolean); property DEREncode: Boolean read GetDEREncode write SetDEREncode;

interfaceiSignPublicKeyDL

inherits from iSignPublicKey

function GetDEREncode: Boolean; procedure SetDEREncode(Value: Boolean); property DEREncode: Boolean read GetDEREncode write SetDEREncode;

interfaceiSignPublicKeyIF

inherits from iSignPublicKey

function GetMGFHashAlg: tHashAlgorithm; function GetSaltLen: Cardinal; function GetSignEncoding: tSignEncoding; procedure SetMGFHashAlg(Value: tHashAlgorithm); procedure SetSaltLen(Value: Cardinal); procedure SetSignEncoding(Value: tSignEncoding); function GetEncryptEncoding: tEncryptEncoding; procedure SetEncryptEncoding(Value: tEncryptEncoding); property MGFHashAlg: tHashAlgorithm read GetMGFHashAlg write SetMGFHashAlg; property SaltLen: Cardinal read GetSaltLen write SetSaltLen; property SignEncoding: tSignEncoding read GetSignEncoding write SetSignEncoding; property EncryptEncoding: tEncryptEncoding read GetEncryptEncoding write SetEncryptEncoding;

interfaceiSignKeyIF

inherits from iSignKey

function GetMGFHashAlg: tHashAlgorithm; procedure SetMGFHashAlg(Value: tHashAlgorithm); function GetSaltLen: Cardinal; procedure SetSaltLen(Value: Cardinal); function GetSignEncoding: tSignEncoding; procedure SetSignEncoding(Value: tSignEncoding); function GetEncryptEncoding: tEncryptEncoding; procedure SetEncryptEncoding(Value: tEncryptEncoding); property MGFHashAlg: tHashAlgorithm read GetMGFHashAlg write SetMGFHashAlg; property SaltLen: Cardinal read GetSaltLen write SetSaltLen; property SignEncoding: tSignEncoding read GetSignEncoding write SetSignEncoding; property EncryptEncoding: tEncryptEncoding read GetEncryptEncoding write SetEncryptEncoding;

interfaceiSignPrivateKey

function GetData: iUnknown; procedure SetData(const Value: iUnknown); function GetSignatureDigestAlg: tHashAlgorithm; procedure SetSignatureDigestAlg(const Value: tHashAlgorithm); function SignBuf(const aMsg : tBytes; aMOffset: Integer; aMLen : Integer; var aSign : tBytes; aSOffset: Integer; aSLen : Integer) : Integer; overload; function SignDig(const aDigest : tBytes; aDOffset: Integer; aDLen : Integer; var aSign : tBytes; aSOffset: Integer; aSLen : Integer; aHashAlg: tHashAlgorithm = haDefault) : Integer; overload; function SignBuf(const aMsg : tBytes; aMOffset: Integer; aMLen : Integer; var aSign : tBytes) : Integer; overload; function SignDig(const aDigest : tBytes; aDOffset: Integer; aDLen : Integer; var aSign : tBytes; aHashAlg: tHashAlgorithm = haDefault) : Integer; overload; function Validate(const aPublicKey: iUnknown): Boolean; procedure SetAttributes(const aPublicKey: iUnknown); property SignatureDigestAlg: tHashAlgorithm read GetSignatureDigestAlg write SetSignatureDigestAlg; property Data: iUnknown read GetData write SetData;

interfaceiSignPrivateKeyDL

inherits from iSignPrivateKey

function GetDEREncode: Boolean; procedure SetDEREncode(Value: Boolean); property DEREncode: Boolean read GetDEREncode write SetDEREncode;

interfaceiSignPrivateKeyIF

inherits from iSignPrivateKey

function GetMGFHashAlg: tHashAlgorithm; function GetSaltLen: Cardinal; function GetSignEncoding: tSignEncoding; procedure SetMGFHashAlg(Value: tHashAlgorithm); procedure SetSaltLen(Value: Cardinal); procedure SetSignEncoding(Value: tSignEncoding); property MGFHashAlg: tHashAlgorithm read GetMGFHashAlg write SetMGFHashAlg; property SaltLen: Cardinal read GetSaltLen write SetSaltLen; property SignEncoding: tSignEncoding read GetSignEncoding write SetSignEncoding;

interfaceiPKPublicKeyInfo

function AlgorithmIdentifier: ObjectIdentifier; function PublicKeyIdentifier: OctetString;

interfaceiDiscreteLogField

inherits from iGroup

iDiscreteLogField describes the public DOMAIN PARAMETERS shared by every party in a discrete-log scheme: the finite-field DSA/DH parameters (implemented by tFFSystemParams) OR an elliptic curve for ECDSA/ECDH/EdDSA (implemented by tCustomECurve and its Montgomery/Edwards subclasses). Applications rarely build one by hand; you obtain it from a named curve/group registry or from a decoded key (iDLKey.Params), then hand it to iDSIDLArith to make keys, sign, verify, or do key agreement. The same parameter object is used identically on both the client and server side of a protocol -- both peers must agree on it.

function GetGroupOrder: iDSInteger;
function GetPrimeModulus: iDSInteger; Getter for GroupOrder; see the property.
function GetCoFactor: iDSInteger;
Getter for CoFactor; see the property.
function GetGenerator: iGroupElement;
Getter for Generator; see the property.
procedure SetGroupOrder(const Value: iDSInteger);
procedure SetPrimeModulus(const Value: iDSInteger); Setter for GroupOrder; only used when assembling custom domain parameters.
procedure SetCoFactor(const Value: iDSInteger);
Setter for CoFactor; only used when assembling custom domain parameters.
procedure SetGenerator(const Value: iGroupElement);
Setter for Generator; only used when assembling custom domain parameters.
procedure Assign(const aSrc: iDiscreteLogField);
Copies all domain parameters (order, cofactor, generator, and for EC the curve coefficients and OID) out of aSrc into this object. Use it to clone a parameter set, e.g. when you want an independent editable copy of a curve taken from a registry or a decoded key.
function Compare(const aParams: iDiscreteLogField): Boolean;
True when aParams denotes the SAME group/curve as this one. An app uses it to confirm that a key or ephemeral value it received really belongs to the curve/group it expects before doing arithmetic with it -- e.g. rejecting a peer's public point that was encoded under a different curve.
function Validate: Boolean;
Sanity-checks that these domain parameters describe a valid, recognised group/curve. For the built-in named curves this confirms the parameters match a known curve; call it before trusting parameters that arrived from an untrusted source.
function ScalarFixBitLength: Integer;
Non-zero for the curves whose private scalar is a fixed-width bit string rather than a value reduced modulo the group order: the Montgomery curves X25519 (256) and X448 (448) and the Edwards curves Ed25519 (256) and Ed448 (448). Full description »
function FieldElementToBytes(const aElement: iGroupElement) : tBytes; overload;
Encodes a group element to its wire octet string: for EC this is the SEC1 point encoding (0x04 uncompressed, or 0x02/0x03 compressed, 0x00 = point at infinity); for finite-field groups the fixed-width big-endian integer. Use it when serialising a public value (e.g. an ECDH ephemeral share) for transmission or storage. This overload allocates and returns the bytes.
function FieldElementToBytes(const aElement : iGroupElement; const aDst : tBytes; aDstOffset: Integer; var aDstCount : Integer) : Boolean; overload;
As above, but writes into a caller-supplied buffer at aDstOffset; on entry aDstCount is the space available, on return the bytes written. Call it once with aDst = nil to size the buffer, then again to fill it. Use this buffer-based overload to avoid an allocation on hot paths.
function BytesToFieldElement(const aSrc : tBytes) : iGroupElement; overload;
Parses an octet string back into a group element under these parameters -- the inverse of FieldElementToBytes. Use it to decode a peer's public value received off the wire; it returns nil if the bytes are malformed or do not lie on the curve, so it doubles as a first validity check on untrusted input.
function BytesToFieldElement(const aSrc : tBytes; aSrcOffset, aSrcCount : Integer) : iGroupElement; overload;
As above, decoding from a sub-range aSrcOffset..aSrcOffset+aSrcCount of a larger buffer, so you can parse a public value embedded in a bigger message without copying it out first.
function IsNonTrivialFieldElement(const aElement: iGroupElement) : Boolean;
True when aElement is not a trivial/degenerate value: for EC, any point that is not the point at infinity (on the matching curve); for finite-field groups, an element that is not 1, not the generator, and not P-1. Full description »
function IsGroupElement(const aElement: iGroupElement) : Boolean;
True when aElement is a well-formed member of this group/curve. For EC this checks the point lies on the matching curve (but does NOT verify subgroup order); for finite-field groups it checks membership of the order-GroupOrder subgroup (aElement^GroupOrder = 1 mod P). Used while validating keys and decoded points.
property GroupOrder: iDSInteger read GetGroupOrder write SetGroupOrder;
property PrimeModulus: iDSInteger read GetPrimeModulus write SetPrimeModulus; The order of the prime-order subgroup: n (curve order) for elliptic curves, or q (the DSA subgroup order) for finite-field groups. Private scalars are drawn modulo this value. Read it to learn the effective key size; write it only when constructing custom domain parameters.
property CoFactor: iDSInteger read GetCoFactor write SetCoFactor;
The cofactor -- the ratio of the full group order to GroupOrder (the h value of a curve, or the DSA j value). Cofactor-aware key agreement multiplies by this to clear the small subgroup. Usually pre-set by the named curve/group.
property Generator: iGroupElement read GetGenerator write SetGenerator;
The base point / generator G of the prime-order subgroup. All public keys are multiples (exponentiations) of this element. Fixed by the named curve/group; you only assign it when defining custom parameters.

interfaceiFFSystemParams

Finite-field domain parameters shared by DSA/DH providers, group tables and key-format implementations. Obtain them from iDLKey.Params.

function GetP: iDSInteger; function GetQ: iDSInteger; function GetG: iDSInteger; function GetJ: iDSInteger; function GetDomainParameterSeed: iDSInteger; procedure SetP(const Value: iDSInteger); procedure SetQ(const Value: iDSInteger); procedure SetG(const Value: iDSInteger); procedure SetJ(const Value: iDSInteger); procedure SetDomainParameterSeed(const Value: iDSInteger); procedure Assign(const aSrc: iFFSystemParams); function Clone: iFFSystemParams; function Compare(const aParams: iFFSystemParams): Boolean; procedure Generate(aBitSize: Cardinal; aQBitSize: Cardinal); function Validate: Boolean; property P: iDSInteger read GetP write SetP; property Q: iDSInteger read GetQ write SetQ; property G: iDSInteger read GetG write SetG; property J: iDSInteger read GetJ write SetJ; property DomainParameterSeed: iDSInteger read GetDomainParameterSeed write SetDomainParameterSeed;

interfaceiDSIDLArith

(no public members)

interfaceiDLKey

iDLKey is the common base of a discrete-log key pair (iDLPublicKey / iDLPrivateKey): the pieces shared by both halves -- the domain parameters the key lives in, the arithmetic engine that operates on it, and which signature scheme it is used with. Applications usually obtain a concrete key from a curve registry, a decoded certificate/key, or iDSIDLArith.NewPrivateKey/NewPublicKey rather than implementing this interface themselves. The same key type is used on both peers of a protocol; nothing here is client- or server-specific.

function GetParams: iDiscreteLogField;
Getter for Params; see the property.
function GetPool: iDSIDLArith;
Getter for Pool; see the property.
function GetSignScheme: tDLSignatureScheme;
Getter for SignScheme; see the property.
procedure SetSignScheme(const Value: tDLSignatureScheme);
Setter for SignScheme; see the property.
property Pool: iDSIDLArith read GetPool;
The arithmetic engine (implemented in StreamSec.DSI.DiscreteLog) that actually performs key generation, signing, verification and key agreement for this key. It is wired in when the key is created; an application rarely touches it directly, though the higher-level sign/verify helpers call through it. Read-only.
property SignScheme: tDLSignatureScheme read GetSignScheme write SetSignScheme;
Selects which discrete-log signature algorithm this key uses: plain ECDSA/DSA (dlssaDSA), its constant-time variant (dlssaDSAFixedTime), Nyberg-Rueppel (dlssaNR), the P1363 raw encoding (dlssaDSA_P1363), or EdDSA (dlssaEdDSA). Full description »
property Params: iDiscreteLogField read GetParams;
The public domain parameters (the finite-field group or elliptic curve) this key belongs to -- see iDiscreteLogField. Both peers must share the same parameters; read this to learn a decoded key's curve/group, or to check a peer key was encoded under the curve you expect. Read-only.

interfaceiDLPublicKey

inherits from iDLKey

iDLPublicKey is the public half of a discrete-log key pair: it is essentially the public group element W (the point/value the peer publishes) plus the shared iDLKey context. An application holds one to verify signatures from, or send encrypted/agreed keys to, a remote party -- e.g. the public key taken from a peer's certificate. It is symmetric across client and server.

function GetW: iGroupElement;
Getter for W; see the property.
procedure SetW(const Value: iGroupElement);
Setter for W; see the property. Assign the decoded peer point here when you build a public key by hand from received parameters.
function Validate: Boolean;
Sanity-checks the public value: that W is assigned, is a non-trivial element of the group (for EC not the point at infinity; for finite-field groups not 1, the generator, or P-1), lies on the curve/in the group, and that the domain parameters themselves validate. Full description »
property W: iGroupElement read GetW write SetW;
The public group element -- the elliptic-curve point or finite-field value that is this party's public key (W = G raised to the private scalar). It is what gets serialised into certificates and wire messages; read it to encode the key, write it when reconstructing a key from received bytes.

classtExternalDLPrivateKey

Adapter for a discrete-log private key held OUTSIDE this process -- on a PKCS#11 token or an HSM -- reached through iDLPrivateKey.ExternalKey. The counterpart of tExternalIFPrivateKey on the RSA side, and the same contract: every method here is a do-nothing base that a subclass overrides to call its backing store.

Only the SIGNATURE PRIMITIVE is delegated, not the whole signing operation. A device returns the (r,s) pair; the DER or P1363 encoding around it, and the digest truncation in front of it, stay in the library where they already work. That is deliberately narrower than the RSA side, where padding schemes differ enough per device to be worth delegating.

function GetIdentifier: string; virtual;
Getter for Identifier; see the property. Base returns an empty string.
function GetOrderSize: Integer; virtual;
Bit size of the group order of the key in the backing store. Base returns -1 (unknown); a subclass reports the real size.
function SignDigest(const aDigest : tBytes; aOffset, aCount : Integer; aHashAlgorithm: tHashAlgorithm; out aSigR : iDSInteger; out aSigS : iDSInteger): Boolean; virtual;
Signs aDigest[aOffset..aOffset+aCount-1] in the external store and returns the signature as the pair aSigR, aSigS. Full description »
function Validate(const aPubl: iDLPublicKey): Boolean; virtual;
Consistency-checks the external key against the supplied public key. Base returns False; override to check the store's key matches aPubl.
function GetPublicKey: iGroupElement; virtual;
The public group element of the external key, which the library cannot compute without the scalar. A key index needs it to file the private key under its public key. Base returns nil (not known).
constructor Create; virtual;
Creates the adapter. Base does nothing; a subclass constructor opens or references the underlying store.
function ImportKey(const aPKIdentifier; aPKILen: Integer): Boolean; virtual;
Binds this adapter to a specific stored key, named by the opaque, subclass-defined identifier blob aPKIdentifier (aPKILen bytes). Base returns False.
property Identifier: string read GetIdentifier;
A human-readable name of the bound external key.

interfaceiDLPrivateKey

inherits from iDLKey

iDLPrivateKey is the secret half of a discrete-log key pair: the private scalar S plus the shared iDLKey context. An application holds one to sign with, or to complete key agreement / decrypt with, its own identity. It is the local side of a protocol only; you never transmit it. Generate one with NewKeys (or via iDSIDLArith.NewPrivateKey), then derive the matching public key with PublicKey.

function GetExtKey: tExternalDLPrivateKey;
Getter for ExternalKey; see the property.
procedure SetExtKey(const aValue: tExternalDLPrivateKey);
Setter for ExternalKey; see the property.
function GetS: iDSInteger;
Getter for S; see the property.
procedure SetS(const Value: iDSInteger);
Setter for S; see the property. Assign a known scalar here when importing a private key from decoded key material.
function NewKeys(const aParams: iDiscreteLogField): iGroupElement; overload;
Generates a fresh key pair over the given domain parameters: draws a new random private scalar into S (copying aParams in as this key's Params) and returns the corresponding public group element. Call this when you need a brand-new key -- e.g. an ephemeral ECDH key for a handshake, or a fresh long-term signing key.
function PublicKey: iGroupElement; overload;
Computes and returns this key's public group element W (Generator raised to S). Use it when you need only the public point -- e.g. to publish an ephemeral share -- without wrapping it in a full iDLPublicKey object.
procedure PublicKey(var aPubl: iDLPublicKey); overload;
Fills aPubl with the matching public key, allocating a new iDLPublicKey (over this key's Params) if aPubl is nil. Use this overload when you need a full public-key object -- e.g. to hand to a peer or to store alongside a certificate -- rather than just the bare group element.
function Validate(const aPubl: iDLPublicKey): Boolean;
Verifies that aPubl is the genuine public counterpart of this private key: checks the parameters match, that aPubl validates, and that Generator raised to S actually equals aPubl.W. Use it as a consistency/possession check after importing a key pair or when pairing a loaded private key with a certificate.
property S: iDSInteger read GetS write SetS;
The private scalar (the secret exponent / multiplier). This is the sensitive key material; keep it protected. Read/written only when importing or exporting raw key material -- normal signing and key agreement go through the higher-level methods rather than touching S directly.
property ExternalKey: tExternalDLPrivateKey read GetExtKey write SetExtKey;
When assigned, the private scalar S lives in an external store and the signature primitive is delegated there instead of being computed here. S itself is then absent, so nothing may read it -- which is the point: the key has no in-process copy. nil for an ordinary software key.

interfaceiEdDSAPrivateKey

inherits from iDLPrivateKey

EdDSA (RFC 8032) keys are seed based and form a key class of their own: these keys can ONLY be used with the dlssaEdDSA scheme, and the dlssaEdDSA scheme ONLY accepts these keys (enforced in StreamSec.DSI.DiscreteLog).

function GetSeed: tBytes; procedure SetSeed(const aValue: tBytes); property Seed: tBytes read GetSeed write SetSeed;

interfaceiEdDSAPublicKey

inherits from iDLPublicKey

(no public members)

interfaceiX9_42MacTagParams

function GetAlgorithmID: iSecretKey; function GetCounter: UInt32; function GetIdA: iSecretKey; function GetIdB: iSecretKey; function GetMacTag: iSecretKey; function GetMacTagLen: Integer; function GetTA: iGroupElement; function GetTB: iGroupElement; function GetYA: iGroupElement; function GetYB: iGroupElement; procedure SetAlgorithmID(const Value: iSecretKey); procedure SetCounter(const Value: UInt32); procedure SetIdA(const Value: iSecretKey); procedure SetIdB(const Value: iSecretKey); procedure SetMacTag(const Value: iSecretKey); procedure SetMacTagLen(const Value: Integer); procedure SetTA(const Value: iGroupElement); procedure SetTB(const Value: iGroupElement); procedure SetYA(const Value: iGroupElement); procedure SetYB(const Value: iGroupElement); property AlgorithmID: iSecretKey read GetAlgorithmID write SetAlgorithmID; property Counter: UInt32 read GetCounter write SetCounter; property IdA: iSecretKey read GetIdA write SetIdA; property IdB: iSecretKey read GetIdB write SetIdB; property YA: iGroupElement read GetYA write SetYA; property YB: iGroupElement read GetYB write SetYB; property TA: iGroupElement read GetTA write SetTA; property TB: iGroupElement read GetTB write SetTB; property MacTag: iSecretKey read GetMacTag write SetMacTag; property MacTagLen: Integer read GetMacTagLen write SetMacTagLen;

interfaceiMPPrivateKey

inherits from iMPPK

iMPPrivateKey is the private half of the polymorphic key wrapper (see iMPPK): it adds the private-key operations -- signing, and the decrypt side of RSA key transport and DL/EC key agreement -- behind an algorithm-agnostic face for the certificate, CMS and TLS code. It is the local side of a protocol only and is never transmitted; the concrete implementations are tMPPrivateKeyIF (RSA), tMPPrivateKeyDL (DSA/EC) and tMPPrivateKeyGeneric in this unit.

function Clone: iMPPrivateKey;
Returns an independent copy of this private-key wrapper. The wrapping key material is shared; the copy carries its own mutable signing/encoding state, so per-operation settings can be adjusted without disturbing the original -- useful when the underlying key is shared across threads.
function DecryptKeyAgreement(aPublKey: iDLPublicKey; var aSecret : tBytes; aSOffset: Integer; aSLen : Integer) : Boolean; overload;
Completes discrete-log key agreement: combines this private key with the peer's public key aPublKey (via DH1/ECDH) and writes the derived shared secret into aSecret. This is the recipient/decrypt side of ECDH/DH -- e.g. CMS KeyAgreeRecipientInfo. Returns False on the base class and for key kinds that do not do key agreement (only the DL/EC wrapper implements it).
function DecryptKeyTransport(const aEMsg : tBytes; aEOffset: Integer; aELen : Integer; const aKey : tBytes; aKOffset: Integer; aKLen : Integer) : Boolean;
Decrypts an RSA key-transport blob: recovers the wrapped key from the PKCS#1-encrypted aEMsg and writes it into aKey (fails if the recovered length does not equal aKLen). This is the decrypt side of RSA key exchange CMS KeyTransRecipientInfo and the TLS RSA key-exchange path. Returns False on the base class (only the RSA wrapper implements it).
function GetTLS: Boolean;
Getter for TLS; see the property.
procedure SetTLS(const Value: Boolean);
Setter for TLS; see the property.
function SignBuf(const aMsg : tBytes; aMOffset: Integer; aMLen : Integer; var aSign : tBytes; aSOffset: Integer; aSLen : Integer) : Integer;
Signs the message aMsg with this private key, writing the signature into aSign and returning its byte length. The digest is computed internally using SignatureDigestAlg. Use it to produce a signature over raw message bytes.
function SignDig(const aDigest : tBytes; aDOffset: Integer; aDLen : Integer; var aSign : tBytes; aSOffset: Integer; aSLen : Integer; aHashAlg: tHashAlgorithm = haDefault) : Integer;
Signs a pre-computed digest aDigest (using aHashAlg, or SignatureDigestAlg when haDefault), writing the signature into aSign and returning its byte length. Use it when the caller already has the message digest in hand.
property TLS: Boolean read GetTLS write SetTLS;
Selects TLS-specific behaviour for the wrapped key. For an RSA key this forces the seEMSA_TLS PKCS#1 v1.5 sign-encoding (the legacy TLS variant with no hash identifier and two concatenated digests); for a DL/EC key it turns on cofactor key agreement. The TLS record layer sets it when a key is used inside a TLS handshake.

interfaceiMPPrivateKeyIF

inherits from iMPPrivateKey

function GetMGFHashAlgorithm: tHashAlgorithm; function GetSaltLen: Cardinal; function GetSignEncoding: tSignEncoding; function GetEncryptEncoding: tEncryptEncoding; procedure SetMGFHashAlgorithm(Value: tHashAlgorithm); procedure SetSaltLen(Value: Cardinal); procedure SetSignEncoding(Value: tSignEncoding); procedure SetEncryptEncoding(Value: tEncryptEncoding); property MGFHashAlgorithm: tHashAlgorithm read GetMGFHashAlgorithm write SetMGFHashAlgorithm; property SaltLen: Cardinal read GetSaltLen write SetSaltLen; property SignEncoding: tSignEncoding read GetSignEncoding write SetSignEncoding; property EncryptEncoding: tEncryptEncoding read GetEncryptEncoding write SetEncryptEncoding;

interfaceiMPKAPrivateKey

inherits from iMPPrivateKey

function GetSystemParams: iDiscreteLogField; function GetCoFactor: Boolean; function GetDEREncodeSignature: Boolean; function GetKAHashAlg: tHashAlgorithm; function GetKDF: tKeyDerivation; function GetP: iSecretKey; procedure SetCoFactor(const Value: Boolean); procedure SetDEREncodeSignature(const Value: Boolean); procedure SetKAHashAlg(const Value: tHashAlgorithm); procedure SetKDF(const Value: tKeyDerivation); procedure SetP(const Value: iSecretKey); function DLPublicKey(var aPublKey: iDLPublicKey): Boolean; property SystemParams: iDiscreteLogField read GetSystemParams; property CoFactor: Boolean read GetCoFactor write SetCoFactor; property DEREncodeSignature: Boolean read GetDEREncodeSignature write SetDEREncodeSignature; property KAHashAlg: tHashAlgorithm read GetKAHashAlg write SetKAHashAlg; property KDF: tKeyDerivation read GetKDF write SetKDF; property P: iSecretKey read GetP write SetP;

interfaceiMPDLKeyUnwrap

Escape hatch for tMPPrivateKeyDL's iDLPrivateKey wrapping. This unit cannot see iECPrivateKey/iFFPrivateKey (StreamSec.DSI.ECC.pas / .FFC.pas build on top of this unit, so importing them here would be circular), so it cannot expose those interfaces directly. A caller that needs the concrete EC/FF key (e.g. the legacy TLS <= 1.2 ServerKeyExchange signing path, which does see those units) unwraps in a loop via GetInnerDLKey while the result supports iMPDLKeyUnwrap, then QueryInterfaces the final, non-wrapped key for the concrete sub-interface it needs.

function GetInnerDLKey: iDLPrivateKey;

interfaceiKeyExchange

function GetHashAlgorithm: tHashAlgorithm; function GetKDFParameter: iSecretKey; function GetKeyDerivation: tKeyDerivation; function GetSecretKeyLen: Integer; function GetAlgorithmID: ObjectIdentifier; procedure SetHashAlgorithm(const Value: tHashAlgorithm); procedure SetKeyDerivation(const Value: TKeyDerivation); procedure SetSecretKeyLen(const Value: Integer); procedure SetKDFParameter(const Value: iSecretKey); procedure SetAlgorithmID(const Value: ObjectIdentifier); property HashAlgorithm: tHashAlgorithm read GetHashAlgorithm write SetHashAlgorithm; property KeyDerivation: tKeyDerivation read GetKeyDerivation write SetKeyDerivation; property KDFParameter: iSecretKey read GetKDFParameter write SetKDFParameter; property SecretKeyLen: Integer read GetSecretKeyLen write SetSecretKeyLen; property AlgorithmID: ObjectIdentifier read GetAlgorithmID write SetAlgorithmID;

classtDSIKeyExchange

inherits from tObjectMapping

implements iKeyExchange

constructor Create;

interfaceiDSIDLArith

iDSIDLArith is the arithmetic engine for discrete-log cryptography -- the object behind iDLKey.Pool. It is the low-level primitive layer (implemented by tDSIDLArith and its subclasses tDSIEC for elliptic curves, tDSIFF for finite-field DSA/DH, tDSIED for Edwards/EdDSA in StreamSec.DSI.DiscreteLog) that actually performs key generation, ECDSA/DSA/NR/EdDSA sign & verify, DH/MQV key agreement, the DL/ECIES integrated encryption scheme, and the IEEE-1363/X9.42 key-derivation functions. Applications normally reach these operations through higher-level key/certificate components and rarely call this interface directly; you touch it when you need raw primitive access (e.g. custom key agreement or an IES round-trip). The same engine object is used identically on both peers of a protocol -- which methods a given side calls (sign vs verify, encrypt vs decrypt) is what differs, not the object.

function NewPrivateKey(const aParams : iDiscreteLogField): iDLPrivateKey;
Allocates a fresh, empty iDLPrivateKey bound to the given domain parameters and to this engine as its Pool. Use it when you want to build a private key and then fill or generate its scalar; higher-level key factories call this for you.
function NewPublicKey(const aParams : iDiscreteLogField): iDLPublicKey;
Allocates a fresh, empty iDLPublicKey bound to the given domain parameters and to this engine. Use it when reconstructing a public key from received bytes, or as the target of a decode step.
function FieldElementToBytes(const aElement: iGroupElement; const aParams : iDiscreteLogField) : tBytes; overload;
Serialises a group element (an EC point or finite-field value) to its fixed-length octet-string encoding under the given domain parameters, returning a freshly allocated buffer. Use it to put a public point on the wire or into a certificate.
function FieldElementToBytes(const aElement : iGroupElement; const aParams : iDiscreteLogField; const aDst : tBytes; aDstOffset: Integer; var aDstCount : Integer) : Boolean; overload;
Buffer-writing overload of FieldElementToBytes: writes the encoding into aDst at aDstOffset, returning the byte count in aDstCount and True on success. Use it to encode a point into a caller-owned buffer without an allocation.
function BytesToFieldElement(const aSrc : tBytes; const aParams: iDiscreteLogField) : iGroupElement; overload;
Parses an octet-string encoding back into a group element under the given domain parameters. Use it to decode a peer's public point received on the wire; validate the result (via the key's Validate) before trusting it.
function BytesToFieldElement(const aSrc : tBytes; aSrcOffset, aSrcCount : Integer; const aParams : iDiscreteLogField) : iGroupElement; overload;
Offset/count overload of BytesToFieldElement: decodes the point from a slice of aSrc. Use it when the encoded point sits embedded inside a larger buffer.
function KeyAgreementScheme_DH1(const aPriv : iDLPrivateKey; const aWPr : iGroupElement; const aP : iSecretKey; aCoFactor : Boolean; aHashAlgorithm: tHashAlgorithm; aKeyDerivation: tKeyDerivation; akLen : Integer; var aK : iSecretKey; const aMacTag1 : iX9_42MacTagParams = nil; const aMacTag2 : iX9_42MacTagParams = nil) : Boolean;
Diffie-Hellman primitive DH1 (IEEE 1363 / X9.63 one-pass): combines this party's private key aPriv with the peer's public group element aWPr to derive a shared secret, then runs it through the selected key-derivation function (aKeyDerivation with aHashAlgorithm and shared info aP) to produce a ke... Full description »
function KeyAgreementScheme_DH2(const aPriv0 : iDLPrivateKey; const aPriv1 : iDLPrivateKey; const aWPr : iGroupElement; const aVPr : iGroupElement; const aP : iSecretKey; aCoFactor0, aCoFactor1 : Boolean; aHashAlgorithm: tHashAlgorithm; aKeyDerivation: tKeyDerivation; akLen : Integer; var aK : iSecretKey;
Diffie-Hellman primitive DH2 (two-key / C(2,2) agreement, e.g. static-static + ephemeral-ephemeral as in the Unified Model): combines two of this party's private keys (aPriv0, aPriv1) with two of the peer's public elements (aWPr, aVPr) into a single shared secret, then derives key aK as in DH1. Full description »
function KeyAgreementScheme_MQV(const aPriv0 : iDLPrivateKey; const aPriv1 : iDSInteger; const aPubl1 : iGroupElement; const aWPr : iGroupElement; const aVPr : iGroupElement; const aP : iSecretKey; aCoFactor : Boolean; aHashAlgorithm: tHashAlgorithm; aKeyDerivation: TKeyDerivation; akLen : Integer; var aK : iSecretKey;
MQV key-agreement primitive (menezes-Qu-Vanstone, IEEE 1363): derives a shared secret from this party's static private key aPriv0, its ephemeral private scalar aPriv1 and ephemeral public aPubl1, plus the peer's static and ephemeral public elements (aWPr, aVPr), then derives key aK as in DH1. Full description »
function EncodingMethodForSignatureWithAppendix1(const aDigest : tBytes; aOffset, aCount : Integer; aHashAlgorithm: tHashAlgorithm; aFBitSize : Cardinal) : iDSInteger;
EMSA1 encoding (IEEE 1363 "encoding method for signatures with appendix"): turns a message digest into the integer F that the DSA/ECDSA signature primitive consumes -- taking the leftmost aFBitSize bits of the digest as required by the group order. This is internal signing machinery; applications use the SSASignatureGeneration helpers instead of calling it directly.
function DecodingMethodForSignatureWithAppendix1(const aF : iDSInteger; const aDigest : tBytes; aOffset, aCount : Integer; aHashAlgorithm: tHashAlgorithm; aFBitSize : Cardinal) : Boolean;
The verification counterpart of EMSA1: recomputes F from the digest and checks it against aF. Internal verification machinery; applications use SSASignatureVerification rather than this.
function SignatureLength(aKey: iDLKey): Integer;
Returns the maximum encoded signature length in bytes for aKey (accounting for its group size and SignScheme). Call it to size a signature buffer before generating a signature into it.
function SSASignatureGeneration(aKey : iDLPrivateKey; const aDigest : tBytes; aOffset, aCount : Integer; aHashAlgorithm: tHashAlgorithm; aNullMsg : Boolean; aDEREncode : Boolean; const aSign : tBytes; aSignOffset, aSignCount : Integer) : Integer; overload;
Generates a signature over an already-computed digest into a caller-supplied buffer (aSign at aSignOffset), returning the number of bytes written. Full description »
function SSASignatureGeneration(aKey : iDLPrivateKey; aDigest : pByteArray; aCount : Integer; aHashAlgorithm: tHashAlgorithm; aNullMsg : Boolean; aDEREncode : Boolean; aSign : pByteArray; aSignCount : Integer) : Integer; overload;
pByteArray/raw-pointer variant of the digest-input signer above. Use it from code that already works with raw buffers rather than tBytes. Signer side. » member page
function SSASignatureGeneration(aKey : iDLPrivateKey; const aDigest : tBytes; aHashAlgorithm: tHashAlgorithm; aNullMsg : Boolean; aDEREncode : Boolean; var aSign : tBytes) : Integer; overload;
Digest-input signer that allocates/grows the aSign tBytes for you (var parameter). The convenient overload when you have a digest and want the signature returned in a managed buffer. Signer side. » member page
function SSASignatureGeneration(aKey : iDLPrivateKey; aDigest : iSecretKey; aHashAlgorithm: tHashAlgorithm; aNullMsg : Boolean; aDEREncode : Boolean; var aSign : iSecretKey) : Integer; overload;
iSecretKey-in/iSecretKey-out signer: signs a digest held in a protected secret-key buffer and returns the signature likewise. Use it when the digest is sensitive material you keep wiped. Signer side. » member page
function SSASignatureGeneration(aKey : iDLPrivateKey; const aMsg : tBytes; aOffset, aCount : Integer; aHashAlgorithm: tHashAlgorithm; aDEREncode : Boolean; const aSign : tBytes; aSignOffset, aSignCount : Integer) : Integer; overload;
Message-input signer (no aNullMsg): hashes aMsg with aHashAlgorithm and signs the result into the caller-supplied buffer. Use this family when you have the raw message rather than a precomputed digest. Signer side. » member page
function SSASignatureGeneration(aKey : iDLPrivateKey; aMsg : pByteArray; aCount : Integer; aHashAlgorithm: tHashAlgorithm; aDEREncode : Boolean; aSign : pByteArray; aSignCount : Integer) : Integer; overload;
pByteArray/raw-pointer message-input signer. Signer side. » member page
function SSASignatureGeneration(aKey : iDLPrivateKey; const aMsg : tBytes; aHashAlgorithm: tHashAlgorithm; aDEREncode : Boolean; var aSign : tBytes) : Integer; overload;
Message-input signer that allocates the aSign tBytes for you (var parameter) -- the simplest sign-a-message call. Signer side. » member page
function SSASignatureVerification(aKey : iDLPublicKey; const aDigest : tBytes; aDOffset, aDCount : Integer; const aSign : tBytes; aSOffset, aSCount : Integer; aDEREncode : Boolean; aHashAlgorithm: tHashAlgorithm; aNullMsg : Boolean) : Boolean; overload;
Verifies a signature over a precomputed digest, returning True if valid. aDEREncode/aHashAlgorithm/aNullMsg must match how the signature was produced; aKey.SignScheme selects the algorithm. This is the verifier (public-key) side what a peer runs to authenticate a signature you sent.
function SSASignatureVerification(aKey : iDLPublicKey; const aDigest : tBytes; const aSign : tBytes; aDEREncode : Boolean; aHashAlgorithm: tHashAlgorithm; aNullMsg : Boolean) : Boolean; overload;
Whole-buffer digest-input verify (no offsets). Convenience form of the verifier above. Verifier side.
function SSASignatureVerification(aKey : iDLPublicKey; aDigest : iSecretKey; aSign : iSecretKey; aDEREncode : Boolean; aHashAlgorithm: tHashAlgorithm; aNullMsg : Boolean) : Boolean; overload;
iSecretKey digest/signature verify: verifies when the digest and signature are held in protected secret-key buffers. Verifier side.
function SSASignatureVerification(aKey : iDLPublicKey; const aMsg : tBytes; aMOffset, aMCount : Integer; const aSign: tBytes; aSOffset, aSCount : Integer; aDEREncode : Boolean; aHashAlgorithm: tHashAlgorithm) : Boolean; overload;
Message-input verify: hashes aMsg and verifies the signature over it. Use this family when you hold the raw message rather than its digest. Verifier side.
function SSASignatureVerification(aKey : iDLPublicKey; const aMsg : tBytes; const aSign : tBytes; aDEREncode : Boolean; aHashAlgorithm: tHashAlgorithm) : Boolean; overload;
Whole-buffer message-input verify (no offsets) -- the simplest verify-a-message call. Verifier side.
procedure IntegratedEncryption(aKey : iDLPublicKey; const aMsg : tBytes; aMsgOffset, aMsgCount : Integer; const aP1 : tBytes; aP1Offset, aP1Len : Integer; const aP2 : tBytes; aP2Offset, aP2Len : Integer; aHashAlgorithm: tHashAlgorithm;
DL/ECIES integrated encryption (IEEE 1363a IES): encrypts aMsg to the peer's public key aKey by generating an ephemeral key pair, deriving a symmetric key via ECDH+KDF (with optional shared-info aP1) and returning the ephemeral public element, the XOR/stream ciphertext, and a MAC (keyed with shar... Full description »
procedure IntegratedEncryption(aKey : iDLPublicKey; const aMsg : tBytes; aMsgOffset, aMsgCount : Integer; const aP1 : tBytes; aP1Offset, aP1Len : Integer; const aP2 : tBytes; aP2Offset, aP2Len : Integer; aHashAlgorithm: tHashAlgorithm;
DL/ECIES integrated encryption, block-cipher variant: same scheme as the overload above, but instead of the built-in XOR stream it encrypts aMsg with the caller-chosen symmetric cipher aCipherClass using a KDF-derived key of aKeyLen bytes (the message is length-padded to the cipher block size). Full description »
function IntegratedDecryption(aKey : iDLPrivateKey; aEphemeralKey : iGroupElement; const aCipherText : tBytes; aCTOffset, aCTCount : Integer; const aMAC : tBytes; aMACOffset, aMACCount : Integer; const aP1 : tBytes; aP1Offset, aP1Len : Integer;
DL/ECIES integrated decryption -- the inverse of the stream-construction IntegratedEncryption. Reconstructs the symmetric key from this party's private key aKey and the sender's aEphemeralKey (ECDH + KDF with shared-info aP1), verifies the aMAC over the ciphertext and shared-info aP2, and on succ... Full description »
function IntegratedDecryption(aKey : iDLPrivateKey; aEphemeralKey : iGroupElement; const aCipherText : tBytes; aCTOffset, aCTCount : Integer; const aMAC : tBytes; aMACOffset, aMACCount : Integer; const aP1 : tBytes; aP1Offset, aP1Len : Integer;
DL/ECIES integrated decryption, block-cipher variant -- the inverse of the aCipherClass/aKeyLen IntegratedEncryption. Full description »
procedure NewKeys(const aParams: iDiscreteLogField; var aPriv : iDSInteger; var aPubl : iGroupElement); overload;
Generates a fresh key pair under the given domain parameters: draws a random private scalar aPriv (uniformly in the group order, or of the fixed scalar bit-length for Montgomery/Edwards curves) and computes the matching public group element aPubl as Generator raised to that scalar. This overload returns the private half as a bare iDSInteger scalar.
procedure NewKeys(const aParams: iDiscreteLogField; var aPriv : iDLPrivateKey; var aPubl : iGroupElement); overload;
Same key generation as the scalar overload, but wraps the result in a fresh iDLPrivateKey bound to this engine (its Pool) and to aParams, and also returns the public element aPubl. Use this form when you want a ready-to-use private key object rather than a bare scalar.
procedure KDF1(const aZ : tBytes; azOffset, azLen : Integer; const aP : tBytes; apOffset, apLen : Integer; aHashAlgorithm: tHashAlgorithm; const aK : tBytes; akOffset, akLen : Integer); overload;
KDF1 (IEEE 1363 / ISO 18033-2 KDF1): hashes the shared secret aZ concatenated with the optional shared-info aP once and copies akLen bytes of the digest into aK. Full description »
function KDF1(aZ : iSecretKey; aP : iSecretKey; aHashAlgorithm: tHashAlgorithm; akLen : Integer) : iSecretKey; overload;
iSecretKey-in/iSecretKey-out convenience for KDF1: derives an akLen-byte key from protected secret buffers aZ (shared secret) and aP (shared info), returning it as a new iSecretKey. Same single-block KDF1 limit on akLen applies. » member page
procedure KDF2(const aZ : tBytes; azOffset, azLen : Integer; const aP : tBytes; apOffset, apLen : Integer; aHashAlgorithm: tHashAlgorithm; const aK : tBytes; akOffset, akLen : Integer); overload;
KDF2 (ANSI X9.63 / IEEE 1363a KDF2): the counter-mode key-derivation function -- repeatedly hashes aZ, a 4-byte big-endian counter and the shared-info aP, and concatenates the digests until akLen bytes of key material fill aK. Unlike KDF1 it can produce output longer than one hash block. This is the KDF underlying the DH agreement and IES paths for arbitrary key lengths.
function KDF2(const aZ : tBytes; azOffset, azLen : Integer; const aP : tBytes; apOffset, apLen : Integer; aHashAlgorithm: tHashAlgorithm; akLen : Integer) : iSecretKey; overload;
KDF2 overload that allocates and returns the derived akLen-byte key as an iSecretKey instead of writing into a caller buffer; aZ/aP are tBytes slices.
function KDF2(aZ : iSecretKey; aP : iSecretKey; aHashAlgorithm: tHashAlgorithm; akLen : Integer) : iSecretKey; overload;
iSecretKey-in/iSecretKey-out convenience for KDF2: derives an akLen-byte key from protected secret buffers aZ (shared secret) and aP (shared info).
procedure KDFX9_42ASN1BER(const aZ : tBytes; azOffset, azLen : Integer; const aP : tBytes; apOffset, apLen : Integer; aHashAlgorithm: tHashAlgorithm; const aK : tBytes; akOffset, akLen : Integer); overload;
KDFX9_42ASN1BER (ANSI X9.42 key derivation with DER-encoded OtherInfo): treats aP as an already ASN.1/BER-encoded OtherInfo structure, prepends its leading fields to the shared secret aZ per X9.42 and runs the result through KDF2 to fill aK with akLen bytes. Use it when a protocol (e.g. CMS key agreement) specifies the X9.42 DER OtherInfo layout.
function KDFX9_42ASN1BER(aZ : iSecretKey; aP : iSecretKey; aHashAlgorithm: tHashAlgorithm; akLen : Integer) : iSecretKey; overload;
iSecretKey-in/iSecretKey-out convenience for KDFX9_42ASN1BER: aP holds the DER-encoded OtherInfo, and the akLen-byte key is returned as an iSecretKey.
procedure KDFX9_42Concatenation(const aZ : tBytes; azOffset, azLen : Integer; const aP : tBytes; apOffset, apLen : Integer; aHashAlgorithm: tHashAlgorithm; const aK : tBytes; akOffset, akLen : Integer); overload;
KDFX9_42Concatenation (ANSI X9.42 key derivation, concatenation OtherInfo form): like KDFX9_42ASN1BER but expects aP as the simpler X9.42 concatenation OtherInfo (a SEQUENCE carrying the algorithm OID); prepends the parsed prefix to aZ and derives akLen bytes into aK via KDF2.
function KDFX9_42Concatenation(aZ : iSecretKey; aP : iSecretKey; aHashAlgorithm: tHashAlgorithm; akLen : Integer) : iSecretKey; overload;
iSecretKey-in/iSecretKey-out convenience for KDFX9_42Concatenation: aP holds the concatenation-form OtherInfo, and the akLen-byte key is returned as an iSecretKey.

interfaceiECPoint

(no public members)

interfaceiECurve

function Compare(const aSource: iECurve): Boolean; procedure Assign(const aSource: iDiscreteLogField); function GetA: iDSInteger; function GetB: iDSInteger; function GetQ: iDSInteger; function GetR: iDSInteger; function GetK: iDSInteger; function GetG: iECPoint; function GetCurveOID: ObjectIdentifier; procedure ModProc(var aA: iDSInteger; const aM: iDSInteger); function MulModProc(const aX, aY, aM: iDSInteger): iDSInteger; function NewPoint: iECPoint; function NewPointInf: iECPoint; procedure SetA(const Value: iDSInteger); procedure SetB(const Value: iDSInteger); procedure SetQ(const Value: iDSInteger); procedure SetR(const Value: iDSInteger); procedure SetK(const Value: iDSInteger); property A: iDSInteger read GetA write SetA; property B: iDSInteger read GetB write SetB; property Q: iDSInteger read GetQ write SetQ; property R: iDSInteger read GetR write SetR; property K: iDSInteger read GetK write SetK; property G: iECPoint read GetG; property CurveOID: ObjectIdentifier read GetCurveOID;

interfaceiECPoint

inherits from iGroupElement

function GetCurve: iECurve; function GetFE2OSFormat: tECP2OSFormat; function GetX: iDSInteger; function GetY: iDSInteger; function GetZ: iDSInteger; procedure SetCurve(ACurve: iECurve); procedure SetFE2OSFormat(const Value: tECP2OSFormat); procedure SetX(const Value: iDSInteger); procedure SetY(const Value: iDSInteger); procedure SetZ(const Value: iDSInteger); procedure Assign(ASource: IECPoint); property Curve: iECurve read GetCurve; property X: iDSInteger read GetX write SetX; property Y: iDSInteger read GetY write SetY; property Z: iDSInteger read GetZ write SetZ; property FE2OSFormat: tECP2OSFormat read GetFE2OSFormat write SetFE2OSFormat;

interfaceiDSIEC

inherits from iDSIDLArith

function OIDToCurve(const aOID : ObjectIdentifier; var aCurve: iECurve) : Boolean;

interfaceiDSIFF

inherits from iDSIDLArith

procedure NewKeys(aBitSize : Cardinal; aQBitSize : Cardinal; var aPriv : iDLPrivateKey; var aPubl : iDLPublicKey; aTerminate: tGetTerminate = nil); overload;

interfaceiDSIED

inherits from iDSIDLArith

The EdDSA (RFC 8032) pool: creates the seed-based EdDSA keys and carries the EdDSA signature/verification scheme implementation (tDSIEdDSA in StreamSec.DSI.EdDSA). Obtain it via GetDSIED.

function OIDToCurve(const aOID : ObjectIdentifier; var aCurve: iECurve) : Boolean;

interfaceiDSIIF

(no public members)

interfaceiIFKey

iIFKey is the common base of an integer-factorization (RSA/Rabin-Williams) key pair -- the pieces shared by both halves (iIFPublicKey / iIFPrivateKey): the scheme selector plus the public modulus N and public exponent E. Applications usually obtain a concrete key from a decoded certificate/key or from iDSIIF.NewKeys rather than implementing this interface themselves. The same key type is used on both peers of a protocol; nothing here is client- or server-specific.

function GetScheme: tIFScheme;
Getter for Scheme; see the property.
function GetN: iDSInteger;
Getter for N; see the property.
function GetE: iDSInteger;
Getter for E; see the property.
procedure SetScheme(Value: tIFScheme);
Setter for Scheme; see the property.
procedure SetN(const Value: iDSInteger);
Setter for N; see the property. Assign the modulus here when building a key by hand from decoded key material.
procedure SetE(const Value: iDSInteger);
Setter for E; see the property. Assign the public exponent here when building a key by hand from decoded key material.
property Scheme: tIFScheme read GetScheme write SetScheme;
Which integer-factorization scheme this key is used with: ifRSA1 / ifRSA2 (RSA, selecting the encoding family -- e.g. ifRSA1 with seEMSA3 is PKCS#1 v1.5 and with seEMSA4 is RSA-PSS) or ifRW (Rabin-Williams). Read it to learn a decoded key's type; set it before signing/encrypting when the default is not what you want.
property N: iDSInteger read GetN write SetN;
The public modulus n = p*q. Together with E it is the public key and it also fixes the key/operand size for every RSA primitive. Read it to learn the key size or to encode the key; write it only when reconstructing a key from received bytes.
property E: iDSInteger read GetE write SetE;
The public exponent e (commonly 65537). Together with N it forms the public key used by the public-key operation (encryption / signature verification). Read it to encode the key; write it only when reconstructing a key.

interfaceiIFPrivateKey

(no public members)

interfaceiIFPublicKey

inherits from iIFKey

The public half of an integer-factorization (RSA/Rabin-Williams) key pair. Adds only the public-key primitive and a cross-check to iIFKey (Scheme, N, E). Applications normally obtain one from a decoded certificate/key or from iDSIIF.NewKeys rather than implementing it; the same key type is used on both peers of a protocol -- nothing here is client- or server-specific.

function IFEP_RSA(const aF: iDSInteger; aLocal: Boolean = False): iDSInteger;
The RSA public-key primitive: computes aF^E mod N. This is the operation underlying RSA encryption and signature verification; higher layers wrap it with the chosen padding/encoding. aF must be positive and smaller than the modulus. aLocal requests a thread-local (non-global) result allocation. Asserts the key is an RSA scheme (ifRSA1/ifRSA2).
function Validate(const aPriv: iIFPrivateKey): Boolean;
Consistency-checks this public key against aPriv (delegates to aPriv.Validate(Self), i.e. verifies the private key matches). Returns False on any mismatch.

classtExternalIFPrivateKey

Abstract adapter for an RSA/Rabin-Williams private key whose secret material lives outside the process (an OS or hardware key store) rather than in an iIFPrivateKey's D/P/Q. When iIFPrivateKey.ReprType is 3 the private-key operations are delegated to an instance of this class held in iIFPrivateKey.ExternalKey. Every method here is a do-nothing base implementation (returns False, -1 or an empty string); a concrete subclass overrides them to call the backing store. The shipped concrete subclass is TCAPIIFPrivateKey (Windows CryptoAPI) in StreamSec.DSI.CAPIExtKey; an application selects it per key ring via TsmPrivateKeyRingComponent.ExternalIFPrivateKeyClass. The same class serves any protocol role; nothing here is client- or server-specific.

function GetIdentifier: string; virtual;
Getter for Identifier; see the property. Base returns an empty string.
function GetKeySize: Integer; virtual;
Modulus size in bits of the backing key. Base returns -1 (unknown); a subclass reports the real size from its store.
function IFPrivateKeyOperation(aI: iDSInteger; var aJ: iDSInteger) : Boolean; virtual;
The raw private-key primitive delegated to the external store: on success returns aJ = aI^d mod n. Base returns False (not implemented); override to call the backing store.
function SignMsg(const aMsg : tBytes; aOffset, aCount : Integer; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aSaltLen : Cardinal; aEncoding : tSignEncoding; var aSign : tBytes; var aSignCount : Integer) : Boolean; virtual;
Signs the message aMsg[aOffset..aOffset+aCount-1] in the external store, hashing it with aHashAlgorithm (aMGFHashAlgorithm/aSaltLen apply to PSS) under the aEncoding scheme, returning the signature in aSign/aSignCount. Base returns False; override to sign via the backing store.
function SignDigest(const aDigest : tBytes; aOffset, aCount : Integer; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aSaltLen : Cardinal; aEncoding : tSignEncoding; aNullMsg : Boolean; var aSign : tBytes; var aSignCount : Integer) : Boolean; virtual;
Signs a pre-computed digest (aNullMsg True when the digest is passed with no algorithm-identifier prefix). Parameters otherwise mirror SignMsg. Base returns False; override to sign via the backing store.
function IFESDecryption(const aEMsg : tBytes; aEOffset, aECount : Integer; const aP : tBytes; aPOffset, aPCount : Integer; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aEncryptEncoding : tEncryptEncoding; var aMsg : tBytes; var aSuccess : Boolean)
Decrypts the encrypted message aEMsg in the external store (RSAES-OAEP/PKCS#1 per aEncryptEncoding, aP the optional OAEP label), returning the plaintext in aMsg and setting aSuccess. Base returns False; override to decrypt via the backing store.
function Validate(aPubl: iIFPublicKey): Boolean; virtual;
Consistency-checks the external key against the supplied public key aPubl. Base returns False; override to check that the store's key matches aPubl.
constructor Create; virtual;
Creates the adapter. Base does nothing; a subclass constructor opens or references the underlying store.
function ImportKey(const aPKIdentifier; aPKILen: Integer): Boolean; virtual;
Binds this adapter to a specific stored key, named by the opaque, subclass- defined identifier blob aPKIdentifier (aPKILen bytes). Base returns False; override to locate/open the key in the backing store.
property Identifier: string read GetIdentifier;
A human-readable name of the bound external key (e.g. its container name). Base yields an empty string; a subclass reports the store's identifier.

interfaceiIFPrivateKey

inherits from iIFKey

The private half of an integer-factorization (RSA/Rabin-Williams) key pair. Extends iIFKey (Scheme, N, E) with the secret components and the private-key operation. The key can be held in three representations selected by ReprType: 0 = plain (uses the private exponent D and modulus N directly); 1 or 2 = CRT (uses the primes P, Q and the CRT quantities D1, D2, C for a faster operation); 3 = external (the operation is delegated to an ExternalKey, e.g. a Windows CAPI or other hardware/OS key store, and D/P/Q are not present in process memory). Applications normally obtain an instance from a decoded PKCS#8/PKCS#1 key or from iDSIIF.NewKeys/IFRSAKeys rather than implementing the interface. The same key type is used regardless of protocol role; nothing here is client- or server-specific.

function GetReprType: Byte;
Getter for ReprType; see the property.
function GetD: iDSInteger;
Getter for D; see the property.
function GetP: iDSInteger;
Getter for P; see the property.
function GetQ: iDSInteger;
Getter for Q; see the property.
function GetD1: iDSInteger;
Getter for D1; see the property. Lazily computes d mod (p-1) from D and P if not already stored.
function GetD2: iDSInteger;
Getter for D2; see the property. Lazily computes d mod (q-1) from D and Q if not already stored.
function GetC: iDSInteger;
Getter for C; see the property. Lazily computes the CRT coefficient q^-1 mod p from P and Q if not already stored.
function GetExtKey: tExternalIFPrivateKey;
Getter for ExternalKey; see the property.
procedure SetReprType(const aValue: Byte);
Setter for ReprType; see the property.
procedure SetD(const aValue: iDSInteger);
Setter for D; see the property. Assign the private exponent here when building a key by hand from decoded key material.
procedure SetP(const aValue: iDSInteger);
Setter for P; see the property. Assign the first prime here when building a CRT key by hand.
procedure SetQ(const aValue: iDSInteger);
Setter for Q; see the property. Assign the second prime here when building a CRT key by hand.
procedure SetD1(const aValue: iDSInteger);
Setter for D1; see the property. Assign d mod (p-1) here when reconstructing a CRT key from decoded material.
procedure SetD2(const aValue: iDSInteger);
Setter for D2; see the property. Assign d mod (q-1) here when reconstructing a CRT key from decoded material.
procedure SetC(const aValue: iDSInteger);
Setter for C; see the property. Assign the CRT coefficient q^-1 mod p here when reconstructing a CRT key from decoded material.
procedure SetExtKey(const aValue: tExternalIFPrivateKey);
Setter for ExternalKey; see the property. Side effect: assigning an external key forces ReprType to 3.
procedure IFRSAKeys(aBitSize : UInt32; aReprType : Byte; aKind : tIFKeyGenerationKind; var aPubl : iIFPublicKey; aTerminate : tGetTerminate = nil);
Generates a fresh RSA key pair of aBitSize bits into this instance and fills aPubl with the matching public key. Full description »
procedure IFRSAPublicKey(var aPubl : iIFPublicKey; aCompatibility: Boolean);
Derives the matching public key from this CRT private key (requires ReprType 1 or 2). With aCompatibility False it copies the stored public exponent E; with aCompatibility True it recomputes e as d^-1 mod (p-1)(q-1), for keys whose stored E cannot be trusted.
procedure IFRWKeys(aBitSize : Cardinal; aReprType : Byte; aStrongPrimes: Boolean; var aPubl : iIFPublicKey);
Rabin-Williams key generation. Note: not implemented in this DSI backend -- calling it raises eKeyGeneration.
function IFPrivateKeyOperation(const aI: iDSInteger; aLocal: Boolean = False): iDSInteger;
The core private-key primitive: computes aI^d mod n (used for both signing and decryption). Uses D/N directly when ReprType is 0, the CRT path (P, Q, D1, D2, C) when 1 or 2, or delegates to ExternalKey when 3. aI must be less than the modulus. aLocal requests a thread-local (non-global) result allocation.
function Validate(const aPubl: iIFPublicKey): Boolean;
Consistency-checks this private key against the supplied public key: verifies N matches and that a private/public round-trip (or, for CRT keys, that the stored CRT quantities are correct) holds. For a ReprType-1 key it also repairs a bad C in place if possible. Returns False on any mismatch.
property ReprType: Byte read GetReprType write SetReprType;
Selects the stored key representation: 0 = plain (D and N), 1 or 2 = CRT (P, Q, D1, D2, C), 3 = external (operation delegated to ExternalKey). The private-key operation dispatches on this value.
property D: iDSInteger read GetD write SetD;
The private exponent d (with e*d = 1 mod lcm(p-1,q-1)). Present/used for the plain (ReprType 0) representation; for a CRT key it is derived on demand from the CRT components.
property P: iDSInteger read GetP write SetP;
The first prime factor p of the modulus (CRT representation).
property Q: iDSInteger read GetQ write SetQ;
The second prime factor q of the modulus (CRT representation).
property D1: iDSInteger read GetD1 write SetD1;
The CRT exponent d mod (p-1).
property D2: iDSInteger read GetD2 write SetD2;
The CRT exponent d mod (q-1).
property C: iDSInteger read GetC write SetC;
The CRT coefficient q^-1 mod p, combining the two half-size results in the CRT private-key operation.
property ExternalKey: tExternalIFPrivateKey read GetExtKey write SetExtKey;
An external key handle used when ReprType is 3: the private-key operation and Validate are forwarded to this object (e.g. an OS/hardware key store) so the secret never enters process memory. Assigning it sets ReprType to 3.

interfaceiTrailerField

function GetAllowTrailerField: tTrailerFields; function GetUseTrailerField: tTrailerFields; procedure SetAllowTrailerField(Value: tTrailerFields); procedure SetUseTrailerField(Value: tTrailerFields); property AllowTrailerField: tTrailerFields read GetAllowTrailerField write SetAllowTrailerField; property UseTrailerField: tTrailerFields read GetUseTrailerField write SetUseTrailerField;

interfaceiDSIIF

function NewPrivateKey: iIFPrivateKey; function NewPrivateKeyFrom(const aSource: iIFPrivateKey): iIFPrivateKey; function NewPublicKey: iIFPublicKey; function NewPublicKeyFrom(const aSource: iIFPublicKey): iIFPublicKey; function GetEncodingRangeEME1(aKeyBits : Cardinal; aHashAlgorithm: tHashAlgorithm; var aMaxBytes : Integer) : Boolean; function GetEncodingRangeEME_PKCS1_v1_5(aKeyBits : Cardinal; var aMaxBytes: Integer) : Boolean; procedure RSAKeys(aBitSize : UInt32; aReprType : Byte; aKind : tIFKeyGenerationKind; var aPriv : iIFPrivateKey; var aPubl : iIFPublicKey; aTerminate: tGetTerminate = nil); procedure RSAPublicKey(const aPriv : iIFPrivateKey; var aPubl : iIFPublicKey; aCompatibility: Boolean = False); procedure RWKeys(aBitSize : UInt32; aReprType : Byte; aStrongPrimes: Boolean; var aPriv : iIFPrivateKey; var aPubl : iIFPublicKey); function ValidatePrivateKey(const aPriv: iIFPrivateKey; const aPubl: iIFPublicKey) : Boolean; function SSASignatureGeneration(const aKey : iIFPrivateKey; const aDigest : tBytes; aOffset, aCount : Integer; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aSaltLen : Cardinal; aEncoding : tSignEncoding; aNullMsg : Boolean; var aSign : tBytes) : Integer; overload;
Usage: AKey.Scheme = ifRSA1, Encoding = seEMSA3: RSA-PKCS-v1.5 AKey.Scheme = ifRSA1, Encoding = seEMSA4: RSA-PSS
function SSASignatureGeneration(const aKey : iIFPrivateKey; const aDigest : tBytes; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aSaltLen : Cardinal; aEncoding : tSignEncoding; aNullMsg : Boolean; var aSign : tBytes) : Integer; overload;
function SSASignatureGeneration(const aKey : iIFPrivateKey;
aDigest : pByteArray;
aCount : Integer;
aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm;
aEncoding : tSignEncoding;
aNullMsg : Boolean;
var aSign : tBytes) : Integer; overload;
function SSASignatureGeneration(const aKey : iIFPrivateKey; const aMsg : tBytes; aOffset, aCount : Integer; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aSaltLen : Cardinal; aEncoding : tSignEncoding; var aSign : tBytes) : Integer; overload; function SSASignatureGeneration(const aKey : iIFPrivateKey; const aMsg : tBytes; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aSaltLen : Cardinal; aEncoding : tSignEncoding; var aSign : tBytes) : Integer; overload;
function SSASignatureGeneration(const aKey : iIFPrivateKey;
const aMsg : pByteArray;
aCount : Integer;
aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm;
aEncoding : tSignEncoding;
var aSign : tBytes) : Integer; overload;
function SSASignatureVerification(const aKey : iIFPublicKey; const aDigest : tBytes; aDOffset, aDCount : Integer; const aSign : tBytes; aSOffset, aSCount : Integer; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aSaltLen : Cardinal; aEncoding : tSignEncoding; function SSASignatureVerification(const aKey : iIFPublicKey; const aDigest : tBytes; const aSign : tBytes; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aSaltLen : Cardinal; aEncoding : tSignEncoding; aNullMsg : Boolean) : Boolean; overload; function SSASignatureVerification(const aKey : iIFPublicKey; const aMsg : tBytes; aMOffset, aMCount : Integer; const aSign : tBytes; aSOffset, aSCount : Integer; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aSaltLen : Cardinal; aEncoding : tSignEncoding) function SSASignatureVerification(const aKey : iIFPublicKey; const aMsg : tBytes; const aSign : tBytes; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aSaltLen : Cardinal; aEncoding : tSignEncoding) : Boolean; overload; procedure Encryption(const aKey : iIFPublicKey; const aMsg : tBytes; aMOffset, aMCount : Integer; const aP : tBytes; aPOffset, aPCount : Integer; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aEncryptEncoding : tEncryptEncoding; var aEMsg : tBytes); overload;
EncryptEncoding = eeEME1 : OAEP EncryptEncoding = eeEME_PKCS1_v1_5: PKCS#1 v1.5
procedure Encryption(const aKey : iIFPublicKey; const aMsg : tBytes; aOffset, aCount : Integer; aHashAlgorithm : tHashAlgorithm; aEncryptEncoding: tEncryptEncoding; var aEMsg : tBytes); overload; function Decryption(const aKey : iIFPrivateKey; const aEMsg : tBytes; aEOffset, aECount : Integer; const aP : tBytes; aPOffset, aPCount : Integer; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aEncryptEncoding : tEncryptEncoding; var aMsg : tBytes)
RSAES-OAEP: aHashAlgorithm is the OAEP hash (lHash = Hash(L), L = aP), aMGFHashAlgorithm the hash of MGF1, which makes both masks (RFC 8017 7.1.2). When the two differ, a ciphertext whose seed is masked with MGF1 over the OAEP hash - what releases up to and including 4.1.4.361 encrypted - is decrypted as well; iIFDecryptionRFC8017 refuses it. The overloads without aP take MGF1 with SHA-1.
function Decryption(const aKey : iIFPrivateKey; const aEMsg : tBytes; aOffset, aCount : Integer; aHashAlgorithm : tHashAlgorithm; aEncryptEncoding: tEncryptEncoding; var aMsg : tBytes) : Boolean; overload; function Decryption(const aKey : iIFPrivateKey; const aEMsg : tBytes; aOffset, aCount : Integer; aHashAlgorithm : tHashAlgorithm; aEncryptEncoding: tEncryptEncoding; var aMsg : iSecretKey) : Boolean; overload; function SignatureAlgEMSA3(aHA: tHashAlgorithm): ObjectIdentifier; function ExtractHashAlgEMSA3(const aOID: ObjectIdentifier; var aHA : tHashAlgorithm) : Boolean;

interfaceiIFDecryptionRFC8017

RSA decryption that takes what RFC 8017 defines and nothing more. The long iDSIIF.Decryption also decrypts an RSAES-OAEP ciphertext whose OAEP hash and MGF1 hash differ and whose seed is masked with MGF1 over the OAEP hash: what releases up to and including 4.1.4.361 encrypted with two different hashes, which no other implementation decrypts. DecryptionRFC8017 refuses such a ciphertext, as OpenSSL does; it is otherwise the same call, with the same arguments and result. CMS key transport (tMPPrivateKeyIF. DecryptKeyTransport) decrypts through it, the message naming both hashes. The pool tDSIIF implements it: ask GetDSIIF for it with Supports.

function DecryptionRFC8017(const aKey : iIFPrivateKey; const aEMsg : tBytes; aEOffset, aECount : Integer; const aP : tBytes; aPOffset, aPCount : Integer; aHashAlgorithm : tHashAlgorithm; aMGFHashAlgorithm: tHashAlgorithm; aEncryptEncoding : tEncryptEncoding; var aMsg : tBytes)

interfaceiSNTRUPKey

Streamlined NTRU Prime sntrup761 keys. The same interfaces apply in every protocol role; the SSH-specific hybrid framing belongs to the SSH layer. Encodings are the raw primitive encodings, with no invented ASN.1 wrapper or PKIX OID. Each export returns an independent copy owned by the caller.

function GetEncodedKey: tBytes;
Full raw key: 1158 bytes for a public key, 1763 for a private key. The caller must clear private-key exports when no longer needed.
function GetEncodedPublicKey: tBytes;
The raw 1158-byte encapsulation key, including when invoked on a private key. A public key returns the same value as GetEncodedKey.

interfaceiSNTRUPPublicKey

inherits from iSNTRUPKey

(no public members)

interfaceiSNTRUPPrivateKey

inherits from iSNTRUPKey

function PublicKey: iSNTRUPPublicKey;
Returns the typed public half without exporting the private encoding.

interfaceiDSISNTRUP

The sntrup761 provider, implemented by StreamSec.DSI.Sntrup761. Obtain the registered pool with GetDSISNTRUP / MustGetDSISNTRUP. There is only one supported parameter set, so no algorithm selector is needed here.

function NewKEMPrivateKey(const aKey: tBytes): iSNTRUPPrivateKey;
Import raw primitive keys. Invalid encodings raise eSNTRUPError. The provider owns a copy, so subsequent changes to aKey cannot change it.
function NewKEMPublicKey(const aKey: tBytes): iSNTRUPPublicKey; procedure KEMKeyGen(var aPublicKey: iSNTRUPPublicKey; var aPrivateKey: iSNTRUPPrivateKey); procedure Encaps(const aPublicKey: iSNTRUPPublicKey; var aSharedSecret, aCiphertext: tBytes);
Returns a 32-byte shared secret and a 1039-byte ciphertext. Keys detected as missing or invalid raise eSNTRUPError; failures clear their outputs. The two output variables must be distinct, otherwise eSNTRUPError is raised. Their previous contents may share an allocation. Exceptions from key accessors and the random source propagate unchanged.
function Decaps(const aPrivateKey: iSNTRUPPrivateKey; const aCiphertext: tBytes; var aSharedSecret: tBytes): Boolean;
False with an empty output means a malformed public ciphertext length. A correct-length invalid ciphertext returns True and a pseudorandom implicit-rejection secret, never a ciphertext-validity indication. Full description »
function GetPRNG: iRawRandom; procedure SetPRNG(const Value: iRawRandom); property PRNG: iRawRandom read GetPRNG write SetPRNG;
nil restores the library's default raw random source. Injection permits an isolated provider instance to reproduce deterministic test vectors; production sources must supply cryptographically secure randomness.

interfaceiMLKEMKey

The common base of a FIPS 203 ML-KEM (Kyber) key pair, shared by both iMLKEMPublicKey and iMLKEMPrivateKey. Exposes the encapsulation-key material and the key size. Applications obtain a concrete key from a decoded certificate/PKCS#8 or from the ML-KEM pool (iDSIMK / GetDSIML) rather than implementing this interface; the same key type is used regardless of protocol role.

function GetPublicKey: tBytes;
The raw encapsulation-key bytes without the trailing 32-byte rho seed (i.e. the packed t vector). GetEncodedPublicKey returns this concatenated with rho.
function GetRho: tBytes;
The 32-byte rho seed that pins the public matrix A; it is stored as the last 32 bytes of the encoded encapsulation key.
function GetKeySize: tMLKEMSize;
The ML-KEM parameter set of this key (mlkem512/768/1024). Read it to select the matching algorithm/OID or to size buffers.
function GetEncodedKey: tBytes;
GetEncodedKey contains the standard encoding of the full key, both in the case of iMLKEMPublicKey and iMLKEMPrivateKey. It corresponds to the value of the aKey argument of the respective constructor Create.
function GetEncodedPublicKey: tBytes;
The encoded encapsulation (public) key: GetPublicKey concatenated with the 32-byte rho. For a public key this equals GetEncodedKey; for a private key it is the public half, e.g. for a SubjectPublicKeyInfo.

interfaceiMLKEMPublicKey

inherits from iMLKEMKey

(no public members)

interfaceiMLKEMPrivateKey

inherits from iMLKEMKey

The private (decapsulation) half of a FIPS 203 ML-KEM key pair. Adds the decapsulation-key components to iMLKEMKey: the K-PKE decryption key, the hash of the encapsulation key, and the implicit-rejection value z. Applications obtain one from a decoded PKCS#8 or from the ML-KEM pool and pass it to KEMDecaps; the same key type is used on both peers.

function GetPrivateKey: tBytes;
The K-PKE decryption key portion (dk_PKE) of the decapsulation key -- the secret used by KEMDecaps to recover the shared secret.
function GetPublicKeyHash: tBytes;
The 32-byte hash H(ek) of the encapsulation key that is embedded in the decapsulation key (checked on import and used during decapsulation).
function GetImplicitRejectionValue: tBytes;
The 32-byte implicit-rejection value z, used to derive the pseudo-random shared secret returned on an invalid ciphertext (Fujisaki-Okamoto implicit rejection).
function GetSeed: iSecretKey;
The seed this key was expanded from (nil when the key was imported in expanded form only). When present, GetEncodedKey and the seed together let the PKCS#8 encoder emit the seed-plus-expanded ("both") private-key format; see GetUseVerboseFormat.
function GetUseVerboseFormat: Boolean;
Reports the library-wide preference for the verbose PKCS#8 encoding: when True (the default) and both a seed and an expanded key are available, the encoder writes both; otherwise it writes the seed-only or expanded-only form. This is a global setting, not a per-key one.

interfaceiMPKeyList

function GetKeyCount: Integer; function GetKeys(aIndex: Integer): iUnknown; function AddKey(const aKey: iUnknown): Integer; function AddKeyIntf(const aKey: iUnknown; const aIID: TGUID): Integer; procedure Delete(aIndex: Integer); property KeyCount: Integer read GetKeyCount; property Keys[aIndex: Integer]: iUnknown read GetKeys;

interfaceiMLDSAKey

The common base of a FIPS 204 ML-DSA (Dilithium) key pair, shared by both iMLDSAPublicKey and iMLDSAPrivateKey. Exposes the parameter set and the encoded key. Applications obtain a concrete key from a decoded certificate/PKCS#8 or from the ML-DSA pool (GetDSIML) rather than implementing this interface; the same key type is used regardless of protocol role.

function GetKeySize: tMLDSASize;
The ML-DSA parameter set of this key (mldsa44/65/87). Read it to select the matching algorithm/OID or to size buffers.
function GetEncodedKey: tBytes;
GetEncodedKey contains the standard encoding of the full key, both in the case of iMLDSAPublicKey and iMLDSAPrivateKey. It corresponds to the value of the aKey argument of the respective constructor Create.

interfaceiMLDSAPrivateKey

(no public members)

interfaceiMLDSAPublicKey

inherits from iMLDSAKey

The verification (public) half of a FIPS 204 ML-DSA key pair. Adds only a cross-check against the private key; verification itself is done through the ML-DSA pool. Applications obtain one from a decoded certificate/ SubjectPublicKeyInfo or from iMLDSAPrivateKey.

function Validate(const aPrivateKey: iMLDSAPrivateKey): Boolean;
Checks that aPrivateKey matches this public key (delegates to aPrivateKey.Validate(Self), which compares this key's hash against the tr value embedded in the private key). Returns False on mismatch.

interfaceiMLDSAPrivateKey

inherits from iMLDSAKey

The signing (private) half of a FIPS 204 ML-DSA key pair. Adds the encoded public half, the expansion seed, and consistency checks to iMLDSAKey. Applications obtain one from a decoded PKCS#8 or from the ML-DSA pool and pass it to DSASign; the same key type is used on both peers.

function GetEncodedPublicKey: tBytes;
The encoded verification (public) key. The public half is optional in an ML-DSA PKCS#8, so an imported key may arrive without it; this recomputes it from the expanded key (or expands the seed) and caches the result -- needed so a key pairs with its certificate. Returns empty if neither source is present.
function GetSeed: iSecretKey;
The seed this key was expanded from (nil when the key was imported in expanded form only). When present, GetEncodedKey and the seed together let the PKCS#8 encoder emit the seed-plus-expanded ("both") private-key format; see GetUseVerboseFormat.
function Validate(const aPublicKey: iMLDSAPublicKey): Boolean;
Checks that aPublicKey matches this private key by comparing aPublicKey's hash against the 64-byte tr value stored in the encoded private key. Returns False on mismatch.
function CheckConsistency: Boolean;
Self-checks the private key's internal consistency: if a seed is present it re-derives the expanded key and compares; otherwise it re-encodes from the expanded components (and, when the stored public key is absent, recomputes and caches it). Returns False on any mismatch.
function GetUseVerboseFormat: Boolean;
Reports the library-wide preference for the verbose PKCS#8 encoding: when True (the default) and both a seed and an expanded key are available, the encoder writes both (and uses the v2 structure carrying the public key); otherwise the seed-only or expanded-only form. This is a global setting, not a per-key one.

interfaceiCompositeMLDSAPublicKey

A verification (public) key for one Composite ML-DSA algorithm. An app obtains one from iDSICS.NewSigPublicKey (importing a peer's key), from iCompositeMLDSAPrivateKey.PublicKey, or after parsing an X.509 certificate / SubjectPublicKeyInfo, and passes it to iDSICS.SigVerify.

function GetAlg: tCompositeMLDSAAlg;
Reports which composite algorithm (hence which ML-DSA level and traditional co-algorithm/OID) this key belongs to; an app reads it to pick the matching OID or to confirm a peer key is of an accepted type.
function GetEncodedKey: tBytes;
SerializePublicKey: mldsaPK || tradPK Use this when writing the key into a SubjectPublicKeyInfo / certificate or otherwise transmitting the raw public key to a peer.
property Alg: tCompositeMLDSAAlg read GetAlg;
Property form of GetAlg; see GetAlg.

interfaceiCompositeMLDSAPrivateKey

A signing (private) key for one Composite ML-DSA algorithm. An app obtains one from iDSICS.SigKeyGen (fresh key pair) or iDSICS.NewSigPrivateKey (importing a stored PKCS#8 key), and passes it to iDSICS.SigSign.

function GetAlg: tCompositeMLDSAAlg;
Reports which composite algorithm this key belongs to; an app reads it to select the matching OID or serialization layout.
function GetEncodedKey: tBytes;
SerializePrivateKey: mldsaSeed (32 bytes) || tradSK Use this to persist the private key (e.g. into a PKCS#8 OneAsymmetricKey).
function GetEncodedPublicKey: tBytes;
SerializePublicKey of the corresponding public key Convenience: the encoded public half, e.g. when writing a self-signed certificate or a PKCS#8 that carries the public key alongside the private.
function PublicKey: iCompositeMLDSAPublicKey;
Derives the matching public key (ML-DSA public plus the traditional public part -- for EC/EdDSA the point is recomputed from the scalar/seed, for RSA the modulus and exponent are taken from the private key). Use it to publish/verify or to build a certificate SubjectPublicKeyInfo without holding a separate public-key object.
property Alg: tCompositeMLDSAAlg read GetAlg;
Property form of GetAlg; see GetAlg.

interfaceiDSICS

The Composite ML-DSA pool (tDSICS in StreamSec.DSI.CompositeSig).

function OIDToAlg(const aOID: ObjectIdentifier; var aAlg: tCompositeMLDSAAlg) : Boolean; function AlgToOID(aAlg: tCompositeMLDSAAlg): ObjectIdentifier; procedure SigKeyGen(aAlg: tCompositeMLDSAAlg; var aPublicKey : iCompositeMLDSAPublicKey; var aPrivateKey: iCompositeMLDSAPrivateKey);
Generates a random composite key pair. NOTE: the RSA combinations generate a fresh RSA key, which may take a significant amount of time.
function NewSigPrivateKey(aAlg: tCompositeMLDSAAlg; const aSerialized: tBytes) : iCompositeMLDSAPrivateKey; function NewSigPublicKey(aAlg: tCompositeMLDSAAlg; const aSerialized: tBytes) : iCompositeMLDSAPublicKey; function SigSign(const aPrivateKey: iCompositeMLDSAPrivateKey; const aMsg : tBytes; const aCtx : tBytes {$IFDEF D16UP}= nil{$ENDIF}) : tBytes;
Composite-ML-DSA.Sign / .Verify with the application context aCtx (at most 255 bytes).
function SigVerify(const aPublicKey: iCompositeMLDSAPublicKey; const aMsg : tBytes; const aCtx : tBytes; const aSignature: tBytes) : Boolean;

interfaceiCompositeMLKEMPublicKey

An encapsulation (public) key for one Composite ML-KEM algorithm. An app obtains one from iDSICK.NewKEMPublicKey (importing a recipient's key), from iCompositeMLKEMPrivateKey.PublicKey, or after parsing a certificate / SubjectPublicKeyInfo, and passes it to iDSICK.Encaps to wrap a shared secret for that recipient.

function GetAlg: tCompositeMLKEMAlg;
Reports which composite algorithm (ML-KEM level plus traditional KEM/OID, or an SSH-hybrid method) this key belongs to; an app reads it to pick the matching OID or to confirm a recipient key is of an accepted type.
function GetEncodedKey: tBytes;
SerializePublicKey: mlkemPK || tradPK Use this when publishing the key in a SubjectPublicKeyInfo / certificate or transmitting it to a peer who will encapsulate to it.
property Alg: tCompositeMLKEMAlg read GetAlg;
Property form of GetAlg; see GetAlg.

interfaceiCompositeMLKEMPrivateKey

A decapsulation (private) key for one Composite ML-KEM algorithm. An app obtains one from iDSICK.KEMKeyGen (fresh key pair) or iDSICK.NewKEMPrivateKey (importing a stored PKCS#8 key), and passes it to iDSICK.Decaps to recover the shared secret from a received composite ciphertext.

function GetAlg: tCompositeMLKEMAlg;
Reports which composite algorithm this key belongs to; an app reads it to select the matching OID or serialization layout.
function GetEncodedKey: tBytes;
SerializePrivateKey: mlkemSeed (64 bytes = d || z) || tradSK Use this to persist the private key (e.g. into a PKCS#8 OneAsymmetricKey).
function GetEncodedPublicKey: tBytes;
SerializePublicKey of the corresponding public key Convenience: the encoded public half, e.g. when writing a certificate or a PKCS#8 that carries the public key alongside the private.
function PublicKey: iCompositeMLKEMPublicKey;
Derives the matching encapsulation (public) key. Use it to publish the recipient key or to build a certificate SubjectPublicKeyInfo without holding a separate public-key object.
property Alg: tCompositeMLKEMAlg read GetAlg;
Property form of GetAlg; see GetAlg.

interfaceiDSICK

The Composite ML-KEM pool (tDSICK in StreamSec.DSI.CompositeKEM).

function OIDToAlg(const aOID: ObjectIdentifier; var aAlg: tCompositeMLKEMAlg) : Boolean; function AlgToOID(aAlg: tCompositeMLKEMAlg): ObjectIdentifier; function SSHIdentifierToAlg(const aIdentifier: string; var aAlg : tCompositeMLKEMAlg): Boolean;
SSH-hybrid (RFC 10042) name <-> alg, mirroring the OID helpers. The identifier is the SSH KEX method name (e.g. 'mlkem768x25519-sha256'); only the SSH-hybrid algorithms participate.
function AlgToSSHIdentifier(aAlg: tCompositeMLKEMAlg): string; procedure KEMKeyGen(aAlg: tCompositeMLKEMAlg; var aPublicKey : iCompositeMLKEMPublicKey; var aPrivateKey: iCompositeMLKEMPrivateKey);
Generates a random composite key pair. NOTE: the RSA combinations generate a fresh RSA key, which may take a significant amount of time.
function NewKEMPrivateKey(aAlg: tCompositeMLKEMAlg; const aSerialized: tBytes) : iCompositeMLKEMPrivateKey; function NewKEMPublicKey(aAlg: tCompositeMLKEMAlg; const aSerialized: tBytes) : iCompositeMLKEMPublicKey; procedure Encaps(const aPublicKey : iCompositeMLKEMPublicKey; var aSharedSecret: tBytes; var aCiphertext : tBytes);
Composite-ML-KEM.Encaps: produces a 32-byte shared secret and the composite ciphertext (mlkemCT || tradCT).
function Decaps(const aPrivateKey : iCompositeMLKEMPrivateKey; const aCiphertext : tBytes; var aSharedSecret: tBytes) : Boolean;
Composite-ML-KEM.Decaps: recovers the 32-byte shared secret from the composite ciphertext. Returns False on a malformed ciphertext.

interfaceiSLHDSAPrivateKey

(no public members)

interfaceiSLHDSAKey

iSLHDSAKey is the common base of an SLH-DSA (FIPS 205) key pair, shared by the public (iSLHDSAPublicKey) and private (iSLHDSAPrivateKey) halves: it exposes which of the twelve parameter sets the key uses and the FIPS 205 byte encoding. Concrete classes live in StreamSec.DSI.SLHDSA; the same key type is used on both peers.

function GetAlg: tSLHDSAAlg;
Getter for Alg; see the property.
function GetEncodedKey: tBytes;
GetEncodedKey returns the standard FIPS 205 byte encoding of the full key: the public key is PK.seed||PK.root (2n bytes); the private key is SK.seed||SK.prf||PK.seed||PK.root (4n bytes).
property Alg: tSLHDSAAlg read GetAlg;
Which SLH-DSA parameter set (hash family, security category and small/fast trade-off) this key belongs to. Read it to pick the matching OID or to confirm a peer key is of an accepted type. Read-only.

interfaceiSLHDSAPublicKey

inherits from iSLHDSAKey

The public (verification) half of an SLH-DSA key pair. Adds Alg and the FIPS 205 encoding from iSLHDSAKey; obtain one from iDSISLH.NewSigPublicKey / SigKeyGen or from a decoded SubjectPublicKeyInfo, then verify signatures with it.

function Validate(const aPrivateKey: iSLHDSAPrivateKey): Boolean;
Consistency-checks this public key against aPrivateKey: True only when aPrivateKey is assigned, uses the same parameter set (Alg), and carries the same encoded public half. Use it to confirm a loaded public/private pair actually match before relying on them.

interfaceiSLHDSAPrivateKey

inherits from iSLHDSAKey

The private (signing) half of an SLH-DSA key pair. Adds the encoded public half, public-key derivation and pair validation to iSLHDSAKey. Obtain one from iDSISLH.NewSigPrivateKey / SigKeyGen or from a decoded PKCS#8, then sign with iDSISLH.SigSign.

function GetEncodedPublicKey: tBytes;
Returns the FIPS 205 byte encoding (PK.seed||PK.root, 2n bytes) of the matching public key, which is stored alongside the private key. Convenient when writing a certificate SubjectPublicKeyInfo without building a separate public-key object.
function PublicKey: iSLHDSAPublicKey;
Builds the matching public-key object from the stored public half (no recomputation from the secret key). Use it to publish or verify.
function Validate(const aPublicKey: iSLHDSAPublicKey): Boolean;
Consistency-checks this private key against aPublicKey: True only when aPublicKey is assigned, uses the same parameter set (Alg), and its encoded key equals this key's stored public half. Returns False on any mismatch.

interfaceiDSISLH

The SLH-DSA pool (tDSISLH in StreamSec.DSI.SLHDSA).

function OIDToAlg(const aOID: ObjectIdentifier; var aAlg: tSLHDSAAlg) : Boolean; function AlgToOID(aAlg: tSLHDSAAlg): ObjectIdentifier; procedure SigKeyGen(aAlg: tSLHDSAAlg; var aPublicKey : iSLHDSAPublicKey; var aPrivateKey: iSLHDSAPrivateKey); function NewSigPrivateKey(aAlg: tSLHDSAAlg; const aSerialized: tBytes) : iSLHDSAPrivateKey; function NewSigPublicKey(aAlg: tSLHDSAAlg; const aSerialized: tBytes) : iSLHDSAPublicKey; function SigSign(const aPrivateKey: iSLHDSAPrivateKey; const aMsg : tBytes; const aCtx : tBytes {$IFDEF D16UP}= nil{$ENDIF}; aDeterministic: Boolean = False) : tBytes;
SLH-DSA.Sign / .Verify with the application context aCtx (at most 255 bytes). aDeterministic = False uses the hedged (randomized) variant.
function SigVerify(const aPublicKey: iSLHDSAPublicKey; const aMsg : tBytes; const aCtx : tBytes; const aSignature: tBytes) : Boolean;

interfaceiDSIML

function NewKEMPrivateKey(aKeySize: tMLKEMSize; const aKey : tBytes; const aSeed : iSecretKey = nil) : iMLKEMPrivateKey; function NewKEMPrivateKeyFromSeed(aKeySize: tMLKEMSize; const aSeed : iSecretKey) : iMLKEMPrivateKey; function NewKEMPublicKey(aKeySize: tMLKEMSize; const aKey : tBytes) : iMLKEMPublicKey; function NewDSAPrivateKey(aKeySize: tMLDSASize; const aKey : tBytes; const aPublKey: tBytes; const aSeed : iSecretKey = nil) : iMLDSAPrivateKey; function NewDSAPrivateKeyFromSeed(aKeySize: tMLDSASize; const aSeed : iSecretKey) : iMLDSAPrivateKey; function NewDSAPublicKey(aKeySize: tMLDSASize; const aKey : tBytes) : iMLDSAPublicKey; procedure KEMKeyGen(aKeySize : tMLKEMSize; var aPublicKey : iMLKEMPublicKey; var aPrivateKey: iMLKEMPrivateKey; aSaveSeed : Boolean = False);
Generates a random key pair the ML-KEM key encapsulation mechanism. aKeySize must be mlkem512, mlkem768 or mlkem1024. The parameter aSaveSeed is an addition to FIPS-203, but necessary in order to support the IETF standard private key format.
procedure KEMEncaps(const aPublicKey: iMLKEMPublicKey; var aK : tBytes; var aC : tBytes);
Generates a random encapsulated shared secret. The shared secret is returned in aK. Keep this and use for establishing a secure channel with the owner aPublicKey. The cipher text is returned in aC. Send this (with authentication and integrity) to the owner of aPublicKey.
procedure KEMDecaps(const aPrivateKey: iMLKEMPrivateKey; const aC: tBytes; var aK: tBytes);
Decrypts a cipher text containing an encapsulated shared secret. The cipher text is passed in aC. The shared secret is returned in aK.
procedure DSAKeyGen(aKeySize : tMLDSASize; var aPublicKey : iMLDSAPublicKey; var aPrivateKey: iMLDSAPrivateKey; aSaveSeed : Boolean = False);
Generates a random key pair for the ML-DSA signature scheme. aKeySize must be mldsa44, mldsa65 or mldsa87. The parameter aSaveSeed is an addition to FIPS-204, but necessary in order to support the IETF standard private key format.
function DSASign(const aPrivateKey: iMLDSAPrivateKey; const aMsg : tBytes; const aCtx : tBytes) : tBytes;
The signing algorithm takes a private key, a message, and a context string as input. It outputs a signature that is encoded as a tBytes. The context string aCtx is optional, but might be specified on an application specific basis. aCtx must not exceed 255 octets. This is the "Pure" variant of ML-DSA.
function DSAVerify(const aPublicKey: iMLDSAPublicKey; const aMsg : tBytes; const aCtx : tBytes; const aSignature: tBytes) : Boolean;
The verification algorithm takes a public key, a message, a context string, and a signature as input. It outputs a boolean value, where true represents a valid signature, given the three other input parameters. Conversely, the method returns false if the signature is not valid, given the other three input parameters. This is the "Pure" variant of ML-DSA.
function HashDSASign(const aPrivateKey: iMLDSAPrivateKey; const aMsg : tBytes; const aCtx : tBytes; const aHashAlg : tHashAlgorithm) : tBytes;
The signing algorithm takes a private key, a message, a context string, and a hash algorithm identifier as input. It outputs a signature that is encoded as a tBytes. The context string aCtx is optional, but might be specified on an application specific basis. aCtx must not exceed 255 octets. This is the "Pre Hash" variant of ML-DSA.
function HashDSASignDigest(const aPrivateKey: iMLDSAPrivateKey; const aDigest : tBytes; const aCtx : tBytes; const aHashAlg : tHashAlgorithm) : tBytes;
The HashDSASignDigest method does the same as HashDSASign, except that it takes a hash digest of the message to be signed as input, instead of the message itself. The value in aDigest has to be generated using the hash algorithm specified in aHashAlg, has to be an uneconded octet string of the digest, and has to have the correct length.
function HashDSAVerify(const aPublicKey: iMLDSAPublicKey; const aMsg : tBytes; const aCtx : tBytes; const aHashAlg : tHashAlgorithm; const aSignature: tBytes) : Boolean;
The verification algorithm takes a public key, a message, a context string, a hash algorithm identifier, and a signature as input. It outputs a boolean value, where true represents a valid signature, given the three other input parameters. Conversely, the method returns false if the signature is not valid, given the other three input parameters. This is the "Pre Hash" variant of ML-DSA.
function HashDSAVerifyDigest(const aPublicKey: iMLDSAPublicKey; const aDigest : tBytes; const aCtx : tBytes; const aHashAlg : tHashAlgorithm; const aSignature: tBytes) : Boolean;
The HashDSAVerifyDigest method does the same as HashDSAVerify, except that it takes a hash digest of the message to be signed as input, instead of the message itself. The value in aDigest has to be generated using the hash algorithm specified in aHashAlg, has to be an uneconded octet string of the digest, and has to have the correct length.
procedure SetUseVerboseFormat(Value: Boolean); function GetUseVerboseFormat: Boolean; property UseVerboseFormat: Boolean read GetUseVerboseFormat write SetUseVerboseFormat;

classtAbstractMPPrivateKey

inherits from TInterfacedObject

implements iMPPK, iMPPrivateKey

constructor Create(const aPublicKey: iMPPublicKey);

classtMPPrivateKeyIF

tMPIFPrivateKeyIF is a wrapper for iIFPrivateKey. tMPIFPrivateKeyIF implements the iMPPrivateKey interface. The methods and properties of this class defaults to use the properties of the *public* key that is passed to the constructor. Furthermore, the parameters that are used for RSA signing/verification and encryption/decryption are specific to the tMPIFPrivateKeyIF instance and are NOT reflected by the properties of the wrapped iIPPrivateKey instance. This makes makes it thread safe to use instances of this class even if the wrapped iIFPrivateKey is shared by multiple threads.

constructor Create(const aKey : iIFPrivateKey; const aPublicKey: iMPPublicKey);

classtMPPrivateKeyDL

constructor Create(const aKey : iDLPrivateKey; const aPublicKey: iMPPublicKey);

classtMPPrivateKeyGeneric

inherits from tAbstractMPPrivateKey

constructor Create(const aKey : iUnknown; const aPublicKey: iMPPublicKey);

classtAbstractDSIArith

inherits from tOptionallyRefCountedObject

(no public members)

Types (enumerations, sets, aliases)

enumtKeyUsageEnum

X.509 KeyUsage (RFC 5280 sec. 4.2.1.3). The enum order IS the on-the-wire bit order of the KeyUsage BIT STRING: DigitalSignature is bit 0 (the most significant bit of the first content octet), through DecipherOnly at bit 8. DO NOT reorder or insert members - the ordinal doubles as the DER bit position, and the certificate KeyUsage extension, the PKCS#8 / PKCS#12 key-usage attributes and the TLS / CryptoAPI key-selection code all rely on that correspondence. Declared here (rather than in stPkixExtension, its historical home) so that key-format units such as StreamSec.DSI.Pkcs8 can express a key's permitted usages without importing the full PKIX certificate-extension / GeneralName machinery. stPkixExtension re-exports tKeyUsageEnum / tKeyUsage as aliases, so existing consumers that reference them through that unit are unaffected.

  tKeyUsageEnum = (DigitalSignature,
                   NonRepudiation,
                   KeyEncipherment,
                   DataEncipherment,
                   KeyAgreement,
                   KeyCertSign,
                   CRLSign,
                   EncipherOnly,
                   DecipherOnly);

settKeyUsage

  tKeyUsage = set of tKeyUsageEnum;

enumtUseAlgorithm

  tUseAlgorithm = (uaDefault,uaTargetSpecified,uaSourceSpecified);

enumtIFScheme

  tIFScheme = (ifRSA1, ifRSA2,ifRW);

enumtSignEncoding

  tSignEncoding = (seEMSA2,      // As defined in P1363
                   seEMSA3,      // PKCS#1v1.5
                   seEMSA4,      // PKCS#1v2.1 (RSASSA-PSS)
                   seEMSA_TLS,   // TLS (PKCS#1v1.5 with no hash identifier and
                                 //      two digest values)
                   seNotSupported// Key used exclusively for encryption
                   );

settSignEncodings

  tSignEncodings = set of tSignEncoding;

enumtEncryptEncoding

  tEncryptEncoding = (eeEME1,           // PKCS#1v2.1 (RSAES-OAEP)
                      eeEME_PKCS1_v1_5, // PKCS#1v1.5
                      eeNotSupported);  // Key used exclusively for signing

enumtKeyDerivation

  tKeyDerivation = (kdKDF1,
                    kdKDF2,
                    kdX9_42ASN1BER,
                    kdX9_42Concatenation,
                    kdNone);

enumtDLSignatureScheme

dlssaDSAFixedTime: same wire format as dlssaDSA (ECDSA/DSA), but signed via the fixed-time path (RFC 6979 deterministic nonce + constant-time group operation + Fermat inverse). Added LAST so existing ordinals (serialized as 0..3) are stable.
dlssaEdDSA: EdDSA (RFC 8032) over Ed25519/Ed448. EdDSA signs the MESSAGE (no pre-hash), so it is handled exclusively by the message overloads of SSASignatureGeneration/SSASignatureVerification, and exclusively with the seed-based EdDSA keys (iEdDSAPrivateKey/iEdDSAPublicKey; concrete classes in StreamSec.DSI.EdDSA). The legacy 2-bit kind mask in the deprecated StreamSec.DSI.FFC.PrivateKeyStrSecStorage unit does not constrain this value.

  tDLSignatureScheme = (dlssaDSA,dlssaNR,dlSSADSA_P1363,dlssaDSAFixedTime,dlssaEdDSA);

typetExternalDLPrivateKeyClass

  tExternalDLPrivateKeyClass = class of tExternalDLPrivateKey;

typetDSIKeyExchangeClass

  tDSIKeyExchangeClass = class of tDSIKeyExchange;

enumtECP2OSFormat

  tECP2OSFormat = (cDefault,cCompressed,cUncompressed,cHybrid);

typetExternalIFPrivateKeyClass

  tExternalIFPrivateKeyClass = class of tExternalIFPrivateKey;

enumtIFKeyGenerationKindEnum

  tIFKeyGenerationKindEnum = (ifkgProvable,     // Both P and Q are provably prime
                              ifkgNIST,         // NIST FIPS 186-4 compliance
                              ifkgStrongPrime,  // P-1,Q-1,P+1,Q+1 have large prime factors
                              ifkgExportable,   // P and Q same size, implied by ifkgNIST
                              ifkgSignatureKey);// Key pair for signature generation (key transport if not set)

settIFKeyGenerationKind

  tIFKeyGenerationKind = set of tIFKeyGenerationKindEnum;

enumtTrailerFieldEnum

  tTrailerFieldEnum = (tfBC,tfCC);

settTrailerFields

  tTrailerFields = set of tTrailerFieldEnum;

enumtMLKEMSize

  tMLKEMSize = (mlkemAuto,mlkem512,mlkem768,mlkem1024);

enumtMLDSASize

  tMLDSASize = (mldsaAuto,mldsa44,mldsa65,mldsa87);

enumtCompositeMLDSAAlg

Composite ML-DSA (draft-ietf-lamps-pq-composite-sigs-19): ML-DSA paired with a traditional signature algorithm. The Brainpool combinations are not implemented. The concrete classes live in StreamSec.DSI.CompositeSig; obtain the pool via GetDSICS.

  tCompositeMLDSAAlg = (cmaUndefined,
                        cmaMLDSA44_RSA2048_PSS,     // 1.3.6.1.5.5.7.6.37
                        cmaMLDSA44_RSA2048_PKCS15,  // 1.3.6.1.5.5.7.6.38
                        cmaMLDSA44_Ed25519,         // 1.3.6.1.5.5.7.6.39
                        cmaMLDSA44_ECDSA_P256,      // 1.3.6.1.5.5.7.6.40
                        cmaMLDSA65_RSA3072_PSS,     // 1.3.6.1.5.5.7.6.41
                        cmaMLDSA65_RSA3072_PKCS15,  // 1.3.6.1.5.5.7.6.42
                        cmaMLDSA65_RSA4096_PSS,     // 1.3.6.1.5.5.7.6.43
                        cmaMLDSA65_RSA4096_PKCS15,  // 1.3.6.1.5.5.7.6.44
                        cmaMLDSA65_ECDSA_P256,      // 1.3.6.1.5.5.7.6.45
                        cmaMLDSA65_ECDSA_P384,      // 1.3.6.1.5.5.7.6.46
                        cmaMLDSA65_Ed25519,         // 1.3.6.1.5.5.7.6.48
                        cmaMLDSA87_ECDSA_P384,      // 1.3.6.1.5.5.7.6.49
                        cmaMLDSA87_Ed448,           // 1.3.6.1.5.5.7.6.51
                        cmaMLDSA87_RSA3072_PSS,     // 1.3.6.1.5.5.7.6.52
                        cmaMLDSA87_RSA4096_PSS,     // 1.3.6.1.5.5.7.6.53
                        cmaMLDSA87_ECDSA_P521);     // 1.3.6.1.5.5.7.6.54

enumtCompositeMLKEMAlg

Composite ML-KEM (draft-ietf-lamps-pq-composite-kem-14): ML-KEM-768/1024 paired with a traditional KEM (RSA-OAEP, ECDH over the NIST curves, or X25519/X448). The Brainpool combinations are not implemented (the enum slots are retained so the OIDs parse, but key generation and encapsulation raise). The concrete classes live in StreamSec.DSI.CompositeKEM; obtain the pool via GetDSICK.

  tCompositeMLKEMAlg = (cmkUndefined,
                        cmkMLKEM768_RSA2048,        // 1.3.6.1.5.5.7.6.55
                        cmkMLKEM768_RSA3072,        // 1.3.6.1.5.5.7.6.56
                        cmkMLKEM768_RSA4096,        // 1.3.6.1.5.5.7.6.57
                        cmkMLKEM768_X25519,         // 1.3.6.1.5.5.7.6.58
                        cmkMLKEM768_ECDH_P256,      // 1.3.6.1.5.5.7.6.59
                        cmkMLKEM768_ECDH_P384,      // 1.3.6.1.5.5.7.6.60
                        cmkMLKEM768_ECDH_BP256,     // 1.3.6.1.5.5.7.6.61 (n/i)
                        cmkMLKEM1024_RSA3072,       // 1.3.6.1.5.5.7.6.62
                        cmkMLKEM1024_ECDH_P384,     // 1.3.6.1.5.5.7.6.63
                        cmkMLKEM1024_ECDH_BP384,    // 1.3.6.1.5.5.7.6.64 (n/i)
                        cmkMLKEM1024_X448,          // 1.3.6.1.5.5.7.6.65
                        cmkMLKEM1024_ECDH_P521,     // 1.3.6.1.5.5.7.6.66
                        { SSH hybrid key exchange (RFC 10042):
                          no PKIX OID; identified by the SSH KEX method name and
                          combined with the SSH combiner (HASH(K_PQ||K_CL)). }
                        cmkSSHMLKEM768X25519,       // mlkem768x25519-sha256
                        cmkSSHMLKEM768P256,         // mlkem768nistp256-sha256
                        cmkSSHMLKEM1024P384);       // mlkem1024nistp384-sha384

enumtSLHDSAAlg

SLH-DSA (FIPS 205): stateless hash-based signatures. Twelve parameter sets over two hash families (SHA2 / SHAKE), three security categories (128/192/ 256) and a small (s) / fast (f) trade-off. Pure SLH-DSA only (the HashSLH-DSA pre-hash variants are not implemented). The concrete classes live in StreamSec.DSI.SLHDSA; obtain the pool via GetDSISLH.

  tSLHDSAAlg = (slhAuto,
                slhSHA2_128s,   // 2.16.840.1.101.3.4.3.20
                slhSHA2_128f,   // 2.16.840.1.101.3.4.3.21
                slhSHA2_192s,   // 2.16.840.1.101.3.4.3.22
                slhSHA2_192f,   // 2.16.840.1.101.3.4.3.23
                slhSHA2_256s,   // 2.16.840.1.101.3.4.3.24
                slhSHA2_256f,   // 2.16.840.1.101.3.4.3.25
                slhSHAKE_128s,  // 2.16.840.1.101.3.4.3.26
                slhSHAKE_128f,  // 2.16.840.1.101.3.4.3.27
                slhSHAKE_192s,  // 2.16.840.1.101.3.4.3.28
                slhSHAKE_192f,  // 2.16.840.1.101.3.4.3.29
                slhSHAKE_256s,  // 2.16.840.1.101.3.4.3.30
                slhSHAKE_256f); // 2.16.840.1.101.3.4.3.31

proctGetPKIFunc

  tGetPKIFunc = function(const aKey: IUnknown): OctetString;

typetDSIArithClass

  tDSIArithClass = class of tAbstractDSIArith;

Routines