Using certutil to implement Hex2bin and BASE64 encryption and decryption methods _dos/bat

Source: Internet
Author: User
Tags base64 error code pfx file

Applied to: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2
Certutil

Certutil.exe is a command-line program that is installed as part of Certificate Services in the Windows Server 2003 family.
You can also obtain Certutil.exe (http://go.microsoft.com/fwlink/?LinkID=8136) (the page may be in English) by downloading and installing the Windows Server 2003 Administration Toolkit.
You can use Certutil.exe to dump and display certification authority (CA) configuration information, configure Certificate Services, back up and restore the CA components, and verify certificates, key pairs, and certificate chains.

More detailed information can refer to this article: https://technet.microsoft.com/zh-cn/library/cc773087 (ws.10). aspx


Certutil is a vista and Win7 external command that is actually used to manage certificates, but also has "crooked" usage
As an example:

@echo off

Echo 6C 6C 6F 2C 6F >hex.txt
:: Generate Hex.txt, machine code corresponding to the content is Hallo world!

Certutil-decodehex hex.txt bin.txt
:: Hex2bin

certutil-encode bin.txt
:: Encode.txt

Certutil-decode Encode.txt Decode.txt
:: Base64_decode

Pause

The system helps as follows:
Verb:
-dump-Dump configuration information or files
-ASN--Analyzing ASN.1 files

-decodehex--decoding a hexadecimal-encoded file
-decode--Decoding Base64 encoded files
-encode--encodes the file as Base64

-deny--Reject pending request
-resubmit--Resubmit pending request
-setattributes--setting properties for pending requests
-setextension--Set up extensions for pending requests
-revoke--Revocation Certificate
-isvalid--Displays the current certificate deployment

-getconfig--Get the default configuration string
-ping--Ping Active Directory Certificate Services Request interface
-pingadmin-Ping Active Directory Certificate Services Management interface
-cainfo--Displaying CA information
-ca.cert--Retrieving the CA's certificate
-ca.chain--Retrieving the CA's certificate chain
-GETCRL--Getting CRLs
-CRL-Publish a new CRL [or delta CRL only]
-shutdown--Turn off Active Directory Certificate Services

-installcert--Installing a certification Authority certificate
-renewcert-Renewing Certification Authority certificate

-schema--Dump certificate Schema
-view--Dump Certificate view
-db-Dump the original database
-deleterow--Delete server database rows

-backup--Backup Active Directory Certificate Services
-backupdb--Back up the Active Directory Certificate Services database
-backupkey--Backs up Active Directory Certificate Services certificates and private keys
-restore--Restore Active Directory Certificate Services
-restoredb--Restore the Active Directory Certificate Services database
-restorekey-Restore Active Directory Certificate Services certificate and private key
-IMPORTPFX--Import certificate and private key
-dynamicfilelist--Displaying a list of dynamic files
-databaselocations--Show Database location
-hashfile--Generate and display cryptographic hashes from files

-store--Dump certificate store
-addstore--Adding certificates to storage
-delstore--Removing certificates from storage
-verifystore--Verifying certificates in storage
-repairstore--fix key associations, or update certificate attributes or key security descriptors
-viewstore--Dump certificate store
-viewdelstore--Removing certificates from storage

-dspublish-Publish a certificate or CRL to Active Directory

-adtemplate--Show AD templates
-template--Show enrollment policy templates
-templatecas--The CA that displays the template
-catemplates--Displays the template for the CA
-enrollmentserverurl--Displays, adds, or deletes the registered server URL associated with the CA
-ADCA--Show AD CA
-CA--Show enrollment policy CA
-policy--Show enrollment policy
-policycache--Show or delete registration policy cache entries
-credstore--show, add, or delete credential store items
-installdefaulttemplates--Install the default certificate template
-urlcache--Show or delete URL cache entries
-pulse--Pausing autoenrollment events
-machineinfo--Displays Active Directory computer object information
-dcinfo--Display domain controller information
-entinfo--Display enterprise information
-tcainfo--Displaying CA information
-scinfo--Displaying smart card information

-scroots--Managing smart card root Certificates

-verifykeys--Verifying public/private key set
-verify--Verifying certificates, CRLs, or chains
-sign-Re-sign a CRL or certificate

-vroot--Create/delete Web virtual root and File share
-vocsproot--Create/Remove Web virtual root for OCSP Web Proxy
-addenrollmentserver--Adding a registered server application
-deleteenrollmentserver--Delete registered server application
-oid--Display ObjectId or set display name
-error--Display error code message text
-getreg--Displaying registry values
-setreg--Setting registry values
-delreg--Delete registry values

-IMPORTKMS-Import user keys and certificates to the server database for key archival
-importcert--Importing certificate files into a database
-getkey--Retrieving archived private key recovery points
-recoverkey-Restores the archived private key
-MERGEPFX--Merging PFX files
-CONVERTEPF-Convert a PFX file to a EPF file
-? --Displays the usage message


CertUtil-? --Display verb list (named list)
Certutil-dump-? --Displays the help text for the "dump" verb
Certutil-v-? --Show all help text for all verbs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.