Constructor
new SignedDataContentInfo(contentInfo)
This class encapsulates a CMS object of content type signed-data.
Use encloseContent or setEnclosed methods to add a enclosed content before add signatures
Parameters:
| Name | Type | Description |
|---|---|---|
contentInfo |
FormatedData | GostASN1.ContentInfo | The signed content. |
- Source:
Extends
Members
-
isDegenerate
-
Indicates if this object has any signers i.e. checks for the absence of any SignerInfo structures. CMS (RFC-2630) defines a degenerate object as one which has no signers.
- Source:
Methods
-
addSignature(signerKey, signerCert, signedAttrs, unsignedAttrs) → {Promise}
-
Add a Signer using the the IssuerAndSerialNumber as the SignerIdentifier i.e a Version1 CMSSignerInfo or SubjectPublicKeyIdentifier as the SignerIdentifier i.e a Version3 CMSSignerInfo.
Parameters:
Name Type Description signerKeyGostASN1.PrivateKeyInfo Private Key of the signer. signerCertGostCert.X509 Signer certificate or certificate chain signedAttrsGostASN1.SignedAttributes The set of signed attributes. Default undefined. If true or {} standard attributes will be appended: contentType and messageDigest unsignedAttrsGostASN1.UnsignedAttributes The set of unsigned attributes. Default undefined. - Source:
Returns:
Promise to return self object after add signature- Type
- Promise
-
check()
-
Check the object structure
- Inherited From:
- Source:
-
decode(source)
-
Decode the source to self object
Parameters:
Name Type Description sourceFormatedData Encoded data - Inherited From:
- Source:
-
encloseContent(contentInfo) → {Promise}
-
Enclose content to document.
Parameters:
Name Type Description contentInfoFormatedData | GostASN1.ContentInfo - Inherited From:
- Source:
Returns:
Promise to return self object after enclose content- Type
- Promise
-
encode(format) → {FormatedData}
-
Encode the object
Parameters:
Name Type Description formatstring Encoding format 'DER', 'CER' or 'PEM' - Inherited From:
- Source:
Returns:
- Type
- FormatedData
-
getEnclosed() → {GostASN1.ContentInfo}
-
Returns the document which attached. If the content is not attached, the CMS object which is returned will be degenerate.
- Inherited From:
- Source:
Returns:
The encapsulated CMS Object.- Type
- GostASN1.ContentInfo
-
setEnclosed(contentInfo)
-
Sets the content of attached document.
This is necessary only in detached mode.Parameters:
Name Type Description contentInfoFormatedData | GostASN1.ContentInfo The encapsulated CMS Object. - Inherited From:
- Source:
-
verify(trustPolicy, contentInfo) → {Promise}
-
Returns normally if this CMS signed data object contains at least one valid signature, according to the given trust policy; otherwise throws an Error.
In order to be considered valid, there must be at least one signature on this CMS message which is validated by one of the certificates included with it; furthermore, the validating certificate must itself be valid according to the given certificate trust policy. This latter validation process may involve examining the other certificates or CRLs included with this object, if called for by the trust policy.
If a signature is encountered for which a certification path can be found, but is invalid, an Error will be created, but will not be thrown until all other signatures have been checked. If another signature is found which is valid, then the method simply returns and no exception at all is thrown.Parameters:
Name Type Description trustPolicyGostCert.CertificateTrustPolicy The trust prolicy for verification contentInfoFormatedData | GostASN1.ContentInfo The content that was signed (optional) - Source:
Returns:
Promise to return enclosed object GostASN1.ContentInfo if signature verified- Type
- Promise
-
verifySignature(signerCert, contentInfo) → {Promise}
-
Returns successfully if this CMS signed data object contains a signature which is validated by the given certificate and data; otherwise throws an Error.
This method verifies the specified signature directly and ignores any certificates or CRLs which may be contained in this CMS object. A more complex verification process, which does make use of attached certificates and CRLs, is provided by the verify method.Parameters:
Name Type Description signerCertGostCert.X509 The signer certificate contentInfoFormatedData | GostASN1.ContentInfo The content that was signed (optional) - Source:
Returns:
Promise to return enclosed object GostASN1.ContentInfo if signature verified- Type
- Promise
-
writeDetached(createDetached)
-
Indicates if an external (detached) signature must be created.
Parameters:
Name Type Description createDetachedboolean True if detached; false otherwise. - Inherited From:
- Source: