Check if a .pfx or .p12 certificate is valid
npm install validate-pfxbash
npm install validate-pfx
`
Description
This package provides a simple way to validate .pfx (Personal Information Exchange) or .p12 (PKCS #12) certificate files. It helps you verify if a certificate is valid and can be used for authentication or signing purposes.
Features
- Validate .pfx and .p12 certificate files
- Check certificate expiration
- Verify certificate integrity
- Confirm password protection
Usage
`typescript
import { validatePfx } from 'validate-pfx';
// Example with file path
const result = validatePfx({
pfxPath: '/path/to/certificate.pfx',
password: 'your-certificate-password'
});
console.log(result);
// { isPfxOutdated: true|false, isPasswordOrPfxInvalid: true|false, willWork: true|false }
`
API
$3
Validates a .pfx or .p12 certificate.
#### Options
- pfxPath (string): Path to the .pfx or .p12 file
- password (string): Password for the certificate
Either pfxPath and password must be provided.
#### Returns
An object containing:
- isPfxOutdated (boolean): Whether the certificate expiration date have reached
- isPasswordOrPfxInvalid (boolean): If password is correct and certificate is valid
- willWork (boolean): if certificate is valid and password is correct
Development
`bash
Install dependencies
npm install
Run in development mode
npm run dev
Build the project
npm run build
``