Rename PGP "armor" occurrences to "armour"

This commit is contained in:
toby 2017-03-15 12:43:01 -04:00
parent f2f3bdc923
commit bc4d7e86e3
4 changed files with 53 additions and 53 deletions

View file

@ -102,8 +102,8 @@ var Categories = [
"Verify PGP Cleartext", "Verify PGP Cleartext",
"Generate PGP Key Pair", "Generate PGP Key Pair",
"Detach PGP Cleartext", "Detach PGP Cleartext",
"Add PGP ASCII Armor", "Add PGP ASCII Armour",
"Remove PGP ASCII Armor", "Remove PGP ASCII Armour",
] ]
}, },
{ {
@ -125,8 +125,8 @@ var Categories = [
"Verify PGP Cleartext", "Verify PGP Cleartext",
"Detach PGP Cleartext", "Detach PGP Cleartext",
"Generate PGP Key Pair", "Generate PGP Key Pair",
"Add PGP ASCII Armor", "Add PGP ASCII Armour",
"Remove PGP ASCII Armor", "Remove PGP ASCII Armour",
] ]
}, },
{ {

View file

@ -3149,7 +3149,7 @@ var OperationConfig = {
] ]
}, },
"PGP Encrypt": { "PGP Encrypt": {
description: "Input: An ASCII-Armored PGP public key.<br><br>Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.<br><br>This function relies on OpenPGP.js for the implementation of PGP.<br><br>See more at https://openpgpjs.org/", description: "Input: An ASCII-Armoured PGP public key.<br><br>Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.<br><br>This function relies on OpenPGP.js for the implementation of PGP.<br><br>See more at https://openpgpjs.org/",
run: PGP.runEncrypt, run: PGP.runEncrypt,
inputType: "string", inputType: "string",
outputType: "string", outputType: "string",
@ -3162,7 +3162,7 @@ var OperationConfig = {
] ]
}, },
"PGP Decrypt": { "PGP Decrypt": {
description: "Input: An ASCII-Armored PGP private key (and optionally, the password needed to decrypt the private key).<br><br>Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.<br><br>This function relies on OpenPGP.js for the implementation of PGP.<br><br>See more at https://openpgpjs.org/", description: "Input: An ASCII-Armoured PGP private key (and optionally, the password needed to decrypt the private key).<br><br>Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.<br><br>This function relies on OpenPGP.js for the implementation of PGP.<br><br>See more at https://openpgpjs.org/",
run: PGP.runDecrypt, run: PGP.runDecrypt,
inputType: "string", inputType: "string",
outputType: "string", outputType: "string",
@ -3180,7 +3180,7 @@ var OperationConfig = {
] ]
}, },
"PGP Sign": { "PGP Sign": {
description: "Input: An ASCII-Armored PGP private key (and optionally, the password needed to decrypt the private key); the public key of the recipient.<br><br>This operation uses PGP to produce an encrypted digital signature.<br><br>Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.<br><br>This function relies on OpenPGP.js for the implementation of PGP.<br><br>See more at https://openpgpjs.org/", description: "Input: An ASCII-Armoured PGP private key (and optionally, the password needed to decrypt the private key); the public key of the recipient.<br><br>This operation uses PGP to produce an encrypted digital signature.<br><br>Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.<br><br>This function relies on OpenPGP.js for the implementation of PGP.<br><br>See more at https://openpgpjs.org/",
run: PGP.runSign, run: PGP.runSign,
inputType: "string", inputType: "string",
outputType: "string", outputType: "string",
@ -3203,7 +3203,7 @@ var OperationConfig = {
] ]
}, },
"PGP Verify": { "PGP Verify": {
description: "Input: An ASCII-Armored PGP public key.<br><br>This operation uses PGP to decrypt and verify an encrypted digital signature.<br><br>Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.<br><br>This function relies on OpenPGP.js for the implementation of PGP.<br><br>See more at https://openpgpjs.org/", description: "Input: An ASCII-Armoured PGP public key.<br><br>This operation uses PGP to decrypt and verify an encrypted digital signature.<br><br>Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.<br><br>This function relies on OpenPGP.js for the implementation of PGP.<br><br>See more at https://openpgpjs.org/",
run: PGP.runVerify, run: PGP.runVerify,
inputType: "string", inputType: "string",
outputType: "string", outputType: "string",
@ -3255,14 +3255,14 @@ var OperationConfig = {
value: "", value: "",
}, },
{ {
name: "ASCII armored signature", name: "ASCII armoured signature",
type: "text", type: "text",
value: "", value: "",
}, },
] ]
}, },
"Sign PGP Cleartext": { "Sign PGP Cleartext": {
description: "Input: An ASCII-Armored PGP private key (and optionally, the password needed to decrypt the private key).<br><br>This operation uses PGP to produce a digital signature.<br><br>Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.<br><br>This function relies on OpenPGP.js for the implementation of PGP.<br><br>See more at https://openpgpjs.org/", description: "Input: An ASCII-Armoured PGP private key (and optionally, the password needed to decrypt the private key).<br><br>This operation uses PGP to produce a digital signature.<br><br>Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.<br><br>This function relies on OpenPGP.js for the implementation of PGP.<br><br>See more at https://openpgpjs.org/",
run: PGP.runSignCleartext, run: PGP.runSignCleartext,
inputType: "string", inputType: "string",
outputType: "string", outputType: "string",
@ -3280,7 +3280,7 @@ var OperationConfig = {
] ]
}, },
"Verify PGP Cleartext": { "Verify PGP Cleartext": {
description: "Input: An ASCII-Armored PGP public key.<br><br>This operation uses PGP to verify a cleartext digital signature.<br><br>Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.<br><br>This function relies on OpenPGP.js for the implementation of PGP.<br><br>See more at https://openpgpjs.org/", description: "Input: An ASCII-Armoured PGP public key.<br><br>This operation uses PGP to verify a cleartext digital signature.<br><br>Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.<br><br>This function relies on OpenPGP.js for the implementation of PGP.<br><br>See more at https://openpgpjs.org/",
run: PGP.runVerifyCleartext, run: PGP.runVerifyCleartext,
inputType: "string", inputType: "string",
outputType: "string", outputType: "string",
@ -3328,22 +3328,22 @@ var OperationConfig = {
args: [ args: [
], ],
}, },
"Add PGP ASCII Armor": { "Add PGP ASCII Armour": {
description: "", description: "",
run: PGP.runAddArmor, run: PGP.runAddArmour,
inputType: "byteArray", inputType: "byteArray",
outputType: "string", outputType: "string",
args: [ args: [
{ {
name: "Armor type", name: "Armour type",
type: "option", type: "option",
value: PGP.ARMOR_TYPES, value: PGP.ARMOUR_TYPES,
}, },
], ],
}, },
"Remove PGP ASCII Armor": { "Remove PGP ASCII Armour": {
description: "", description: "",
run: PGP.runRemoveArmor, run: PGP.runRemoveArmour,
inputType: "string", inputType: "string",
outputType: "byteArray", outputType: "byteArray",
args: [ args: [

View file

@ -14,7 +14,7 @@ var PGP = {
* @constant * @constant
* @default * @default
*/ */
ARMOR_TYPES: [ ARMOUR_TYPES: [
"Message", "Message",
"Public key", "Public key",
"Private key", "Private key",
@ -25,7 +25,7 @@ var PGP = {
* @constant * @constant
* @default * @default
*/ */
ARMOR_TYPE_MAPPING: { ARMOUR_TYPE_MAPPING: {
"Message": 3, "Message": 3,
"Public key": 4, "Public key": 4,
"Private key": 5, "Private key": 5,
@ -240,7 +240,7 @@ var PGP = {
/** /**
* Signs the input using PGP and outputs the plaintext, the raw PGP signature, and the ASCII armored signature files. * Signs the input using PGP and outputs the plaintext, the raw PGP signature, and the ASCII armoured signature files.
* *
* @param {string} input - data to be signed * @param {string} input - data to be signed
* @param {Object[]} args * @param {Object[]} args
@ -271,15 +271,15 @@ var PGP = {
var signature = signedMessage.packets.filterByTag(openpgp.enums.packet.signature); var signature = signedMessage.packets.filterByTag(openpgp.enums.packet.signature);
var rawSignatureBytes = signature.write(); var rawSignatureBytes = signature.write();
var armoredMessage = openpgp.armor.encode( var armouredMessage = openpgp.armor.encode(
openpgp.enums.armor.message, openpgp.enums.armor.message,
rawSignatureBytes rawSignatureBytes
); );
armoredMessage = armoredMessage.replace( armouredMessage = armouredMessage.replace(
"-----BEGIN PGP MESSAGE-----\r\n", "-----BEGIN PGP MESSAGE-----\r\n",
"-----BEGIN PGP SIGNATURE-----\r\n" "-----BEGIN PGP SIGNATURE-----\r\n"
); );
armoredMessage = armoredMessage.replace( armouredMessage = armouredMessage.replace(
"-----END PGP MESSAGE-----\r\n", "-----END PGP MESSAGE-----\r\n",
"-----END PGP SIGNATURE-----\r\n" "-----END PGP SIGNATURE-----\r\n"
); );
@ -291,9 +291,9 @@ var PGP = {
bytes: bytes, bytes: bytes,
}, { }, {
fileName: "msg.asc", fileName: "msg.asc",
size: armoredMessage.length, size: armouredMessage.length,
contents: armoredMessage, contents: armouredMessage,
bytes: openpgp.util.str2Uint8Array(armoredMessage), bytes: openpgp.util.str2Uint8Array(armouredMessage),
}, { }, {
fileName: "msg.sig", fileName: "msg.sig",
size: rawSignatureBytes.length, size: rawSignatureBytes.length,
@ -315,7 +315,7 @@ var PGP = {
*/ */
runVerifyDetached: function (input, args) { runVerifyDetached: function (input, args) {
var publicKey = args[0], var publicKey = args[0],
armoredSignature = args[1]; armouredSignature = args[1];
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
try { try {
@ -327,10 +327,10 @@ var PGP = {
try { try {
var message = openpgp.message.readSignedContent( var message = openpgp.message.readSignedContent(
input, input,
armoredSignature armouredSignature
); );
} catch (err) { } catch (err) {
return reject("Could not read armored signature or message: " + err); return reject("Could not read armoured signature or message: " + err);
} }
@ -475,7 +475,7 @@ var PGP = {
* *
* @param {string} input is ignored * @param {string} input is ignored
* @param {Object[]} args * @param {Object[]} args
* @returns {string} - armored public key and private key separated by whitespace. * @returns {string} - armoured public key and private key separated by whitespace.
*/ */
runGenKeyPair: function (input, args) { runGenKeyPair: function (input, args) {
var password = args[0], var password = args[0],
@ -529,15 +529,15 @@ var PGP = {
var signature = message.packets.filterByTag(openpgp.enums.packet.signature); var signature = message.packets.filterByTag(openpgp.enums.packet.signature);
var rawSignatureBytes = signature.write(); var rawSignatureBytes = signature.write();
var armoredMessage = openpgp.armor.encode( var armouredMessage = openpgp.armor.encode(
openpgp.enums.armor.message, openpgp.enums.armor.message,
rawSignatureBytes rawSignatureBytes
); );
armoredMessage = armoredMessage.replace( armouredMessage = armouredMessage.replace(
"-----BEGIN PGP MESSAGE-----\r\n", "-----BEGIN PGP MESSAGE-----\r\n",
"-----BEGIN PGP SIGNATURE-----\r\n" "-----BEGIN PGP SIGNATURE-----\r\n"
); );
armoredMessage = armoredMessage.replace( armouredMessage = armouredMessage.replace(
"-----END PGP MESSAGE-----\r\n", "-----END PGP MESSAGE-----\r\n",
"-----END PGP SIGNATURE-----\r\n" "-----END PGP SIGNATURE-----\r\n"
); );
@ -549,9 +549,9 @@ var PGP = {
bytes: clearbytes, bytes: clearbytes,
}, { }, {
fileName: "msg.asc", fileName: "msg.asc",
size: armoredMessage.length, size: armouredMessage.length,
contents: armoredMessage, contents: armouredMessage,
bytes: openpgp.util.str2Uint8Array(armoredMessage), bytes: openpgp.util.str2Uint8Array(armouredMessage),
}, { }, {
fileName: "msg.sig", fileName: "msg.sig",
size: rawSignatureBytes.length, size: rawSignatureBytes.length,
@ -565,26 +565,26 @@ var PGP = {
/** /**
* Turns raw PGP bytes into an ASCII armored string. * Turns raw PGP bytes into an ASCII armoured string.
* *
* @param {byteArray} input * @param {byteArray} input
* @param {Object[]} args * @param {Object[]} args
* @returns {string} - armored public key and private key separated by whitespace. * @returns {string} - armoured public key and private key separated by whitespace.
*/ */
runAddArmor: function (input, args) { runAddArmour: function (input, args) {
var armorType = PGP.ARMOR_TYPE_MAPPING[args[0]]; var armourType = PGP.ARMOUR_TYPE_MAPPING[args[0]];
return openpgp.armor.encode(armorType, input); return openpgp.armor.encode(armourType, input);
}, },
/** /**
* Turns an ASCII armored string into raw PGP bytes. * Turns an ASCII armoured string into raw PGP bytes.
* *
* @param {string} input * @param {string} input
* @param {Object[]} args * @param {Object[]} args
* @returns {byteArray} - armored public key and private key separated by whitespace. * @returns {byteArray} - armoured public key and private key separated by whitespace.
*/ */
runRemoveArmor: function (input, args) { runRemoveArmour: function (input, args) {
var decoded = openpgp.armor.decode(input); var decoded = openpgp.armor.decode(input);
var uint8bytes = decoded.data; var uint8bytes = decoded.data;
var bytes = Array.prototype.slice.call(uint8bytes); var bytes = Array.prototype.slice.call(uint8bytes);

View file

@ -360,7 +360,7 @@ TestRegister.addTests([{
}); });
TestRegister.addTests(CYBERCHEF_GENERATED_KEY_PAIRS.map(function(keyPair) { TestRegister.addTests(CYBERCHEF_GENERATED_KEY_PAIRS.map(function(keyPair) {
var testName = "Remove PGP ASCII Armor, Add PGP ASCII Armor: Public Key '$name'"; var testName = "Remove PGP ASCII Armour, Add PGP ASCII Armour: Public Key '$name'";
testName = testName.replace("$name", keyPair.name); testName = testName.replace("$name", keyPair.name);
return { return {
@ -370,11 +370,11 @@ TestRegister.addTests(CYBERCHEF_GENERATED_KEY_PAIRS.map(function(keyPair) {
ignoreWhitespace: true, ignoreWhitespace: true,
recipeConfig: [ recipeConfig: [
{ {
op: "Remove PGP ASCII Armor", op: "Remove PGP ASCII Armour",
args: [], args: [],
}, },
{ {
op: "Add PGP ASCII Armor", op: "Add PGP ASCII Armour",
args: ["Public key"], args: ["Public key"],
}, },
], ],
@ -382,7 +382,7 @@ TestRegister.addTests(CYBERCHEF_GENERATED_KEY_PAIRS.map(function(keyPair) {
})); }));
TestRegister.addTests(CYBERCHEF_GENERATED_KEY_PAIRS.map(function(keyPair) { TestRegister.addTests(CYBERCHEF_GENERATED_KEY_PAIRS.map(function(keyPair) {
var testName = "Remove PGP ASCII Armor, Add PGP ASCII Armor: Private Key '$name'"; var testName = "Remove PGP ASCII Armour, Add PGP ASCII Armour: Private Key '$name'";
testName = testName.replace("$name", keyPair.name); testName = testName.replace("$name", keyPair.name);
return { return {
@ -392,11 +392,11 @@ TestRegister.addTests(CYBERCHEF_GENERATED_KEY_PAIRS.map(function(keyPair) {
ignoreWhitespace: true, ignoreWhitespace: true,
recipeConfig: [ recipeConfig: [
{ {
op: "Remove PGP ASCII Armor", op: "Remove PGP ASCII Armour",
args: [], args: [],
}, },
{ {
op: "Add PGP ASCII Armor", op: "Add PGP ASCII Armour",
args: ["Private key"], args: ["Private key"],
}, },
], ],
@ -406,7 +406,7 @@ TestRegister.addTests(CYBERCHEF_GENERATED_KEY_PAIRS.map(function(keyPair) {
PGP_TEST_KEY_PAIRS.forEach(function(keyPair) { PGP_TEST_KEY_PAIRS.forEach(function(keyPair) {
TestRegister.addTests( TestRegister.addTests(
["", "hello world"].map(function(message, messageIndex) { ["", "hello world"].map(function(message, messageIndex) {
var testName = "PGP Encrypt, Remove PGP ASCII Armor, Add PGP ASCII Armor, PGP Decrypt: Message $message '$name'"; var testName = "PGP Encrypt, Remove PGP ASCII Armour, Add PGP ASCII Armour, PGP Decrypt: Message $message '$name'";
testName = testName.replace("$message", messageIndex); testName = testName.replace("$message", messageIndex);
testName = testName.replace("$name", keyPair.name); testName = testName.replace("$name", keyPair.name);
@ -421,7 +421,7 @@ PGP_TEST_KEY_PAIRS.forEach(function(keyPair) {
args: [keyPair.pub], args: [keyPair.pub],
}, },
{ {
op: "Remove PGP ASCII Armor", op: "Remove PGP ASCII Armour",
args: [], args: [],
}, },
{ {
@ -433,7 +433,7 @@ PGP_TEST_KEY_PAIRS.forEach(function(keyPair) {
args: ["None"], args: ["None"],
}, },
{ {
op: "Add PGP ASCII Armor", op: "Add PGP ASCII Armour",
args: ["Message"], args: ["Message"],
}, },
{ {