diff --git a/javascript/src/viamapi-iframe.js b/javascript/src/viamapi-iframe.js
index 23e78d2f3f40fef3815f63ed326690be2f82c759..b4060b63e40c227c32373dd079cda2a5bdcb8dd9 100644
--- a/javascript/src/viamapi-iframe.js
+++ b/javascript/src/viamapi-iframe.js
@@ -824,7 +824,7 @@ Vereign - Authentic Communication
     mime = newMimeHeaderLines + '\r\n' + mimeBody
   }
 
-  let dataBuffer = pvutils.stringToArrayBuffer(mime);
+  let dataBuffer = Buffer.from(mime,'utf-8')
 
   let sequence = Promise.resolve();
 
@@ -833,7 +833,7 @@ Vereign - Authentic Communication
   {
     //region Create a message digest
     sequence = sequence.then(
-      () => crypto.digest({ name: hashAlg }, new Uint8Array(dataBuffer))
+      () => crypto.digest({ name: hashAlg }, dataBuffer)
     );
     //endregion
 
@@ -2089,8 +2089,8 @@ const connection = Penpal.connectToParent({
               //console.log(privateKeyOneTime)
 
               executeRestfulFunction("private", viamApi, viamApi.passportGetEmailWithHeaderByPassport,
-                passportUUID, window.btoa(emailMessage)).then(executeResult2 => {
-                var emailWithHeader = window.atob(executeResult2.data)
+                passportUUID, emailMessage).then(executeResult2 => {
+                var emailWithHeader = executeResult2.data
                 //console.log(emailWithHeader)
                 //download("withheader.eml", "message/rfc822", emailWithHeader)
                 var signedEmailPromise = signEmail(emailWithHeader,
@@ -2100,8 +2100,8 @@ const connection = Penpal.connectToParent({
 
                 signedEmailPromise.then(signedEmail => {
                   executeRestfulFunction("private", viamApi, viamApi.signResignEmail,
-                    passportUUID, window.btoa(signedEmail)).then(executeResult => {
-                    result({"data" : window.atob(executeResult.data),
+                    passportUUID, signedEmail).then(executeResult => {
+                    result({"data" : executeResult.data,
                       "code" : "200",
                       "status" : "Email signed"
                     })
@@ -2196,6 +2196,66 @@ const connection = Penpal.connectToParent({
         })
       });
     },
+    stringToUtf8ByteArray(str) {
+      if (typeof str !== 'string') {
+        str = str.toString()
+      }
+      let res = Buffer.from(str,'utf-8')
+      return new Penpal.Promise(result => {
+        result(res)
+      })
+    },
+    utf8ByteArrayToString(ba) {
+      if (!Buffer.isBuffer(ba)) {
+        ba = Buffer.from(ba)
+      }
+      let res = ba.toString('utf-8')
+      return new Penpal.Promise(result => {
+        result(res)
+      })
+    },
+    stringToUtf8Base64(str) {
+      if (!Buffer.isBuffer(str)) {
+        if (typeof str !== 'string') {
+          str = str.toString()
+        }
+        str = Buffer.from(str, 'utf-8')
+      }
+      let res = str.toString('base64')
+      return new Penpal.Promise(result => {
+        result(res)
+      })
+    },
+    utf8Base64ToString(strBase64) {
+      if (!Buffer.isBuffer(strBase64)) {
+        if (typeof strBase64 !== 'string') {
+          strBase64 = strBase64.toString()
+        }
+        strBase64 = Buffer.from(strBase64, 'base64')
+      }
+      let res = strBase64.toString('utf-8')
+      return new Penpal.Promise(result => {
+        result(res)
+      })
+    },
+    base64ToByteArray(strBase64) {
+      if (typeof strBase64 !== 'string') {
+        strBase64 = strBase64.toString()
+      }
+      let res = Buffer.from(strBase64, 'base64')
+      return new Penpal.Promise(result => {
+        result(res)
+      })
+    },
+    byteArrayToBase64(ba) {
+      if (!Buffer.isBuffer(ba)) {
+        ba = Buffer.from(ba)
+      }
+      let res = ba.toString('base64')
+      return new Penpal.Promise(result => {
+        result(res)
+      })
+    },
     // Previously there was "//{{methods}}" placeholder, but we can't use it anymore since Uglify in webpack
     // stripping this comment and there is no chance to preserve it
     // (even with special words like @preserve or comment /*! */)