Class Ed448SignatureContext
java.lang.Object
zeroecho.core.alg.common.eddsa.CommonEdDSASignatureContext
zeroecho.core.alg.ed448.Ed448SignatureContext
- All Implemented Interfaces:
Closeable, AutoCloseable, CryptoContext, SignatureContext, TagEngine<Signature>
Signature context for Ed448 with a fixed 114-byte tag length.
This class binds the Ed448 algorithm to SignatureContext via
CommonEdDSASignatureContext. Internally it configures a JCA
Signature with the name "Ed448" and delegates all streaming
and verification behavior to the common adapter.
Algorithm characteristics
- JCA signature name:
"Ed448". - Fixed signature length: 114 bytes (reported by
CommonEdDSASignatureContext.tagLength()). - Edwards-curve Digital Signature Algorithm as specified in RFC 8032.
Usage
One-shot API
// Sign
PrivateKey priv = ...;
SignatureContext signer =
new Ed448SignatureContext(CryptoAlgorithms.require("Ed448"), priv);
signer.update(message);
byte[] sig = signer.sign();
// Verify
PublicKey pub = ...;
SignatureContext verifier =
new Ed448SignatureContext(CryptoAlgorithms.require("Ed448"), pub);
verifier.update(message);
boolean ok = verifier.verify(sig);
Streaming pipeline (wrap)
// SIGN mode: body bytes followed by 114-byte signature trailer
try (SignatureContext ctx =
new Ed448SignatureContext(CryptoAlgorithms.require("Ed448"), priv);
InputStream in = ctx.wrap(upstream)) {
in.transferTo(out);
}
// VERIFY mode: supply expected signature; verification occurs at EOF
try (SignatureContext ctx =
new Ed448SignatureContext(CryptoAlgorithms.require("Ed448"), pub)) {
ctx.setExpectedTag(expectedSig);
try (InputStream in = ctx.wrap(bodyWithoutTrailer)) {
in.transferTo(java.io.OutputStream.nullOutputStream());
}
}
Thread-safety
Instances are stateful and not thread-safe. Use one context per signing or
verification operation, and call wrap(...) at most once per instance.
- Since:
- 1.0
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionEd448SignatureContext(CryptoAlgorithm algorithm, PrivateKey privateKey) Constructs a signing context bound to the given private key.Ed448SignatureContext(CryptoAlgorithm algorithm, PublicKey publicKey) Constructs a verification context bound to the given public key. -
Method Summary
Methods inherited from class CommonEdDSASignatureContext
algorithm, close, getVerificationCore, key, setExpectedTag, setVerificationApproach, tagLength, wrap
-
Constructor Details
-
Ed448SignatureContext
public Ed448SignatureContext(CryptoAlgorithm algorithm, PrivateKey privateKey) throws GeneralSecurityException Constructs a signing context bound to the given private key.- Parameters:
algorithm- parent algorithm descriptor; must not benullprivateKey- Ed448 private key; must not benull- Throws:
GeneralSecurityException- if the underlying JCA engine cannot be initializedNullPointerException- if any argument isnull
-
Ed448SignatureContext
public Ed448SignatureContext(CryptoAlgorithm algorithm, PublicKey publicKey) throws GeneralSecurityException Constructs a verification context bound to the given public key.- Parameters:
algorithm- parent algorithm descriptor; must not benullpublicKey- Ed448 public key; must not benull- Throws:
GeneralSecurityException- if the underlying JCA engine cannot be initializedNullPointerException- if any argument isnull
-