"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.default = void 0;

var _vue = _interopRequireDefault(require("vue"));

var _des = require("./des");

var Aes = require("./aes");

var RSAKey = require("./rsa");

var rsa = {};

var DataProcess = function DataProcess() {
  rsa = new RSAKey();
};

DataProcess.desDecrypt = function (data, firstKey, secondKey, thirdKey) {
  return (0, _des.strDec)(data, firstKey, secondKey, thirdKey);
};

DataProcess.desEncrypt = function (data, firstKey, secondKey, thirdKey) {
  return (0, _des.strEnc)(data, firstKey, secondKey, thirdKey);
};

DataProcess.aesDecrypt = function (data, privateKey, nBits) {
  if (nBits === void 0) {
    nBits = 128;
  }

  return Aes.Ctr.decrypt(data, privateKey, nBits);
};

DataProcess.aesEncrypt = function (data, privateKey, nBits) {
  if (nBits === void 0) {
    nBits = 128;
  }

  return Aes.Ctr.encrypt(data, privateKey, nBits);
};

DataProcess.setPublic = function (N, E) {
  rsa.setPublic(N, E);
};

DataProcess.rsaEncrypt = function (data) {
  return rsa.encrypt(data);
};

DataProcess.setPrivate = function (N, E, D) {
  rsa.setPrivate(N, E, D);
};

DataProcess.rsaDecrypt = function (data) {
  return rsa.decrypt(data);
};

_vue.default.prototype.$DataProcess = DataProcess;
var _default = DataProcess;
exports.default = _default;