public class SM9SigUserPrivateKeySpec
extends java.security.spec.EncodedKeySpec
KeyFactory.SM9. The encoding alone does
not determine a usable key - the signer also needs the signature master public
key and the identity, neither of which is part of it - so the spec carries all
three, letting a stored user key be reconstituted without access to the master
private key.
This extends EncodedKeySpec rather than PKCS8EncodedKeySpec:
the encoded bytes are a real PKCS#8 encoding (reflected in getFormat()), but the
spec is not self-sufficient the way a plain PKCS8EncodedKeySpec is meant to be, and
subclassing the concrete JDK type would let generic code treat it as one.
The matching spec is returned by the factory's getKeySpec method, so a
user key round-trips: store getEncoded() (or ask for this spec), rebuild
with generatePrivate. The verification side needs no spec - a user's
public key is derived from the master public key and the identity via
SM9SigMasterPublicKey.getUserPublicKey(byte[]).
| Constructor and Description |
|---|
SM9SigUserPrivateKeySpec(byte[] pkcs8Encoding,
SM9SigMasterPublicKey masterPublicKey,
byte[] identity) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getFormat() |
byte[] |
getIdentity() |
SM9SigMasterPublicKey |
getMasterPublicKey() |
public SM9SigUserPrivateKeySpec(byte[] pkcs8Encoding,
SM9SigMasterPublicKey masterPublicKey,
byte[] identity)
pkcs8Encoding - the user private key's PKCS#8 encoding, as returned by
the key's getEncoded().masterPublicKey - the signature master public key the user key was derived under.identity - the user's identity.public SM9SigMasterPublicKey getMasterPublicKey()
public byte[] getIdentity()
public java.lang.String getFormat()
getFormat in class java.security.spec.EncodedKeySpec