Package org.bouncycastle.crypto.signers
Class ECCSISigner
- java.lang.Object
-
- org.bouncycastle.crypto.signers.ECCSISigner
-
-
Constructor Summary
Constructors Constructor Description ECCSISigner(ECPoint kpak, X9ECParameters params, Digest digest, byte[] id)
Constructs an ECCSI signer/verifier with KMS Public Authentication Key and user identity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
generateSignature()
Generates an ECCSI signature according to RFC 6507 Section 5.2.1.void
init(boolean forSigning, CipherParameters param)
Initializes the signer for either signature generation or verification.void
reset()
Resets the signer/verifier state and performs initial computations: - For signing: Validates KPAK consistency (RFC 6507 Section 5.1.2) - For verification: Computes Y = HS·PVT + KPAK Also computes HS = hash(G || KPAK || ID || PVT) as per RFC 6507 Section 5.1.1void
update(byte b)
update the internal digest with the byte bvoid
update(byte[] in, int off, int len)
update the internal digest with the byte array inboolean
verifySignature(byte[] signature)
Verifies an ECCSI signature according to RFC 6507 Section 5.2.2.
-
-
-
Constructor Detail
-
ECCSISigner
public ECCSISigner(ECPoint kpak, X9ECParameters params, Digest digest, byte[] id)
Constructs an ECCSI signer/verifier with KMS Public Authentication Key and user identity.- Parameters:
kpak
- KMS Public Authentication Key (KPAK) from RFC 6507 Section 2id
- User identity byte array formatted
-
-
Method Detail
-
init
public void init(boolean forSigning, CipherParameters param)
Initializes the signer for either signature generation or verification.- Specified by:
init
in interfaceSigner
- Parameters:
forSigning
- true for signing, false for verificationparam
- Key parameters: - For signing:ParametersWithRandom
containingECCSIPrivateKeyParameters
- For verification:ECCSIPublicKeyParameters
- Throws:
java.lang.IllegalArgumentException
- if invalid parameters are provided
-
update
public void update(byte b)
Description copied from interface:Signer
update the internal digest with the byte b
-
update
public void update(byte[] in, int off, int len)
Description copied from interface:Signer
update the internal digest with the byte array in
-
generateSignature
public byte[] generateSignature() throws CryptoException, DataLengthException
Generates an ECCSI signature according to RFC 6507 Section 5.2.1.- Specified by:
generateSignature
in interfaceSigner
- Returns:
- Signature structure containing: - r (N bytes) - s (N bytes) - PVT (Public Validation Token)
- Throws:
CryptoException
- if cryptographic operations failDataLengthException
- if input data is invalidjava.lang.IllegalArgumentException
- if invalid SSK or j parameter is detected
-
verifySignature
public boolean verifySignature(byte[] signature)
Verifies an ECCSI signature according to RFC 6507 Section 5.2.2.- Specified by:
verifySignature
in interfaceSigner
- Parameters:
signature
- Signature to verify (r || s || PVT)- Returns:
- true if signature is valid, false otherwise
- Throws:
java.lang.IllegalArgumentException
- if signature format is invalid
-
reset
public void reset()
Resets the signer/verifier state and performs initial computations: - For signing: Validates KPAK consistency (RFC 6507 Section 5.1.2) - For verification: Computes Y = HS·PVT + KPAK Also computes HS = hash(G || KPAK || ID || PVT) as per RFC 6507 Section 5.1.1
-
-