moved base64encode to common.utils
This commit is contained in:
parent
eedd2e91ee
commit
0f3357ab46
|
@ -10,6 +10,7 @@ import random
|
|||
import re
|
||||
import string
|
||||
import pem
|
||||
import base64
|
||||
|
||||
import sqlalchemy
|
||||
from cryptography import x509
|
||||
|
@ -33,6 +34,10 @@ paginated_parser.add_argument("sortBy", type=str, dest="sort_by", location="args
|
|||
paginated_parser.add_argument("filter", type=str, location="args")
|
||||
paginated_parser.add_argument("owner", type=str, location="args")
|
||||
|
||||
def base64encode(string):
|
||||
# Performs Base64 encoding of string to string using the base64.b64encode() function
|
||||
# which encodes bytes to bytes.
|
||||
return base64.b64encode(string.encode()).decode()
|
||||
|
||||
def get_psuedo_random_string():
|
||||
"""
|
||||
|
|
|
@ -12,20 +12,13 @@
|
|||
from flask import current_app
|
||||
|
||||
from lemur.common.defaults import common_name, bitstrength
|
||||
from lemur.common.utils import parse_certificate, parse_private_key
|
||||
from lemur.common.utils import parse_certificate, parse_private_key, base64encode
|
||||
from lemur.plugins.bases import DestinationPlugin
|
||||
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
import requests
|
||||
import json
|
||||
import sys
|
||||
import base64
|
||||
|
||||
|
||||
def base64encode(string):
|
||||
# Performs Base64 encoding of string to string using the base64.b64encode() function
|
||||
# which encodes bytes to bytes.
|
||||
return base64.b64encode(string.encode()).decode()
|
||||
|
||||
|
||||
def handle_response(my_response):
|
||||
|
|
|
@ -18,7 +18,7 @@ import requests
|
|||
from flask import current_app
|
||||
|
||||
from lemur.common.defaults import common_name
|
||||
from lemur.common.utils import parse_certificate
|
||||
from lemur.common.utils import parse_certificate, base64encode
|
||||
from lemur.plugins.bases import DestinationPlugin
|
||||
|
||||
DEFAULT_API_VERSION = "v1"
|
||||
|
@ -73,12 +73,6 @@ def _resolve_uri(k8s_base_uri, namespace, kind, name=None, api_ver=DEFAULT_API_V
|
|||
)
|
||||
|
||||
|
||||
# Performs Base64 encoding of string to string using the base64.b64encode() function
|
||||
# which encodes bytes to bytes.
|
||||
def base64encode(string):
|
||||
return base64.b64encode(string.encode()).decode()
|
||||
|
||||
|
||||
def build_secret(secret_format, secret_name, body, private_key, cert_chain):
|
||||
secret = {
|
||||
"apiVersion": "v1",
|
||||
|
|
Loading…
Reference in New Issue