Bouncy Castle Cryptography Library 1.87

org.bouncycastle.jcajce.spec
Class SM9SigUserPrivateKeySpec

java.lang.Object
  extended byjava.security.spec.EncodedKeySpec
      extended byorg.bouncycastle.jcajce.spec.SM9SigUserPrivateKeySpec
All Implemented Interfaces:
java.security.spec.KeySpec

public class SM9SigUserPrivateKeySpec
extends java.security.spec.EncodedKeySpec

Key spec for rebuilding a user's SM9 signature private key (ds_A, GM/T 0044.2) from its PKCS#8 encoding through . 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 method, so a user key round-trips: store (or ask for this spec), rebuild with . 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 Summary
SM9SigUserPrivateKeySpec(byte[] pkcs8Encoding, SM9SigMasterPublicKey masterPublicKey, byte[] identity)
           
 
Method Summary
 java.lang.String getFormat()
           
 byte[] getIdentity()
           
 SM9SigMasterPublicKey getMasterPublicKey()
           
 
Methods inherited from class java.security.spec.EncodedKeySpec
getEncoded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SM9SigUserPrivateKeySpec

public SM9SigUserPrivateKeySpec(byte[] pkcs8Encoding,
                                SM9SigMasterPublicKey masterPublicKey,
                                byte[] identity)
Parameters:
pkcs8Encoding - the user private key's PKCS#8 encoding, as returned by the key's .
masterPublicKey - the signature master public key the user key was derived under.
identity - the user's identity.
Method Detail

getMasterPublicKey

public SM9SigMasterPublicKey getMasterPublicKey()

getIdentity

public byte[] getIdentity()

getFormat

public java.lang.String getFormat()

Bouncy Castle Cryptography Library 1.87