Class SignatureInteropProfile
java.lang.Object
zeroecho.core.alg.common.sig.SignatureInteropProfile
Describes how a standard signature algorithm identifier maps to a concrete
ZeroEcho signature context.
Standard external ecosystems such as X.509, PKCS#10, JCA, OpenSSL, or remote
APIs often identify signature algorithms with canonical names such as
SHA256withRSA, SHA384withECDSA, or Ed25519. ZeroEcho,
by contrast, separates the key algorithm from the per-operation
ContextSpec. This immutable helper bridges the two worlds by carrying
all information needed to:
- import or compare the correct public-key algorithm,
- create a ZeroEcho signature context with an explicit, deterministic
ContextSpec, and - translate signature bytes between an external representation and the internal ZeroEcho representation when the two differ.
Representation model
For RSA PKCS#1 v1.5, RSA-PSS, Ed25519, and Ed448, the external and internal
signature bytes are identical. ECDSA is different: X.509/JCA normally use
ASN.1 DER encoded SEQUENCE { r, s }, while ZeroEcho ECDSA contexts
use fixed-length IEEE P1363 bytes (r || s). The
SignatureInteropProfile.SignatureRepresentation enum models this distinction explicitly.
Security notes
- This class never stores key material, plaintext, or signatures beyond the arguments passed to conversion methods.
- Conversion methods validate structure and length to prevent silent format confusion.
- The carried
ContextSpecmust be treated as part of algorithm semantics, not as an optional hint.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSignature byte representation bridging policy. -
Constructor Summary
ConstructorsConstructorDescriptionSignatureInteropProfile(String requestedAlgorithmId, String keyAlgorithmId, String contextAlgorithmId, ContextSpec contextSpec, SignatureInteropProfile.SignatureRepresentation signatureRepresentation, int internalSignatureLength) Creates a profile. -
Method Summary
Modifier and TypeMethodDescriptionReturns the ZeroEcho context algorithm identifier.Returns the explicit ZeroEcho context specification.byte[]externalToInternalSignature(byte[] signature) Converts external signature bytes into the internal ZeroEcho representation.byte[]internalToExternalSignature(byte[] signature) Converts internal ZeroEcho signature bytes into the external representation.Returns the ZeroEcho key algorithm identifier.Returns the caller-visible signature algorithm identifier.Returns the representation bridge used for signature bytes.
-
Constructor Details
-
SignatureInteropProfile
public SignatureInteropProfile(String requestedAlgorithmId, String keyAlgorithmId, String contextAlgorithmId, ContextSpec contextSpec, SignatureInteropProfile.SignatureRepresentation signatureRepresentation, int internalSignatureLength) Creates a profile.- Parameters:
requestedAlgorithmId- caller-visible algorithm identifier such asSHA256withRSAkeyAlgorithmId- ZeroEcho key algorithm identifier used for key import and matching, such asRSAcontextAlgorithmId- ZeroEcho context algorithm identifier used withZeroEchoSession.createContext(...)contextSpec- explicit ZeroEcho context specificationsignatureRepresentation- signature representation bridge between external bytes and internal ZeroEcho bytesinternalSignatureLength- fixed internal signature length in bytes when representation conversion requires it; set to0for identity representations
-
-
Method Details
-
requestedAlgorithmId
Returns the caller-visible signature algorithm identifier.- Returns:
- canonical requested algorithm id
-
keyAlgorithmId
Returns the ZeroEcho key algorithm identifier.- Returns:
- key algorithm id used for key import and key-class matching
-
contextAlgorithmId
Returns the ZeroEcho context algorithm identifier.- Returns:
- context algorithm id used to create signature contexts
-
contextSpec
Returns the explicit ZeroEcho context specification.- Returns:
- non-null signature context spec
-
signatureRepresentation
Returns the representation bridge used for signature bytes.- Returns:
- representation policy
-
externalToInternalSignature
public byte[] externalToInternalSignature(byte[] signature) Converts external signature bytes into the internal ZeroEcho representation.- Parameters:
signature- external signature bytes- Returns:
- internal signature bytes suitable for ZeroEcho verification contexts
- Throws:
IllegalArgumentException- if the supplied bytes do not match the expected external representation
-
internalToExternalSignature
Converts internal ZeroEcho signature bytes into the external representation.- Parameters:
signature- internal ZeroEcho signature bytes- Returns:
- external signature bytes suitable for X.509, PKCS#10, or JCA callers
- Throws:
IOException- if DER encoding failsIllegalArgumentException- if the supplied bytes do not match the expected internal representation
-