|
Oracle Security Developer Tools Crypto Java API Reference 10g Release 2 (10.1.2.0.2) B15565-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.security.crypto.core.Signature
oracle.security.crypto.core.DSA
The DSA signature algorithm, a.k.a. DSS, as described in X9.30 Part 1.
The encoding of signatures conforms to the following ASN.1 structure, defined in the PKIX draft:
Dss-Sig-Value ::= SEQUENCE { r INTEGER, s INTEGER }
This class defines some constant OIDs for use in ASN1 keys and signatures (e.g., for certificates or CRLs). This is done using methods DSAPublicKey.setKeyAlgOID()
, DSAPrivateKey.setKeyAlgOID()
, and DSAPrivateKey.setSigAlgOID()
. Note that no matter what OID you specify, the underlying signature algorithm is still the same (i.e., DSA with SHA-1).
dsaKeyOldOID
and dsaSigOldOID
are the OIDs used by Sun's DSA implementation in JDK 1.1 (in particular, for applet signing certificates). dsaSigOldOID2
is the OID used by SSLeay before version 0.9.0. dsaKeyOID
and dsaSigOID
are the OIDs specified in the IETF PKIX draft for the certificate profile, and they are the ones most likely to be used in future applications. dsaSigOID
is supported by SSLeay since version 0.9.0.
The defaults are dsaKeyOID
and dsaSigOID
.
Field Summary | |
static ASN1ObjectID |
dsaKeyOID An ASN.1 OID which identifies DSA keys. |
static ASN1ObjectID |
dsaKeyOldOID An ASN.1 OID which identifies the DSA signature keys. |
static ASN1ObjectID |
dsaSigOID An ASN.1 OID with identifies the DSA signature algorithm. |
static ASN1ObjectID |
dsaSigOldOID An ASN.1 OID with identifies the DSA signature algorithm. |
static ASN1ObjectID |
dsaSigOldOID2 An ASN.1 OID with identifies the DSA signature algorithm. |
Fields inherited from class oracle.security.crypto.core.Signature |
document, signatureBytes |
Constructor Summary | |
DSA() Creates a new, uninitialized DSA signature object, with no keys defined. |
|
DSA(DSAPrivateKey priv, byte[] doc) Creates a new instance, and generates the signature for the given document. |
|
DSA(DSAPrivateKey priv, RandomBitsSource rbs, byte[] doc) Creates a new instance, and generates the signature for the given document with the given random bits source. |
|
DSA(DSAPublicKey pk) Creates a new instance, which will use the specified public key. |
|
DSA(DSAPublicKey pubKey, byte[] sigBytes, byte[] doc) Creates a new instance, and initializes for verification. |
|
DSA(DSAPublicKey pub, DSAPrivateKey priv) Creates a new instance, which will use the specified public key and private key. |
|
DSA(DSAPublicKey pub, DSAPrivateKey priv, byte[] doc) Produces a signature on a document. |
|
DSA(DSAPublicKey pub, DSAPrivateKey priv, RandomBitsSource rbs) Creates a new instance with the given parameters. |
|
DSA(DSAPublicKey pub, DSAPrivateKey priv, RandomBitsSource rbs, byte[] doc) Creates a new instance, and generates the signature for the given document with the given random bits source. |
Method Summary | |
java.lang.String |
algName() Gets the name of the algorithm. |
AlgorithmIdentifier |
getAlgID() |
AlgorithmIdentifier |
getDigestEncryptionAlgID() Returns the algorithm identifier of the message digest encryption for this signature. |
void |
setAlgID(AlgorithmIdentifier algID) |
void |
setHash(byte[] hash) Sets the document digest to be used in the signature calculation, bypassing the digesting step. |
void |
setPrivateKey(PrivateKey privateKey) Sets the private key to be used for signing. |
void |
setPublicKey(PublicKey publicKey) Sets the public key to be used for verification. |
void |
setRandomBitsSource(RandomBitsSource rbs) Sets the random bits source used to generate signatures. |
byte[] |
sign() Signs the document. |
boolean |
verify() Verify that the signature matches the document. |
Methods inherited from class oracle.security.crypto.core.Signature |
getBytes, getDocument, getInstance, getInstance, getInstance, getSigBytes, setBytes, setDocument, setSigBytes |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final ASN1ObjectID dsaKeyOID
id-dsa ID ::= { iso(1) member-body(2) us(840) x9-57(10040) x9cm(4) 1 }
public static final ASN1ObjectID dsaKeyOldOID
public static final ASN1ObjectID dsaSigOID
id-dsa-with-sha1 ID ::= { iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 }
public static final ASN1ObjectID dsaSigOldOID
public static final ASN1ObjectID dsaSigOldOID2
Constructor Detail |
public DSA()
public DSA(DSAPublicKey pk)
setDocument
.pk
- DSA public key used to verify signaturesSignature.setDocument(byte[])
public DSA(DSAPublicKey pub, DSAPrivateKey priv)
setDocument
. The default random bit source will be used to generate a signature.pub
- a DSA public key used to verify signaturespriv
- a DSA private key used to generate signaturesSignature.setDocument(byte[])
public DSA(DSAPublicKey pub, DSAPrivateKey priv, RandomBitsSource rbs)
setDocument
.pub
- DSA public key used to verify signaturespriv
- DSA private key used to generate signaturesrbs
- random bits source used to generate signaturesSignature.getDocument()
public DSA(DSAPublicKey pub, DSAPrivateKey priv, byte[] doc) throws SignatureException
pub
- DSA public key used to verify signaturespriv
- DSA private key used to generate signaturesdoc
- the document to be signedpublic DSA(DSAPublicKey pub, DSAPrivateKey priv, RandomBitsSource rbs, byte[] doc) throws SignatureException
pub
- DSA public key used to verify signaturespriv
- DSA private key used to generate signaturesrbs
- random bits source used to generate signaturesdoc
- the document to be signedpublic DSA(DSAPrivateKey priv, byte[] doc) throws SignatureException
priv
- DSA private key used to generate signaturesdoc
- the document to be signedpublic DSA(DSAPrivateKey priv, RandomBitsSource rbs, byte[] doc) throws SignatureException
priv
- DSA private key used to generate signaturesrbs
- random bits source used to generate signaturesdoc
- the document to be signedpublic DSA(DSAPublicKey pubKey, byte[] sigBytes, byte[] doc)
sigBytes
- the signature bytes of the document to be verifieddoc
- the document to be verifiedMethod Detail |
public void setAlgID(AlgorithmIdentifier algID) throws AlgorithmIdentifierException
setAlgID
in class Signature
AlgorithmIdentifierException
public AlgorithmIdentifier getAlgID()
getAlgID
in class Signature
public AlgorithmIdentifier getDigestEncryptionAlgID()
Signature
getDigestEncryptionAlgID
in class Signature
public java.lang.String algName()
algName
in class Signature
public void setHash(byte[] hash)
null
.setHash
in class Signature
hash
- the message digest.Signature.setDocument(byte[])
public void setPublicKey(PublicKey publicKey) throws InvalidKeyException
DSAPublicKey
.setPublicKey
in class Signature
publicKey
- the public keyInvalidKeyException
public void setPrivateKey(PrivateKey privateKey) throws InvalidKeyException
DSAPrivateKey
.setPrivateKey
in class Signature
privateKey
- the private keyInvalidKeyException
public void setRandomBitsSource(RandomBitsSource rbs)
setRandomBitsSource
in class Signature
rbs
- the random bits source to be used to generate signaturespublic boolean verify() throws AuthenticationException
setSigBytes
, setPublicKey
and setDocument
, or an appropriate constructor.verify
in class Signature
true
if the signature is valid, and false
if it is invalidAuthenticationException
- if the verification could not be performed for some reasonSignature.setSigBytes(byte[])
, setPublicKey(oracle.security.crypto.core.PublicKey)
, Signature.setDocument(byte[])
public byte[] sign() throws SignatureException
getSigBytes
.
The document and private key must first have been specified via setDocument
and setPrivateKey
, or an appropriate constructor.
sign
in class Signature
SignatureException
- if the signature could not be generated for some reasonSignature.setDocument(byte[])
, setPrivateKey(oracle.security.crypto.core.PrivateKey)
, Signature.getSigBytes()
|
Oracle Security Developer Tools Crypto Java API Reference 10g Release 2 (10.1.2.0.2) B15565-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |