diff --git a/cores/esp32/HardwareSerial.cpp b/cores/esp32/HardwareSerial.cpp
index e2b12bda3f4..7683e003e5c 100644
--- a/cores/esp32/HardwareSerial.cpp
+++ b/cores/esp32/HardwareSerial.cpp
@@ -135,6 +135,7 @@ void serialEventRun(void)
 HardwareSerial::HardwareSerial(int uart_nr) : 
 _uart_nr(uart_nr), 
 _uart(NULL),
+_baudrate(0),
 _rxBufferSize(256),
 _txBufferSize(0), 
 _onReceiveCB(NULL), 
@@ -395,6 +396,8 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
             _uart = NULL;
         }
     }
+    else
+      _baudrate = baud;
     // create a task to deal with Serial Events when, for example, calling begin() twice to change the baudrate,
     // or when setting the callback before calling begin() 
     if (_uart != NULL && (_onReceiveCB != NULL || _onReceiveErrorCB != NULL) && _eventTask == NULL) {
@@ -427,6 +430,7 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
 void HardwareSerial::updateBaudRate(unsigned long baud)
 {
 	uartSetBaudRate(_uart, baud);
+	_baudrate = baud;
 }
 
 void HardwareSerial::end(bool fullyTerminate)
@@ -449,6 +453,7 @@ void HardwareSerial::end(bool fullyTerminate)
     delay(10);
     uartEnd(_uart);
     _uart = 0;
+    _baudrate = 0;
     _destroyEventTask();
 }
 
@@ -529,10 +534,12 @@ size_t HardwareSerial::write(const uint8_t *buffer, size_t size)
     uartWriteBuf(_uart, buffer, size);
     return size;
 }
-uint32_t  HardwareSerial::baudRate()
 
+uint32_t  HardwareSerial::baudRate(bool nominal)
 {
-	return uartGetBaudRate(_uart);
+    if (nominal)
+        return _baudrate;
+    return uartGetBaudRate(_uart);
 }
 HardwareSerial::operator bool() const
 {
diff --git a/cores/esp32/HardwareSerial.h b/cores/esp32/HardwareSerial.h
index 6291d241778..ba69fab6b0b 100644
--- a/cores/esp32/HardwareSerial.h
+++ b/cores/esp32/HardwareSerial.h
@@ -152,7 +152,7 @@ class HardwareSerial: public Stream
     {
         return write((uint8_t) n);
     }
-    uint32_t baudRate();
+    uint32_t baudRate(bool nominal = true);
     operator bool() const;
 
     void setDebugOutput(bool);
diff --git a/cores/esp32/base64.cpp b/cores/esp32/base64.cpp
index 1fc144e2659..1b5424ebb30 100644
--- a/cores/esp32/base64.cpp
+++ b/cores/esp32/base64.cpp
@@ -62,3 +62,38 @@ String base64::encode(const String& text)
     return base64::encode((uint8_t *) text.c_str(), text.length());
 }
 
+/**
+ * decode input data from base64
+ * @param data const char *
+ * @param length size_t
+ * @param out uint8_t *
+ * @param out_max_len size_t
+ * @param out_len size_t *
+ * @return bool
+ */
+bool base64::decode(const char * data, size_t length, uint8_t * out, size_t out_max_len, size_t * out_len)
+{
+    int len;
+    
+    if (((((length + 3) / 4) * 3) + 1) > out_max_len)
+        return false;
+    len = base64_decode_chars(data, length, (char *)out);
+    if (len <= 0)
+        return false;
+    if (out_len)
+        *out_len = len;
+    return true;
+}
+
+/**
+ * decode input data from base64
+ * @param text String
+ * @param out uint8_t *
+ * @param out_max_len size_t
+ * @param out_len size_t *
+ * @return bool
+ */
+bool base64::decode(String text, uint8_t * out, size_t out_max_len, size_t * out_len)
+{
+    return base64::decode(text.c_str(), text.length(), out, out_max_len, out_len);
+}
diff --git a/cores/esp32/base64.h b/cores/esp32/base64.h
index 97095817b8f..5c97c0e64ae 100644
--- a/cores/esp32/base64.h
+++ b/cores/esp32/base64.h
@@ -6,6 +6,8 @@ class base64
 public:
     static String encode(const uint8_t * data, size_t length);
     static String encode(const String& text);
+    static bool decode(const char * data, size_t length, uint8_t * out, size_t out_max_len, size_t * out_len);
+    static bool decode(String text, uint8_t * out, size_t out_max_len, size_t * out_len);
 private:
 };