Class KJUR.crypto.Util
static object for cryptographic function utilities
Defined in: crypto-1.1.js.
Constructor Attributes | Constructor Name and Description |
---|---|
static object for cryptographic function utilities
|
Field Attributes | Field Name and Description |
---|---|
associative array of default provider name for each hash and signature algorithms
|
|
PKCS#1 DigestInfo heading hexadecimal bytes for each hash algorithms
|
Method Attributes | Method Name and Description |
---|---|
<static> |
KJUR.crypto.Util.getDigestInfoHex(hHash, alg)
get hexadecimal DigestInfo
|
<static> |
KJUR.crypto.Util.getPaddedDigestInfoHex(hHash, alg, keySize)
get PKCS#1 padded hexadecimal DigestInfo
|
<static> |
KJUR.crypto.Util.getRandomBigIntegerMinToMax(biMin, biMax)
get BigInteger object of random value from min value to max value
This static method generates a BigInteger object with random value greater than or equal to biMin and smaller than or equal to biMax (i.e. |
<static> |
KJUR.crypto.Util.getRandomBigIntegerOfNbits(n)
get BigInteger object of random value from with specified bit length
|
<static> |
KJUR.crypto.Util.getRandomBigIntegerOfNbytes(n)
get BigInteger object of random value from with specified byte length
|
<static> |
KJUR.crypto.Util.getRandomBigIntegerZeroToMax(biMax)
get BigInteger object of random value from zero to max value
This static method generates a BigInteger object with random value greater than or equal to zero and smaller than or equal to biMax (i.e. |
<static> |
KJUR.crypto.Util.getRandomHexOfNbits(n)
get hexadecimal string of random value from with specified bit length
|
<static> |
KJUR.crypto.Util.getRandomHexOfNbytes(n)
get hexadecimal string of random value from with specified byte length
|
<static> |
KJUR.crypto.Util.hashHex(sHex, alg)
get hexadecimal hash of hexadecimal string with specified algorithm
|
<static> |
KJUR.crypto.Util.hashString(s, alg)
get hexadecimal hash of string with specified algorithm
|
<static> |
KJUR.crypto.Util.isKey(obj)
check if key object (RSA/DSA/ECDSA) or not
|
<static> |
KJUR.crypto.Util.md5(s)
get hexadecimal MD5 hash of string
|
<static> |
KJUR.crypto.Util.ripemd160(s)
get hexadecimal RIPEMD160 hash of string
|
<static> |
KJUR.crypto.Util.sha1(s)
get hexadecimal SHA1 hash of string
|
<static> |
KJUR.crypto.Util.sha256(s)
get hexadecimal SHA256 hash of string
|
<static> |
KJUR.crypto.Util.sha512(s)
get hexadecimal SHA512 hash of string
|
Field Detail
{Array}
DEFAULTPROVIDER
associative array of default provider name for each hash and signature algorithms
{Array}
DIGESTINFOHEAD
PKCS#1 DigestInfo heading hexadecimal bytes for each hash algorithms
Method Detail
<static>
{String}
KJUR.crypto.Util.getDigestInfoHex(hHash, alg)
get hexadecimal DigestInfo
- Parameters:
- {String} hHash
- hexadecimal hash value
- {String} alg
- hash algorithm name (ex. 'sha1')
- Returns:
- {String} hexadecimal string DigestInfo ASN.1 structure
<static>
{String}
KJUR.crypto.Util.getPaddedDigestInfoHex(hHash, alg, keySize)
get PKCS#1 padded hexadecimal DigestInfo
- Parameters:
- {String} hHash
- hexadecimal hash value of message to be signed
- {String} alg
- hash algorithm name (ex. 'sha1')
- {Integer} keySize
- key bit length (ex. 1024)
- Returns:
- {String} hexadecimal string of PKCS#1 padded DigestInfo
<static>
{BigInteger}
KJUR.crypto.Util.getRandomBigIntegerMinToMax(biMin, biMax)
get BigInteger object of random value from min value to max value
This static method generates a BigInteger object with random value greater than or equal to biMin and smaller than or equal to biMax (i.e. biMin ≤ result ≤ biMax).
This static method generates a BigInteger object with random value greater than or equal to biMin and smaller than or equal to biMax (i.e. biMin ≤ result ≤ biMax).
biMin = new BigInteger("2fa411...", 16); biMax = new BigInteger("3fa411...", 16); KJUR.crypto.Util.getRandomBigIntegerMinToMax(biMin, biMax) → 32f1... of BigInteger
- Parameters:
- {BigInteger} biMin
- min value of BigInteger object for random value
- {BigInteger} biMax
- max value of BigInteger object for random value
- Since:
- jsrsasign 7.0.0 crypto 1.1.11
- Returns:
- {BigInteger} BigInteger object of specified random value
<static>
{BigInteger}
KJUR.crypto.Util.getRandomBigIntegerOfNbits(n)
get BigInteger object of random value from with specified bit length
KJUR.crypto.Util.getRandomBigIntegerOfNbits(24) → 6314af of BigInteger KJUR.crypto.Util.getRandomBigIntegerOfNbits(1024) → 8fbc... of BigInteger
- Parameters:
- {Integer} n
- length of bits of random
- Since:
- jsrsasign 7.0.0 crypto 1.1.11
- Returns:
- {BigInteger} BigInteger object of specified random value
<static>
{BigInteger}
KJUR.crypto.Util.getRandomBigIntegerOfNbytes(n)
get BigInteger object of random value from with specified byte length
KJUR.crypto.Util.getRandomBigIntegerOfNbytes(3) → 6314af of BigInteger KJUR.crypto.Util.getRandomBigIntegerOfNbytes(128) → 8fbc... of BigInteger
- Parameters:
- {Integer} n
- length of bytes of random
- Since:
- jsrsasign 7.0.0 crypto 1.1.11
- Returns:
- {BigInteger} BigInteger object of specified random value
<static>
{BigInteger}
KJUR.crypto.Util.getRandomBigIntegerZeroToMax(biMax)
get BigInteger object of random value from zero to max value
This static method generates a BigInteger object with random value greater than or equal to zero and smaller than or equal to biMax (i.e. 0 ≤ result ≤ biMax).
This static method generates a BigInteger object with random value greater than or equal to zero and smaller than or equal to biMax (i.e. 0 ≤ result ≤ biMax).
biMax = new BigInteger("3fa411...", 16); KJUR.crypto.Util.getRandomBigIntegerZeroToMax(biMax) → 8fbc... of BigInteger
- Parameters:
- {BigInteger} biMax
- max value of BigInteger object for random value
- Since:
- jsrsasign 7.0.0 crypto 1.1.11
- Returns:
- {BigInteger} BigInteger object of specified random value
<static>
{String}
KJUR.crypto.Util.getRandomHexOfNbits(n)
get hexadecimal string of random value from with specified bit length
KJUR.crypto.Util.getRandomHexOfNbits(24) → "6314af", "000000" or "001fb4" KJUR.crypto.Util.getRandomHexOfNbits(1024) → "8fbc..." in 1024bits
- Parameters:
- {Integer} n
- length of bits of random
- Since:
- jsrsasign 7.0.0 crypto 1.1.11
- Returns:
- {String} hexadecimal string of random
<static>
{String}
KJUR.crypto.Util.getRandomHexOfNbytes(n)
get hexadecimal string of random value from with specified byte length
KJUR.crypto.Util.getRandomHexOfNbytes(3) → "6314af", "000000" or "001fb4" KJUR.crypto.Util.getRandomHexOfNbytes(128) → "8fbc..." in 1024bits
- Parameters:
- {Integer} n
- length of bytes of random
- Since:
- jsrsasign 7.0.0 crypto 1.1.11
- Returns:
- {String} hexadecimal string of random
<static>
{String}
KJUR.crypto.Util.hashHex(sHex, alg)
get hexadecimal hash of hexadecimal string with specified algorithm
- Parameters:
- {String} sHex
- input hexadecimal string to be hashed
- {String} alg
- hash algorithm name
- Since:
- 1.1.1
- Returns:
- {String} hexadecimal string of hash value
<static>
{String}
KJUR.crypto.Util.hashString(s, alg)
get hexadecimal hash of string with specified algorithm
- Parameters:
- {String} s
- raw input string to be hashed
- {String} alg
- hash algorithm name
- Since:
- 1.1.1
- Returns:
- {String} hexadecimal string of hash value
<static>
{Boolean}
KJUR.crypto.Util.isKey(obj)
check if key object (RSA/DSA/ECDSA) or not
- Parameters:
- {Object} obj
- any type argument to be checked
- Since:
- 1.0.3
- Returns:
- {Boolean} true if this is key object otherwise false
<static>
{String}
KJUR.crypto.Util.md5(s)
get hexadecimal MD5 hash of string
Util.md5('aaa') → 47bce5c74f589f4867dbd57e9ca9f808
- Parameters:
- {String} s
- input string to be hashed
- Since:
- 1.0.3
- Returns:
- {String} hexadecimal string of hash value
<static>
{String}
KJUR.crypto.Util.ripemd160(s)
get hexadecimal RIPEMD160 hash of string
KJUR.crypto.Util.ripemd160("aaa") → 08889bd7b151aa174c21f33f59147fa65381edea
- Parameters:
- {String} s
- input string to be hashed
- Since:
- 1.0.3
- Returns:
- {String} hexadecimal string of hash value
<static>
{String}
KJUR.crypto.Util.sha1(s)
get hexadecimal SHA1 hash of string
- Parameters:
- {String} s
- raw input string to be hashed
- Since:
- 1.0.3
- Returns:
- {String} hexadecimal string of hash value
<static>
{String}
KJUR.crypto.Util.sha256(s)
get hexadecimal SHA256 hash of string
- Parameters:
- {String} s
- raw input string to be hashed
- Since:
- 1.0.3
- Returns:
- {String} hexadecimal string of hash value
<static>
{String}
KJUR.crypto.Util.sha512(s)
get hexadecimal SHA512 hash of string
- Parameters:
- {String} s
- raw input string to be hashed
- Since:
- 1.0.3
- Returns:
- {String} hexadecimal string of hash value