Class RSAKey
key of RSA public key algorithm
Defined in: rsasign-1.2.js.
Constructor Attributes | Constructor Name and Description |
---|---|
RSAKey()
Tom Wu's RSA Key class and extension
|
Method Attributes | Method Name and Description |
---|---|
readPrivateKeyFromASN1HexString(keyHex)
read RSA private key from a ASN.1 hexadecimal string
|
|
readPrivateKeyFromPEMString(keyPEM)
read PKCS#1 private key from a string
|
|
<static> |
RSAKey.signString(s, hashAlg)
sign for a message string with RSA private key.
|
<static> |
RSAKey.signStringPSS(s, hashAlg, sLen)
sign for a message string with RSA private key by PKCS#1 PSS signing.
|
<static> |
RSAKey.signWithMessageHash(sHashHex, hashAlg)
sign hash value of message to be signed with RSA private key.
|
<static> |
RSAKey.signWithMessageHashPSS(hHash, hashAlg, sLen)
sign hash value of message with RSA private key by PKCS#1 PSS signing.
|
verifyString(sMsg, hSig)
verifies a sigature for a message string with RSA public key.
|
|
<static> |
RSAKey.verifyStringPSS(sMsg, hSig, hashAlg, sLen)
verifies a sigature for a message string with RSA public key by PKCS#1 PSS sign.
|
<static> |
RSAKey.verifyWithMessageHash(sHashHex, hSig)
verifies a sigature for a message string with RSA public key.
|
<static> |
RSAKey.verifyWithMessageHashPSS(hHash, hSig, hashAlg, sLen)
verifies a sigature for a hash value of message string with RSA public key by PKCS#1 PSS sign.
|
Method Detail
readPrivateKeyFromASN1HexString(keyHex)
read RSA private key from a ASN.1 hexadecimal string
Defined in: rsapem-1.1.js.
Defined in: rsapem-1.1.js.
- Parameters:
- {String} keyHex
- ASN.1 hexadecimal string of PKCS#1 private key.
- Since:
- 1.1.1
readPrivateKeyFromPEMString(keyPEM)
read PKCS#1 private key from a string
Defined in: rsapem-1.1.js.
Defined in: rsapem-1.1.js.
- Parameters:
- {String} keyPEM
- string of PKCS#1 private key.
<static>
RSAKey.signString(s, hashAlg)
sign for a message string with RSA private key.
- Parameters:
- {String} s
- message string to be signed.
- {String} hashAlg
- hash algorithm name for signing.
- Returns:
- returns hexadecimal string of signature value.
<static>
RSAKey.signStringPSS(s, hashAlg, sLen)
sign for a message string with RSA private key by PKCS#1 PSS signing.
- Parameters:
- {String} s
- message string to be signed.
- {String} hashAlg
- hash algorithm name for signing.
- {Integer} sLen
- salt byte length from 0 to (keybytelen - hashbytelen - 2).
There are two special values:
- -1: sets the salt length to the digest length
- -2: sets the salt length to maximum permissible value (i.e. keybytelen - hashbytelen - 2)
- Returns:
- returns hexadecimal string of signature value.
<static>
RSAKey.signWithMessageHash(sHashHex, hashAlg)
sign hash value of message to be signed with RSA private key.
- Parameters:
- {String} sHashHex
- hexadecimal string of hash value of message to be signed.
- {String} hashAlg
- hash algorithm name for signing.
- Since:
- rsasign 1.2.6
- Returns:
- returns hexadecimal string of signature value.
<static>
RSAKey.signWithMessageHashPSS(hHash, hashAlg, sLen)
sign hash value of message with RSA private key by PKCS#1 PSS signing.
- Parameters:
- {String} hHash
- hexadecimal hash value of message to be signed.
- {String} hashAlg
- hash algorithm name for signing.
- {Integer} sLen
- salt byte length from 0 to (keybytelen - hashbytelen - 2).
There are two special values:
- -1: sets the salt length to the digest length
- -2: sets the salt length to maximum permissible value (i.e. keybytelen - hashbytelen - 2)
- Since:
- rsasign 1.2.6
- Returns:
- returns hexadecimal string of signature value.
verifyString(sMsg, hSig)
verifies a sigature for a message string with RSA public key.
- Parameters:
- {String} sMsg
- message string to be verified.
- {String} hSig
- hexadecimal string of siganture.
non-hexadecimal charactors including new lines will be ignored.
- Returns:
- returns 1 if valid, otherwise 0
<static>
RSAKey.verifyStringPSS(sMsg, hSig, hashAlg, sLen)
verifies a sigature for a message string with RSA public key by PKCS#1 PSS sign.
- Parameters:
- {String} sMsg
- message string to be verified.
- {String} hSig
- hexadecimal string of signature value
- {String} hashAlg
- hash algorithm name
- {Integer} sLen
- salt byte length from 0 to (keybytelen - hashbytelen - 2).
There are two special values:
- -1: sets the salt length to the digest length
- -2: sets the salt length to maximum permissible value (i.e. keybytelen - hashbytelen - 2)
- Returns:
- returns true if valid, otherwise false
<static>
RSAKey.verifyWithMessageHash(sHashHex, hSig)
verifies a sigature for a message string with RSA public key.
- Parameters:
- {String} sHashHex
- hexadecimal hash value of message to be verified.
- {String} hSig
- hexadecimal string of siganture.
non-hexadecimal charactors including new lines will be ignored.
- Since:
- rsasign 1.2.6
- Returns:
- returns 1 if valid, otherwise 0
<static>
RSAKey.verifyWithMessageHashPSS(hHash, hSig, hashAlg, sLen)
verifies a sigature for a hash value of message string with RSA public key by PKCS#1 PSS sign.
- Parameters:
- {String} hHash
- hexadecimal hash value of message string to be verified.
- {String} hSig
- hexadecimal string of signature value
- {String} hashAlg
- hash algorithm name
- {Integer} sLen
- salt byte length from 0 to (keybytelen - hashbytelen - 2).
There are two special values:
- -1: sets the salt length to the digest length
- -2: sets the salt length to maximum permissible value (i.e. keybytelen - hashbytelen - 2)
- Since:
- rsasign 1.2.6
- Returns:
- returns true if valid, otherwise false