Class ElgamalEncSpec
java.lang.Object
zeroecho.core.alg.elgamal.ElgamalEncSpec
- All Implemented Interfaces:
Describable, ContextSpec
ElGamal Encryption Parameters
Specification for configuring ElGamal encryption contexts.
ElgamalEncSpec selects the padding mode to apply when transforming
plaintext into group elements for ElGamal encryption. This affects both
security properties and maximum plaintext block size.
Note: OAEP is not offered for ElGamal; for modern IND-CCA security prefer KEM or KEM-DEM constructions such as DHIES, ECIES, or Cramer-Shoup, or use a KEM provided elsewhere in the catalog.
Padding modes
ElgamalEncSpec.Padding.NOPADDING- raw ElGamal encryption of messages less than the modulusp. Provides minimal security (plaintexts are only randomized by ephemeral exponent) and must not be used directly in modern protocols without additional safeguards (e.g., hybrid encryption or KEM construction).ElgamalEncSpec.Padding.PKCS1- PKCS#1 v1.5-style padding applied to the plaintext before encryption. Adds structural redundancy and prevents trivial small-subgroup attacks. Still considered outdated for new protocols but available for compatibility.
Usage
Instances are created via the static factories:ElgamalEncSpec spec = ElgamalEncSpec.pkcs1();
EncryptionContext ctx = algo.createContext(KeyUsage.ENCRYPT, pubKey, spec);
Thread-safety
ElgamalEncSpec is immutable and safe to share
across threads.- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSupported padding modes for ElGamal encryption. -
Method Summary
Modifier and TypeMethodDescriptionHuman-readable description of this spec.static ElgamalEncSpecReturns anElgamalEncSpecwith no padding.padding()Returns the selected padding mode.static ElgamalEncSpecpkcs1()Returns anElgamalEncSpecwith PKCS#1 v1.5-style padding.
-
Method Details
-
noPadding
Returns anElgamalEncSpecwith no padding.- Returns:
- specification with
ElgamalEncSpec.Padding.NOPADDING
-
pkcs1
Returns anElgamalEncSpecwith PKCS#1 v1.5-style padding.- Returns:
- specification with
ElgamalEncSpec.Padding.PKCS1
-
padding
Returns the selected padding mode.- Returns:
- padding enumeration value
-
description
Human-readable description of this spec.Matches the transformation string used by the JCA provider (e.g.,
"NOPADDING"or"PKCS1Padding").- Specified by:
descriptionin interfaceDescribable- Returns:
- descriptive string for this padding mode
-