Class Index | File Index

Classes


Class KJUR.crypto.DSA

class for DSA signing and verifcation
Defined in: dsa-2.0.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
class for DSA signing and verification

CAUTION: Most of the case, you don't need to use this class.

Method Summary
Method Attributes Method Name and Description
 
parse hexadecimal ASN.1 DSA signature value
 
readCertPubKeyHex(h, nthPKI)
read an ASN.1 hexadecimal string of X.509 DSA public key certificate
This method reads a hexadecimal string of X.509 DSA public key certificate and set public key parameter internally.
 
read an ASN.1 hexadecimal string of PKCS#1/5 plain DSA private key
 
read an ASN.1 hexadecimal string of PKCS#8 plain DSA private key
 
read an ASN.1 hexadecimal string of PKCS#8 plain DSA private key
 
setPrivate(p, q, g, y, x)
set DSA private key by key parameters of BigInteger object
 
setPrivateHex(hP, hQ, hG, hY, hX)
set DSA private key by key parameters of hexadecimal string
 
setPublic(p, q, g, y)
set DSA public key by key parameters of BigInteger object
 
setPublicHex(hP, hQ, hG, hY)
set DSA public key by key parameters of hexadecimal string
 
sign to hashed message by this DSA private key object
 
verifyWithMessageHash(sHashHex, hSigVal)
verify signature by this DSA public key object
Class Detail
KJUR.crypto.DSA()
class for DSA signing and verification

CAUTION: Most of the case, you don't need to use this class. Please use KJUR.crypto.Signature class instead.

NOTE: Until jsrsasign 6.2.3, DSA class have used codes from openpgpjs library 1.0.0 licenced under LGPL licence. To avoid license issue dsa-2.0.js was re-written with my own codes in jsrsasign 7.0.0. Some random number generators used in dsa-2.0.js was newly defined in KJUR.crypto.Util class. Now all of LGPL codes are removed.

Since:
jsrsasign 7.0.0 dsa 2.0.0
Method Detail
{Array} parseASN1Signature(hSigVal)
parse hexadecimal ASN.1 DSA signature value
Parameters:
{String} hSigVal
hexadecimal string of ASN.1 encoded DSA signature value
Since:
jsrsasign 7.0.0 dsa 2.0.0
Returns:
{Array} array [r, s] of DSA signature value. Both r and s are BigInteger.

readCertPubKeyHex(h, nthPKI)
read an ASN.1 hexadecimal string of X.509 DSA public key certificate
This method reads a hexadecimal string of X.509 DSA public key certificate and set public key parameter internally.
dsa = new KJUR.crypto.DSA();
dsa.readCertPubKeyHex("30...");
Parameters:
{String} h
hexadecimal string of X.509 DSA public key certificate
{Integer} nthPKI
(DEPRECATED to use)
Since:
jsrsasign 7.1.0 dsa 2.1.0

readPKCS5PrvKeyHex(h)
read an ASN.1 hexadecimal string of PKCS#1/5 plain DSA private key
Parameters:
{String} h
hexadecimal string of PKCS#1/5 DSA private key
Since:
jsrsasign 7.1.0 dsa 2.1.0

readPKCS8PrvKeyHex(h)
read an ASN.1 hexadecimal string of PKCS#8 plain DSA private key
Parameters:
{String} h
hexadecimal string of PKCS#8 DSA private key
Since:
jsrsasign 7.1.0 dsa 2.1.0

readPKCS8PubKeyHex(h)
read an ASN.1 hexadecimal string of PKCS#8 plain DSA private key
Parameters:
{String} h
hexadecimal string of PKCS#8 DSA private key
Since:
jsrsasign 7.1.0 dsa 2.1.0

setPrivate(p, q, g, y, x)
set DSA private key by key parameters of BigInteger object
Parameters:
{BigInteger} p
prime P parameter
{BigInteger} q
sub prime Q parameter
{BigInteger} g
base G parameter
{BigInteger} y
public key Y or null
{BigInteger} x
private key X
Since:
jsrsasign 7.0.0 dsa 2.0.0

setPrivateHex(hP, hQ, hG, hY, hX)
set DSA private key by key parameters of hexadecimal string
Parameters:
{String} hP
prime P parameter
{String} hQ
sub prime Q parameter
{String} hG
base G parameter
{String} hY
public key Y or null
{String} hX
private key X
Since:
jsrsasign 7.1.0 dsa 2.1.0

setPublic(p, q, g, y)
set DSA public key by key parameters of BigInteger object
Parameters:
{BigInteger} p
prime P parameter
{BigInteger} q
sub prime Q parameter
{BigInteger} g
base G parameter
{BigInteger} y
public key Y
Since:
jsrsasign 7.0.0 dsa 2.0.0

setPublicHex(hP, hQ, hG, hY)
set DSA public key by key parameters of hexadecimal string
Parameters:
{String} hP
prime P parameter
{String} hQ
sub prime Q parameter
{String} hG
base G parameter
{String} hY
public key Y
Since:
jsrsasign 7.1.0 dsa 2.1.0

{String} signWithMessageHash(sHashHex)
sign to hashed message by this DSA private key object
Parameters:
{String} sHashHex
hexadecimal string of hashed message
Since:
jsrsasign 7.0.0 dsa 2.0.0
Returns:
{String} hexadecimal string of ASN.1 encoded DSA signature value

{Boolean} verifyWithMessageHash(sHashHex, hSigVal)
verify signature by this DSA public key object
Parameters:
{String} sHashHex
hexadecimal string of hashed message
{String} hSigVal
hexadecimal string of ASN.1 encoded DSA signature value
Since:
jsrsasign 7.0.0 dsa 2.0.0
Returns:
{Boolean} true if the signature is valid otherwise false.

© 2012-2023 Kenji Urushima, All rights reserved
Documentation generated by JsDoc Toolkit 2.4.0