|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--spki.BaseObj
|
+--spki.PrivateKey
This class represents a private signature key object. It provides everything a user needs to employ the key for signing signatures.
Formal definition:
<alg-id>:: <byte-string> | <uri> ;
<pub-sig-alg-id>:: <alg-id> ;
<pub-key-hash>:: <hash> ;
<priv-key>:: "(" "priv-key" "(" <pub-sig-alg-id> <s-expr>+ ")" <pub-key-hash> ")" ;
The RSA-keys S-Expression must contain the following s-expressions tokens: n and d, of the form (<token> <keydata>).
NOTE: algorithm-ID is implemented as String for now. NOTE: only rsa-pkcs1-sha1 is supported for now.
TODO: implement algorithm-ID as <byte-string> and <uris>.
PublicKey,
Signature| Field Summary | |
private static String |
__ME
This class's full name. |
private String |
cachedKeyId
Cached key-id. |
private PrivateKey |
jca_key
The key, used by JCA. |
private Hash |
pub_hash
The hash of the corresponding public key. |
static String |
SEXP_NAME
This class S-Expression type name, used by toSExpression() and other methods. |
private Signature |
sig
Signature object used for signing. |
private String |
sig_alg_id
Signature algorithm ID. |
private String |
signature_provider
Signature Provider ID. |
| Fields inherited from class spki.BaseObj |
__ME,
cache_sexp,
cached_sexp,
DEFAULT_HASH_ALG,
locked,
SEXP_NAME |
| Constructor Summary | |
protected |
PrivateKey()
Don't use me! |
|
PrivateKey(PrivateKey pk,
Hash pub_hash)
Create an immutable PrivateKey from a java.security.PrivateKey object. |
|
PrivateKey(SExpression sexp)
Create an immutable PrivateKey object from an S-Expression. |
| Method Summary | |
String |
getAlgId()
Get the SPKI encryption/signature algorithm id associated with the key. |
Key |
getJCAKey()
Get a key object usable by [I]JCA packages. |
Hash |
getKeyHash()
Get a Hash representing this key using the default hash algorithm. |
Hash |
getKeyHash(String hashAlg)
Get a Hash representing this key using the specified hashing algorithm. |
String |
getKeyId()
Get the key-id of this key. |
Signature |
sign(byte[] input)
Sign a byte-array using this private key. |
Signature |
sign(Hash hash)
Sign a Hash object using this private key. |
SExpression |
toSExpression()
Build an SExpression representing this object. |
| Methods inherited from class spki.BaseObj |
disableSExpressionCaching,
enableSExpressionCaching,
extractHashAlgId,
getCachedSExpression,
isLocked,
isSListOfType,
lock,
providerToSPKI,
setCachedSExpression,
spkiToProvider,
toString |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private static final String __ME
public static final String SEXP_NAME
toSExpression()private PrivateKey jca_key
private String sig_alg_id
private String signature_provider
private Hash pub_hash
private Signature sig
private String cachedKeyId
getKeyId()| Constructor Detail |
protected PrivateKey()
PrivateKey(SExpression),
PrivateKey(java.security.PrivateKey,spki.Hash)
public PrivateKey(SExpression sexp)
throws SPKIException,
ParseException
BaseObj.BaseObj(SExpression)
public PrivateKey(PrivateKey pk,
Hash pub_hash)
throws SPKIException
pk - Object implementing the java.security.PrivateKey interface.pub_hash - Hash object of the corresponding public key.| Method Detail |
public SExpression toSExpression()
throws SPKIException
BaseObj.toSExpression()public String getAlgId()
public Key getJCAKey()
public Hash getKeyHash()
public Hash getKeyHash(String hashAlg)
hashAlg - hashing algorithm-id to use.
public String getKeyId()
throws SPKIException
public final Signature sign(Hash hash)
throws SPKIException
hash - the Hash object to be signed.Signature
public final Signature sign(byte[] input)
throws SPKIException
input - the byte-array to be signed.sign(Hash),
Signature
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||