forked from travist/jsencrypt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dpronin
committed
Dec 20, 2017
1 parent
15c4c77
commit 28471f5
Showing
23 changed files
with
5,773 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
source 'https://rubygems.org' | ||
gem 'github-pages', group: :jekyll_plugins |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Int10 } from "./int10"; | ||
export declare class Stream { | ||
constructor(enc: Stream | number[], pos?: number); | ||
private enc; | ||
pos: number; | ||
get(pos?: number): number; | ||
hexDigits: string; | ||
hexByte(b: number): string; | ||
hexDump(start: number, end: number, raw: boolean): string; | ||
isASCII(start: number, end: number): boolean; | ||
parseStringISO(start: number, end: number): string; | ||
parseStringUTF(start: number, end: number): string; | ||
parseStringBMP(start: number, end: number): string; | ||
parseTime(start: number, end: number, shortYear: boolean): string; | ||
parseInteger(start: number, end: number): string | 0 | -1; | ||
parseBitString(start: number, end: number, maxLength: number): string; | ||
parseOctetString(start: number, end: number, maxLength: number): string; | ||
parseOID(start: number, end: number, maxLength: number): string; | ||
} | ||
export declare class ASN1 { | ||
constructor(stream: Stream, header: number, length: number, tag: ASN1Tag, sub: ASN1[]); | ||
private stream; | ||
private header; | ||
private length; | ||
private tag; | ||
sub: ASN1[]; | ||
typeName(): string; | ||
content(maxLength: number): string | 0 | -1; | ||
toString(): string; | ||
toPrettyString(indent: string): string; | ||
posStart(): number; | ||
posContent(): number; | ||
posEnd(): number; | ||
toHexString(): string; | ||
static decodeLength(stream: Stream): number; | ||
/** | ||
* Retrieve the hexadecimal value (as a string) of the current ASN.1 element | ||
* @returns {string} | ||
* @public | ||
*/ | ||
getHexStringValue(): string; | ||
static decode(str: Stream | number[]): ASN1; | ||
} | ||
export declare class ASN1Tag { | ||
constructor(stream: Stream); | ||
tagClass: number; | ||
tagConstructed: boolean; | ||
tagNumber: number | Int10; | ||
isUniversal(): boolean; | ||
isEOC(): boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export declare const Base64: { | ||
decode(a: string): number[]; | ||
re: RegExp; | ||
unarmor(a: string): number[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export declare const Hex: { | ||
decode(a: string): number[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export declare class Int10 { | ||
constructor(value?: string | number); | ||
mulAdd(m: number, c: number): void; | ||
sub(c: number): void; | ||
toString(base?: number): string; | ||
valueOf(): number; | ||
simplify(): number | this; | ||
private buf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export declare function hex2b64(h: string): string; | ||
export declare function b64tohex(s: string): string; | ||
export declare function b64toBA(s: string): number[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { SecureRandom } from "./rng"; | ||
export declare class BigInteger { | ||
constructor(a: number | number[] | string, b?: number | SecureRandom, c?: number | SecureRandom); | ||
toString(b: number): string; | ||
protected negate(): BigInteger; | ||
abs(): BigInteger; | ||
compareTo(a: BigInteger): number; | ||
bitLength(): number; | ||
mod(a: BigInteger): BigInteger; | ||
modPowInt(e: number, m: BigInteger): BigInteger; | ||
protected clone(): BigInteger; | ||
protected intValue(): number; | ||
protected byteValue(): number; | ||
protected shortValue(): number; | ||
protected signum(): 0 | 1 | -1; | ||
toByteArray(): number[]; | ||
protected equals(a: BigInteger): boolean; | ||
protected min(a: BigInteger): BigInteger; | ||
protected max(a: BigInteger): BigInteger; | ||
protected and(a: BigInteger): BigInteger; | ||
protected or(a: BigInteger): BigInteger; | ||
protected xor(a: BigInteger): BigInteger; | ||
protected andNot(a: BigInteger): BigInteger; | ||
protected not(): BigInteger; | ||
protected shiftLeft(n: number): BigInteger; | ||
protected shiftRight(n: number): BigInteger; | ||
protected getLowestSetBit(): number; | ||
protected bitCount(): number; | ||
protected testBit(n: number): boolean; | ||
protected setBit(n: number): BigInteger; | ||
protected clearBit(n: number): BigInteger; | ||
protected flipBit(n: number): BigInteger; | ||
add(a: BigInteger): BigInteger; | ||
subtract(a: BigInteger): BigInteger; | ||
multiply(a: BigInteger): BigInteger; | ||
divide(a: BigInteger): BigInteger; | ||
protected remainder(a: BigInteger): BigInteger; | ||
protected divideAndRemainder(a: BigInteger): BigInteger[]; | ||
modPow(e: BigInteger, m: BigInteger): BigInteger; | ||
modInverse(m: BigInteger): BigInteger; | ||
protected pow(e: number): BigInteger; | ||
gcd(a: BigInteger): BigInteger; | ||
isProbablePrime(t: number): boolean; | ||
copyTo(r: BigInteger): void; | ||
fromInt(x: number): void; | ||
protected fromString(s: string | number[], b: number): void; | ||
clamp(): void; | ||
dlShiftTo(n: number, r: BigInteger): void; | ||
drShiftTo(n: number, r: BigInteger): void; | ||
protected lShiftTo(n: number, r: BigInteger): void; | ||
protected rShiftTo(n: number, r: BigInteger): void; | ||
subTo(a: BigInteger, r: BigInteger): void; | ||
multiplyTo(a: BigInteger, r: BigInteger): void; | ||
squareTo(r: BigInteger): void; | ||
divRemTo(m: BigInteger, q: BigInteger, r: BigInteger): void; | ||
invDigit(): number; | ||
protected isEven(): boolean; | ||
protected exp(e: number, z: IReduction): BigInteger; | ||
protected chunkSize(r: number): number; | ||
protected toRadix(b: number): string; | ||
fromRadix(s: string, b: number): void; | ||
protected fromNumber(a: number, b: number | SecureRandom, c?: number | SecureRandom): void; | ||
protected bitwiseTo(a: BigInteger, op: (a: number, b: number) => number, r: BigInteger): void; | ||
protected changeBit(n: number, op: (a: number, b: number) => number): BigInteger; | ||
protected addTo(a: BigInteger, r: BigInteger): void; | ||
protected dMultiply(n: number): void; | ||
dAddOffset(n: number, w: number): void; | ||
multiplyLowerTo(a: BigInteger, n: number, r: BigInteger): void; | ||
multiplyUpperTo(a: BigInteger, n: number, r: BigInteger): void; | ||
protected modInt(n: number): number; | ||
protected millerRabin(t: number): boolean; | ||
protected square(): BigInteger; | ||
gcda(a: BigInteger, callback: (x: BigInteger) => void): void; | ||
fromNumberAsync(a: number, b: number | SecureRandom, c: number | SecureRandom, callback: () => void): void; | ||
s: number; | ||
t: number; | ||
DB: number; | ||
DM: number; | ||
DV: number; | ||
FV: number; | ||
F1: number; | ||
F2: number; | ||
am: (i: number, x: number, w: BigInteger, j: number, c: number, n: number) => number; | ||
[index: number]: number; | ||
static ONE: BigInteger; | ||
static ZERO: BigInteger; | ||
} | ||
export interface IReduction { | ||
convert(x: BigInteger): BigInteger; | ||
revert(x: BigInteger): BigInteger; | ||
mulTo(x: BigInteger, y: BigInteger, r: BigInteger): void; | ||
sqrTo(x: BigInteger, r: BigInteger): void; | ||
} | ||
export declare function nbi(): BigInteger; | ||
export declare function parseBigInt(str: string, r: number): BigInteger; | ||
export declare function intAt(s: string, i: number): number; | ||
export declare function nbv(i: number): BigInteger; | ||
export declare function nbits(x: number): number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export declare class Arcfour { | ||
constructor(); | ||
init(key: number[]): void; | ||
next(): number; | ||
private i; | ||
private j; | ||
private S; | ||
} | ||
export declare function prng_newstate(): Arcfour; | ||
export declare let rng_psize: number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export declare class SecureRandom { | ||
nextBytes(ba: number[]): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { BigInteger } from "./jsbn"; | ||
export declare class RSAKey { | ||
constructor(); | ||
doPublic(x: BigInteger): BigInteger; | ||
doPrivate(x: BigInteger): BigInteger; | ||
setPublic(N: string, E: string): void; | ||
encrypt(text: string): string; | ||
setPrivate(N: string, E: string, D: string): void; | ||
setPrivateEx(N: string, E: string, D: string, P: string, Q: string, DP: string, DQ: string, C: string): void; | ||
generate(B: number, E: string): void; | ||
decrypt(ctext: string): string; | ||
generateAsync(B: number, E: string, callback: () => void): void; | ||
protected n: BigInteger; | ||
protected e: number; | ||
protected d: BigInteger; | ||
protected p: BigInteger; | ||
protected q: BigInteger; | ||
protected dmp1: BigInteger; | ||
protected dmq1: BigInteger; | ||
protected coeff: BigInteger; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export declare function int2char(n: number): string; | ||
export declare function op_and(x: number, y: number): number; | ||
export declare function op_or(x: number, y: number): number; | ||
export declare function op_xor(x: number, y: number): number; | ||
export declare function op_andnot(x: number, y: number): number; | ||
export declare function lbit(x: number): number; | ||
export declare function cbit(x: number): number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { JSEncryptRSAKey } from "./JSEncryptRSAKey"; | ||
export interface IJSEncryptOptions { | ||
default_key_size?: string; | ||
default_public_exponent?: string; | ||
log?: boolean; | ||
} | ||
/** | ||
* | ||
* @param {Object} [options = {}] - An object to customize JSEncrypt behaviour | ||
* possible parameters are: | ||
* - default_key_size {number} default: 1024 the key size in bit | ||
* - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent | ||
* - log {boolean} default: false whether log warn/error or not | ||
* @constructor | ||
*/ | ||
export declare class JSEncrypt { | ||
constructor(options: IJSEncryptOptions); | ||
private default_key_size; | ||
private default_public_exponent; | ||
private log; | ||
private key; | ||
static version: string; | ||
/** | ||
* Method to set the rsa key parameter (one method is enough to set both the public | ||
* and the private key, since the private key contains the public key paramenters) | ||
* Log a warning if logs are enabled | ||
* @param {Object|string} key the pem encoded string or an object (with or without header/footer) | ||
* @public | ||
*/ | ||
setKey(key: string): void; | ||
/** | ||
* Proxy method for setKey, for api compatibility | ||
* @see setKey | ||
* @public | ||
*/ | ||
setPrivateKey(privkey: string): void; | ||
/** | ||
* Proxy method for setKey, for api compatibility | ||
* @see setKey | ||
* @public | ||
*/ | ||
setPublicKey(pubkey: string): void; | ||
/** | ||
* Proxy method for RSAKey object's decrypt, decrypt the string using the private | ||
* components of the rsa key object. Note that if the object was not set will be created | ||
* on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor | ||
* @param {string} str base64 encoded crypted string to decrypt | ||
* @return {string} the decrypted string | ||
* @public | ||
*/ | ||
decrypt(str: string): string | false; | ||
/** | ||
* Proxy method for RSAKey object's encrypt, encrypt the string using the public | ||
* components of the rsa key object. Note that if the object was not set will be created | ||
* on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor | ||
* @param {string} str the string to encrypt | ||
* @return {string} the encrypted string encoded in base64 | ||
* @public | ||
*/ | ||
encrypt(str: string): string | false; | ||
/** | ||
* Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object | ||
* will be created and returned | ||
* @param {callback} [cb] the callback to be called if we want the key to be generated | ||
* in an async fashion | ||
* @returns {JSEncryptRSAKey} the JSEncryptRSAKey object | ||
* @public | ||
*/ | ||
getKey(cb?: () => void): JSEncryptRSAKey; | ||
/** | ||
* Returns the pem encoded representation of the private key | ||
* If the key doesn't exists a new key will be created | ||
* @returns {string} pem encoded representation of the private key WITH header and footer | ||
* @public | ||
*/ | ||
getPrivateKey(): string; | ||
/** | ||
* Returns the pem encoded representation of the private key | ||
* If the key doesn't exists a new key will be created | ||
* @returns {string} pem encoded representation of the private key WITHOUT header and footer | ||
* @public | ||
*/ | ||
getPrivateKeyB64(): string; | ||
/** | ||
* Returns the pem encoded representation of the public key | ||
* If the key doesn't exists a new key will be created | ||
* @returns {string} pem encoded representation of the public key WITH header and footer | ||
* @public | ||
*/ | ||
getPublicKey(): string; | ||
/** | ||
* Returns the pem encoded representation of the public key | ||
* If the key doesn't exists a new key will be created | ||
* @returns {string} pem encoded representation of the public key WITHOUT header and footer | ||
* @public | ||
*/ | ||
getPublicKeyB64(): string; | ||
} |
Oops, something went wrong.