Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/jsrsasign

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/jsrsasign - npm Package Compare versions

Comparing version 9.0.2 to 9.0.3

122

jsrsasign/modules/KJUR/asn1/x509/Certificate.d.ts
declare namespace jsrsasign.KJUR.asn1.x509 {
interface X509CertificateParamsUnsigned extends CertificateTBSParams {
sigalg: string;
cakey: string | RSAKey | crypto.DSA | crypto.ECDSA;
}
interface X509CertificateParamsSigned extends CertificateTBSParams {
sighex: string;
}
interface X509CertificateTBSParamsUnsigned {
tbsobj: TBSCertificate;
sigalg: string;
cakey: string | RSAKey | crypto.DSA | crypto.ECDSA;
}
interface X509CertificateTBSParamsSigned {
tbsobj: TBSCertificate;
sighex: string;
}
type X509CertificateParams = X509CertificateParamsSigned | X509CertificateParamsUnsigned | X509CertificateTBSParamsSigned | X509CertificateTBSParamsUnsigned;
/**
* X.509 Certificate class to sign and generate hex encoded certificate
* @param params associative array of parameters (ex. {'tbscertobj': obj, 'prvkeyobj': key})
* @param params JSON object for Certificate parameters
* @description
* As for argument 'params' for constructor, you can specify one of
* following properties:
* <br/>
* This class provides Certificate ASN.1 class structure
* defined in
* <a href="https://tools.ietf.org/html/rfc5280#section-4.1">
* RFC 5280 4.1</a>.
* <pre>
* Certificate ::= SEQUENCE {
* tbsCertificate TBSCertificate,
* signatureAlgorithm AlgorithmIdentifier,
* signatureValue BIT STRING }
* </pre>
* Parameter "params" JSON object can be
* the same as {@link KJUR.asn1.x509.TBSCertificate}.
* Then they are used to generate TBSCertificate.
* Additionally just for Certificate, following parameters can be used:
* <ul>
* <li>{TBSCertfificate}tbsobj -
* specifies {@link KJUR.asn1.x509.TBSCertificate}
* object to be signed if needed.
* When this isn't specified,
* this will be set from other parametes of TBSCertificate.
* <li>{Object}cakey (OPTION) - specifies certificate signing private key.
* Parameter "cakey" or "sighex" shall be specified. Following
* values can be specified:
* <ul>
* <li>PKCS#1/5 or PKCS#8 PEM string of private key
* <li>RSAKey/DSA/ECDSA key object. {@link KEYUTIL.getKey} is useful
* to generate a key object.
* </ul>
*
* - tbscertobj - specify `KJUR.asn1.x509.TBSCertificate` object
* - prvkeyobj - specify `RSAKey`, `KJUR.crypto.ECDSA` or `KJUR.crypto.DSA` object for CA private key to sign the certificate
*
* NOTE1: 'params' can be omitted.
* <li>{String}sighex (OPTION) - hexadecimal string of signature value
* (i.e. ASN.1 value(V) of signatureValue BIT STRING without
* unused bits)
* </ul>
* CAUTION: APIs of this class have been totally updated without
* backward compatibility since jsrsasign 9.0.0.<br/>
* NOTE1: 'params' can be omitted.<br/>
* NOTE2: DSA/ECDSA is also supported for CA signging key from asn1x509 1.0.6.
* @example
* var caKey = KEYUTIL.getKey(caKeyPEM); // CA's private key
* var cert = new KJUR.asn1x509.Certificate({'tbscertobj': tbs, 'prvkeyobj': caKey});
* cert.sign(); // issue certificate by CA's private key
* var certPEM = cert.getPEMString();
* var cert = new KJUR.asn1.x509.Certificate({
* version: 3,
* serial: {hex: "1234..."},
* sigalg: "SHA256withRSAandMGF1",
* ...
* sighex: "1d3f..." // sign() method won't be called
* });
*
* // Certificate ::= SEQUENCE {
* // tbsCertificate TBSCertificate,
* // signatureAlgorithm AlgorithmIdentifier,
* // signature BIT STRING }
* // sighex will by calculated by signing with cakey
* var cert = new KJUR.asn1.x509.Certificate({
* version: 3,
* serial: {hex: "2345..."},
* sigalg: "SHA256withRSA",
* ...
* cakey: "-----BEGIN PRIVATE KEY..."
* });
*
* // use TBSCertificate object to sign
* var cert = new KJUR.asn1.x509.Certificate({
* tbsobj: <<OBJ>>,
* sigalg: "SHA256withRSA",
* cakey: "-----BEGIN PRIVATE KEY..."
* });
*/
class Certificate extends ASN1Object {
constructor(params?: { prvkeyobj?: RSAKey | crypto.ECDSA | crypto.DSA | undefined; tbscertobj?: TBSCertificate | undefined });
constructor(params?: X509CertificateParams);
/**
* sign TBSCertificate and set signature value internally
* set parameter<br/>
* @param params JSON object of certificate parameters
* @description
* This method will set parameter
* {@link KJUR.asn1.x509.Certificate#params}
* to this object.
* @example
* var cert = new KJUR.asn1.x509.Certificate({tbscertobj: tbs, prvkeyobj: prvKey});
* cert.sign();
* cert = new KJUR.asn1.x509.Certificate();
* cert.setByParam({
* version: 3,
* serial: {hex: "1234..."},
* ...
* });
*/
sign(): void;
setByParam(params: X509CertificateParams): void;
/**
* set signature value internally by hex string
* @example
* var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs});
* cert.setSignatureHex('01020304');
*/
setSignatureHex(sigHex: string): void;
getEncodedHex(): string;
/**
* get PEM formatted certificate string after signed

@@ -59,3 +120,4 @@ * @return PEM formatted string of certificate

getPEM(): string;
getEncodedHex(): string;
}
}
declare namespace jsrsasign.KJUR.asn1.x509 {
/**
* ASN.1 TBSCertificate structure class
* @param params associative array of parameters (ex. {})
* ASN.1 TBSCertificate structure class<br/>
* @param params JSON object of TBSCertificate parameters
*
* @description
* <br/>
* NOTE: TBSCertificate class is updated without backward
* compatibility from jsrsasign 9.0.0 asn1x509 2.0.0.
* Most of methods are removed and parameters can be set
* by JSON object.
*
* @example
* var o = new KJUR.asn1.x509.TBSCertificate();
* o.setSerialNumberByParam({'int': 4});
* o.setSignatureAlgByParam({'name': 'SHA1withRSA'});
* o.setIssuerByParam({'str': '/C=US/O=a'});
* o.setNotBeforeByParam({'str': '130504235959Z'});
* o.setNotAfterByParam({'str': '140504235959Z'});
* o.setSubjectByParam({'str': '/C=US/CN=b'});
* o.setSubjectPublicKey(rsaPubKey);
* o.appendExtension(new KJUR.asn1.x509.BasicConstraints({'cA':true}));
* o.appendExtension(new KJUR.asn1.x509.KeyUsage({'bin':'11'}));
* new TBSCertificate({
* version: 3, // this can be omitted, the default is 3.
* serial: {hex: "1234..."}, // DERInteger parameter
* sigalg: "SHA256withRSA",
* issuer: {array:[[{type:'O',value:'Test',ds:'prn'}]]}, // X500Name parameter
* notbefore: "151231235959Z", // string, passed to Time
* notafter: "251231235959Z", // string, passed to Time
* subject: {array:[[{type:'O',value:'Test',ds:'prn'}]]}, // X500Name parameter
* sbjpubkey: "-----BEGIN...", // KEYUTIL.getKey pubkey parameter
* // As for extension parameters, please see extension class
* // All extension parameters need to have "extname" parameter additionaly.
* ext:[{
* extname:"keyUsage",critical:true,
* names:["digitalSignature","keyEncipherment"]
* },{
* extname:"cRLDistributionPoints",
* array:[{dpname:{full:[{uri:"http://example.com/a1.crl"}]}}]
* }, ...]
* })
*
* var tbsc = new TBSCertificate();
* tbsc.setByParam({version:3,serial:{hex:'1234...'},...});
*/
class TBSCertificate extends ASN1Object {
constructor();
private _initialize(): void;
constructor(params?: CertificateTBSParams);
/**
* set serial number field by parameter
* @param intParam DERInteger param
* get array of ASN.1 object for extensions<br/>
* @param params JSON object of TBSCertificate parameters
* @example
* tbsc.setSerialNumberByParam({'int': 3});
* tbsc = new KJUR.asn1.x509.TBSCertificate();
* tbsc.setByParam({version:3, serial:{hex:'1234...'},...});
*/
setSerialNumberByParam(intParam: IntegerParam): void;
setByParam(params: CertificateTBSParams): void;
/**
* set signature algorithm field by parameter
* @param algIdParam AlgorithmIdentifier parameter
* @example
* tbsc.setSignatureAlgByParam({'name': 'SHA1withRSA'});
*/
setSignatureAlgByParam(algIdParam: NameParam): void;
/**
* set issuer name field by parameter
* @param x500NameParam X500Name parameter
* @example
* tbsc.setIssuerParam({'str': '/C=US/CN=b'});
* @see KJUR.asn1.x509.X500Name
*/
setIssuerByParam(x500NameParam: StringParam): void;
/**
* set notBefore field by parameter
* @param timeParam Time parameter
* @example
* tbsc.setNotBeforeByParam({'str': '130508235959Z'});
* @see KJUR.asn1.x509.Time
*/
setNotBeforeByParam(timeParam: StringParam): void;
/**
* set notAfter field by parameter
* @param timeParam Time parameter
* @example
* tbsc.setNotAfterByParam({'str': '130508235959Z'});
* @see KJUR.asn1.x509.Time
*/
setNotAfterByParam(timeParam: StringParam): void;
/**
* set subject name field by parameter
* @param x500NameParam X500Name parameter
* @example
* tbsc.setSubjectParam({'str': '/C=US/CN=b'});
* @see KJUR.asn1.x509.X500Name
*/
setSubjectByParam(x500NameParam: StringParam): void;
/**
* set subject public key info field by key object
* @param param `KJUR.asn1.x509.SubjectPublicKeyInfo` class constructor parameter
* @example
* tbsc.setSubjectPublicKey(keyobj);
* @see KJUR.asn1.x509.SubjectPublicKeyInfo
*/
setSubjectPublicKey(param?: RSAKey | crypto.DSA | crypto.ECDSA): void;
/**
* set subject public key info by RSA/ECDSA/DSA key parameter
* @param keyParam public key parameter which passed to `KEYUTIL.getKey` argument
* @example
* tbsc.setSubjectPublicKeyByGetKeyParam(certPEMString); // or
* tbsc.setSubjectPublicKeyByGetKeyParam(pkcs8PublicKeyPEMString); // or
* tbsc.setSubjectPublicKeyByGetKeyParam(kjurCryptoECDSAKeyObject); // et.al.
* @see KJUR.asn1.x509.SubjectPublicKeyInfo
* @see KEYUTIL.getKey
*/
setSubjectPublicKeyByGetKey(
keyParam: RSAKey | crypto.ECDSA | crypto.DSA | jws.JWS.JsonWebKey | { n: string; e: string } | string,
): void;
/**
* append X.509v3 extension to this object
* @param extObj X.509v3 Extension object
* @example
* tbsc.appendExtension(new KJUR.asn1.x509.BasicConstraints({'cA':true, 'critical': true}));
* tbsc.appendExtension(new KJUR.asn1.x509.KeyUsage({'bin':'11'}));
* @see KJUR.asn1.x509.Extension
*/
appendExtension(extObj: Extension): void;
/**
* append X.509v3 extension to this object by name and parameters
* @param name name of X.509v3 Extension object
* @param extParams parameters as argument of Extension constructor.
* @example
* var o = new KJUR.asn1.x509.TBSCertificate();
* o.appendExtensionByName('BasicConstraints', {'cA':true, 'critical': true});
* o.appendExtensionByName('KeyUsage', {'bin':'11'});
* o.appendExtensionByName('CRLDistributionPoints', {uri: 'http://aaa.com/a.crl'});
* o.appendExtensionByName('ExtKeyUsage', {array: [{name: 'clientAuth'}]});
* o.appendExtensionByName('AuthorityKeyIdentifier', {kid: '1234ab..'});
* o.appendExtensionByName('AuthorityInfoAccess', {array: [{accessMethod:{oid:...},accessLocation:{uri:...}}]});
* @see KJUR.asn1.x509.Extension
*/
appendExtensionByName(name: string, extParams: Extension): void;
getEncodedHex(): string;
}
}
declare namespace jsrsasign {
type IdentityArray = Array<[{ type: string; value: string; ds: string }]>;
interface X509Extension {

@@ -9,6 +11,24 @@ oid: string;

interface IdentityResponse {
array: Array<[{ type: string; value: string; ds: string }]>;
array: IdentityArray;
str: string;
}
interface CertificateTBSParams {
version?: number; // this can be omitted, the default is 3.
serial: Hex | { int: number } | { bigint: number } | number; // DERInteger parameter
issuer: { array: IdentityArray } | { str: string } | { array: IdentityArray, str: string }; // X500Name parameter
sigalg?: string;
notbefore: string; // string, passed to Time
notafter: string; // string, passed to Time
subject: { array: IdentityArray } | { str: string } | { array: IdentityArray, str: string }; // X500Name parameter
sbjpubkey: RSAKey
| ECCPrivateKey
| KJUR.crypto.ECDSA
| KJUR.crypto.DSA
| KJUR.jws.JWS.JsonWebKey
| { n: string; e: string }
| string; // KEYUTIL.getKey pubkey parameter
ext: Array<{ extname: string, [x: string]: any }>;
}
interface Hex {

@@ -15,0 +35,0 @@ hex: string;

{
"name": "@types/jsrsasign",
"version": "9.0.2",
"version": "9.0.3",
"description": "TypeScript definitions for jsrsasign",

@@ -23,4 +23,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jsrsasign",

"dependencies": {},
"typesPublisherContentHash": "3a2c45222f82b9acc6bcc1c91220087f57a6e13e88bb75d664f1ee5580a2d97e",
"typesPublisherContentHash": "cb0017e336439e07e1b68557c91faf624a6ec7e41dfe07181e6a46ed43ab74d7",
"typeScriptVersion": "3.8"
}

@@ -11,3 +11,3 @@ # Installation

### Additional Details
* Last updated: Mon, 03 Jan 2022 08:01:28 GMT
* Last updated: Mon, 03 Jan 2022 21:01:35 GMT
* Dependencies: none

@@ -14,0 +14,0 @@ * Global values: `jsrsasign`, `lang`

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc