Class Index | File Index

Classes


Class RSAKey

key of RSA public key algorithm
Defined in: rsasign-1.2.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
RSAKey()
Tom Wu's RSA Key class and extension
Method Summary
Method Attributes Method Name and Description
<static>  
RSAKey.getHexValueArrayOfChildrenFromHex(sPEMPrivateKey)
static method to get array of hex field values from hexadecimal PKCS#5 RSA private key.
<static>  
RSAKey.getPosArrayOfChildrenFromHex(sPEMPrivateKey)
static method to get array of field positions from hexadecimal PKCS#5 RSA private key.
<static>  
RSAKey.pemToBase64(sPEMPrivateKey)
static method to extract Base64 string from PKCS#5 PEM RSA private key.
 
readCertPubKeyHex(h, nthPKI)
read an ASN.1 hexadecimal string of X.509 RSA public key certificate
 
read an ASN.1 hexadecimal string of PKCS#1/5 plain RSA private key
 
read an ASN.1 hexadecimal string of PKCS#5 RSA public key
 
read an ASN.1 hexadecimal string of PKCS#8 plain RSA private key
 
read an ASN.1 hexadecimal string of PKCS#8 RSA public key
 
(DEPRECATED) read RSA private key from a ASN.1 hexadecimal string
 
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.
Class Detail
RSAKey()
Tom Wu's RSA Key class and extension
Method Detail
<static> {Array} RSAKey.getHexValueArrayOfChildrenFromHex(sPEMPrivateKey)
static method to get array of hex field values from hexadecimal PKCS#5 RSA private key.

Defined in: rsapem-1.1.js.
RSAKey.getHexValueArrayOfChildrenFromHex("3082...") → ["00", "3b42...", ...]
Parameters:
{String} sPEMPrivateKey
PEM PKCS#1/5 s private key string
Returns:
{Array} array of field hex value

<static> {Array} RSAKey.getPosArrayOfChildrenFromHex(sPEMPrivateKey)
static method to get array of field positions from hexadecimal PKCS#5 RSA private key.

Defined in: rsapem-1.1.js.
RSAKey.getPosArrayOfChildrenFromHex("3082...") → [8, 32, ...]
Parameters:
{String} sPEMPrivateKey
PEM PKCS#1/5 s private key string
Returns:
{Array} array of field positions

<static> {String} RSAKey.pemToBase64(sPEMPrivateKey)
static method to extract Base64 string from PKCS#5 PEM RSA private key.
removing PEM header, PEM footer and space characters including new lines from PEM formatted RSA private key string.
Defined in: rsapem-1.1.js.
RSAKey.pemToBase64("----BEGIN PRIVATE KEY-...") → "MIICW..."
Parameters:
{String} sPEMPrivateKey
PEM PKCS#1/5 s private key string
Deprecated:
jsrsasign 7.2.1 rsapem 1.1.2
Returns:
{String} Base64 string of private key

readCertPubKeyHex(h, nthPKI)
read an ASN.1 hexadecimal string of X.509 RSA public key certificate

Defined in: rsapem-1.1.js.
Parameters:
{String} h
hexadecimal string of X.509 RSA public key certificate
{Integer} nthPKI
nth index of publicKeyInfo. (DEFAULT: 6 for X509v3)
Since:
jsrsasign 7.1.0 rsapem 1.2.0

readPKCS5PrvKeyHex(h)
read an ASN.1 hexadecimal string of PKCS#1/5 plain RSA private key

Defined in: rsapem-1.1.js.
Parameters:
{String} h
hexadecimal string of PKCS#1/5 plain RSA private key
Since:
jsrsasign 7.1.0 rsapem 1.2.0
See:
former method

readPKCS5PubKeyHex(h)
read an ASN.1 hexadecimal string of PKCS#5 RSA public key

Defined in: rsapem-1.1.js.
Parameters:
{String} h
hexadecimal string of PKCS#5 public key
Since:
jsrsasign 7.1.0 rsapem 1.2.0

readPKCS8PrvKeyHex(h)
read an ASN.1 hexadecimal string of PKCS#8 plain RSA private key

Defined in: rsapem-1.1.js.
Parameters:
{String} h
hexadecimal string of PKCS#8 plain RSA private key
Since:
jsrsasign 7.1.0 rsapem 1.2.0

readPKCS8PubKeyHex(h)
read an ASN.1 hexadecimal string of PKCS#8 RSA public key

Defined in: rsapem-1.1.js.
Parameters:
{String} h
hexadecimal string of PKCS#8 public key
Since:
jsrsasign 7.1.0 rsapem 1.2.0

readPrivateKeyFromASN1HexString(keyHex)
(DEPRECATED) read RSA private key from a ASN.1 hexadecimal string

Defined in: rsapem-1.1.js.
Parameters:
{String} keyHex
ASN.1 hexadecimal string of PKCS#1 private key.
Deprecated:
since jsrsasign 7.1.0 rsapem 1.2.0, please use RSAKey.readPKCS5PrvKeyHex instead.
Since:
rsapem 1.1.1

readPrivateKeyFromPEMString(keyPEM)
read PKCS#1 private key from a string

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)
DEFAULT is -1. (NOTE: OpenSSL's default is -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)
DEFAULT is -1. (NOTE: OpenSSL's default is -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)
DEFAULT is -1. (NOTE: OpenSSL's default is -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)
DEFAULT is -1 (NOTE: OpenSSL's default is -2.)
Since:
rsasign 1.2.6
Returns:
returns true if valid, otherwise false

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