Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-native-openpgp
Advanced tools
React-Native OpenPGP is an OpenPGP.js implementation made to work under React-Native.
React-Native-OpenPGP is a Javascript implementation of the OpenPGP protocol based on OpenPGP.js.
npm install --save github:orhan/react-native-openpgp
rnpm link react-native-openpgp
Note: Run npm install -g rnpm
if you haven't installed RNPM (React-Native Package Manager) yet!
Alternatively you can add the Android and iOS modules library by following the official guide.
var openpgp = require('react-native-openpgp');
var options, encrypted;
options = {
data: 'Hello, World!', // input as String
passwords: ['secret stuff'] // multiple passwords possible
};
openpgp.encrypt(options).then(function(ciphertext) {
encrypted = ciphertext.data; // '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----'
});
options = {
message: openpgp.readMessage(encrypted), // parse armored message
password: 'secret stuff' // decrypt with password
};
openpgp.decrypt(options).then(function(plaintext) {
return plaintext.data; // 'Hello, World!'
});
var options, encrypted;
var pubkey = '-----BEGIN PGP PUBLIC KEY BLOCK ... END PGP PUBLIC KEY BLOCK-----';
var privkey = '-----BEGIN PGP PRIVATE KEY BLOCK ... END PGP PRIVATE KEY BLOCK-----';
options = {
data: new Uint8Array([0x01, 0x01, 0x01]), // input as Uint8Array
publicKeys: openpgp.readArmoredKey(pubkey).keys, // for encryption
privateKeys: openpgp.readArmoredKey(privkey).keys, // for signing (optional)
armor: false // don't ASCII armor
};
openpgp.encrypt(options).then(function(ciphertext) {
encrypted = ciphertext.message.packets.write(); // get raw encrypted packets as Uint8Array
});
options = {
message: openpgp.readBinaryMessage(encrypted), // parse encrypted bytes
publicKeys: openpgp.readArmoredKey(pubkey).keys, // for verification (optional)
privateKey: openpgp.readArmoredKey(privkey).keys[0], // for decryption
format: 'binary' // output as Uint8Array
};
openpgp.decrypt(options).then(function(plaintext) {
return plaintext.data // Uint8Array([0x01, 0x01, 0x01])
});
var options = {
userIds: [{ name:'Jon Smith', email:'jon@example.com' }], // multiple user IDs
numBits: 2048, // RSA key size
passphrase: 'super long and hard to guess secret' // protects the private key
};
openpgp.generateKey(options).then(function(key) {
var privkey = key.privateKeyArmored; // '-----BEGIN PGP PRIVATE KEY BLOCK ... '
var pubkey = key.publicKeyArmored; // '-----BEGIN PGP PUBLIC KEY BLOCK ... '
});
FAQs
React-Native OpenPGP is an OpenPGP.js implementation made to work under React-Native.
The npm package react-native-openpgp receives a total of 121 weekly downloads. As such, react-native-openpgp popularity was classified as not popular.
We found that react-native-openpgp 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.