|
Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10668-04 |
||||||||
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
public final class 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() Returns the name of the algorithm. |
AlgorithmIdentifier |
getAlgID() Gets the algorithm identifier of this Signature object. |
AlgorithmIdentifier |
getDigestEncryptionAlgID() Returns the algorithm identifier of the message digest encryption for this signature. |
void |
setAlgID(AlgorithmIdentifier algID) Sets the signature algorithm identifier to use, |
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 |
---|
getDocument, getInstance, getInstance, getInstance, getSigBytes, 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
- A DSA public key used to verify signatures.Signature.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 signatures.priv
- A DSA private key used to generate signatures.Signature.setDocument(byte[])
public DSA(DSAPublicKey pub, DSAPrivateKey priv, RandomBitsSource rbs)
setDocument
.
pub
- A DSA public key used to verify signatures.priv
- A DSA private key used to generate signatures.rbs
- A random bits source used to generate signatures.Signature.getDocument()
public DSA(DSAPublicKey pub, DSAPrivateKey priv, byte[] doc) throws SignatureException
pub
- A DSA public key used to verify signatures.priv
- A DSA private key used to generate signatures.doc
- The document to be signed.SignatureException
public DSA(DSAPublicKey pub, DSAPrivateKey priv, RandomBitsSource rbs, byte[] doc) throws SignatureException
pub
- A DSA public key used to verify signatures.priv
- A DSA private key used to generate signatures.rbs
- A random bits source used to generate signatures.doc
- The document to be signed.SignatureException
public DSA(DSAPrivateKey priv, byte[] doc) throws SignatureException
priv
- A DSA private key used to generate signatures.doc
- The document to be signed.SignatureException
public DSA(DSAPrivateKey priv, RandomBitsSource rbs, byte[] doc) throws SignatureException
priv
- A DSA private key used to generate signatures.rbs
- A random bits source used to generate signatures.doc
- The document to be signed.SignatureException
public DSA(DSAPublicKey pubKey, byte[] sigBytes, byte[] doc)
pub
- A DSA public key used to verify signatures.sigBytes
- The signature bytes of the document to be verified.doc
- The document to be verified.Method Detail |
---|
public void setAlgID(AlgorithmIdentifier algID) throws AlgorithmIdentifierException
Signature
setAlgID
in class Signature
algID
- The AlgorithmIdentifier to use to perform signature and verification.AlgorithmIdentifierException
public AlgorithmIdentifier getAlgID()
Signature
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 key used to verify the signature.InvalidKeyException
public void setPrivateKey(PrivateKey privateKey) throws InvalidKeyException
DSAPrivateKey
.setPrivateKey
in class Signature
privateKey
- The private key used to generate the signature.InvalidKeyException
public void setRandomBitsSource(RandomBitsSource rbs)
setRandomBitsSource
in class Signature
rbs
- The random bits source to be used to generate signatures.public 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.Signature.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.Signature.setDocument(byte[])
, setPrivateKey(oracle.security.crypto.core.PrivateKey)
, Signature.getSigBytes()
|
Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10668-04 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |