![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
cryptomate
Advanced tools
Ergonomic, zero-dependency crypto module wrapper for ECDSA and EdDSA signatures.
Key features of the module include:
To install cryptomate
, use the following npm command:
npm i --save cryptomate
Here is an example demonstrating the use of the ECDSA functionality provided by this module:
const {ECDSA, EC_CURVE, Key, SignatureEncoding} = require('cryptomate');
// Generate an ECDSA key pair.
const ecdsa = ECDSA.withCurve(EC_CURVE.secp256k1).genKeyPair();
// Sign a message.
let message = "Hello, World!";
let signature = ecdsa.sign(message, SignatureEncoding.HEX);
// Verify the signature.
console.log(ecdsa.verify(message, signature)); // Outputs: true
// Export keys in PEM format.
let privateKeyPEM = ecdsa.toPEM(Key.privateKey);
let publicKeyPEM = ecdsa.toPEM(Key.publicKey);
// Import keys from PEM format.
let importedECDSA = ECDSA.withCurve(EC_CURVE.secp256k1).fromPEM(privateKeyPEM, Key.privateKey);
A factory method to construct an ECDSA object with a given elliptic curve.
curve
- The elliptic curve to use. This can be one of the following values:
EC_CURVE.P_256
- NIST P-256 curve.EC_CURVE.P_384
- NIST P-384 curve.EC_CURVE.P_521
- NIST P-521 curve.EC_CURVE.SECP256K1
- SECP256K1 curve.EC_CURVE.SECP256R1
- SECP256R1 curve.EC_CURVE.SECP384R1
- SECP384R1 curve.EC_CURVE.SECP521R1
- SECP521R1 curve.An ECDSA object with the given elliptic curve.
Generates a new ECDSA key pair.
An ECDSA object with a newly generated key pair.
Constructs an ECDSA object from a given PEM string.
pem
- The PEM string to construct the ECDSA object from.keyType
- The type of key to construct. This can be one of the following values:
Key.privateKey
- Private key.Key.publicKey
- Public key.An ECDSA object with the given PEM string.
Converts the ECDSA object to a PEM string.
keyType
- The type of key to convert. This can be one of the following values:
Key.privateKey
- Private key.Key.publicKey
- Public key.A PEM string representing the ECDSA object.
Extracts the public key from the ECDSA object.
A Buffer object containing the public key.
Signs a message using the ECDSA object.
message
- The message to sign.encoding
- The encoding of the message. This can be one of the following values:
SignatureEncoding.HEX
- The message is encoded in hexadecimal format.SignatureEncoding.BASE64
- The message is encoded in Base64 format.SignatureEncoding.UTF8
- The message is encoded in UTF-8 format.A Buffer object containing the signature.
Verifies a signature using the ECDSA object.
message
- The message to verify.signature
- The signature to verify.encoding
- The encoding of the message. This can be one of the following values:
SignatureEncoding.HEX
- The message is encoded in hexadecimal format.SignatureEncoding.BASE64
- The message is encoded in Base64 format.SignatureEncoding.UTF8
- The message is encoded in UTF-8 format.A boolean value indicating whether the signature is valid.
Please note that the EdDSA class shares similar method names and functionalities to the ECDSA class for key pair generation, signing and verifying messages, and importing/exporting keys in various formats. Refer to the ECDSA API documentation provided above for further details.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
NodeJS crypto module wrapper for humans
We found that cryptomate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.