473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Base64 Encryption Question

I have a spec that calls for a Base64 encrypted password to be passed
to a web service.
I have poked around Convert.ToBase64 but am at a total loss on how to
do this.
Made more complicated is that the password is part of a complex data
type class.

What I am trying to do is something functions like this below
(replacing FOO code with something that works) Any help is greatly
appreciated:

Public Property password() As String

'******** start totally FOO code: ************

Dim xRawString as string
Dim xEncryptedString as string

xRawString = "MyPasswordString"

xEncryptedString = SomehowConvertToBase64(xRawString)

'******** end totally FOO code: ************

Get
Return xEncryptedString
End Get

Set(ByVal value As String)
Me.passwordField = xEncryptedString
End Set

End Property

Mar 17 '07 #1
3 2982

Base64 encoding is not an encryption method , it is just a way of converting
binary data into text ( e-mail progs use it for instance to onclude images
in a message )
the encode and decode base 64 classes can be found in the text namespace
and is pretty straigforward in use
HTH

Michel Posseth

"Lauren Quantrell" <la*************@hotmail.comschreef in bericht
news:11**********************@p15g2000hsd.googlegr oups.com...
>I have a spec that calls for a Base64 encrypted password to be passed
to a web service.
I have poked around Convert.ToBase64 but am at a total loss on how to
do this.
Made more complicated is that the password is part of a complex data
type class.

What I am trying to do is something functions like this below
(replacing FOO code with something that works) Any help is greatly
appreciated:

Public Property password() As String

'******** start totally FOO code: ************

Dim xRawString as string
Dim xEncryptedString as string

xRawString = "MyPasswordString"

xEncryptedString = SomehowConvertToBase64(xRawString)

'******** end totally FOO code: ************

Get
Return xEncryptedString
End Get

Set(ByVal value As String)
Me.passwordField = xEncryptedString
End Set

End Property

Mar 18 '07 #2
Lauren Quantrell wrote:
I have a spec that calls for a Base64 encrypted password to be passed
to a web service.
I have poked around Convert.ToBase64 but am at a total loss on how to
do this.
Made more complicated is that the password is part of a complex data
type class.

What I am trying to do is something functions like this below
(replacing FOO code with something that works) Any help is greatly
appreciated:

Public Property password() As String

'******** start totally FOO code: ************

Dim xRawString as string
Dim xEncryptedString as string

xRawString = "MyPasswordString"

xEncryptedString = SomehowConvertToBase64(xRawString)

'******** end totally FOO code: ************

Get
Return xEncryptedString
End Get

Set(ByVal value As String)
Me.passwordField = xEncryptedString
End Set

End Property
As Michel pointed out, Base64 is not encryption. It's just encoding.

The Convert.ToBase64String method takes a byte array, so if you have a
string as input, you have to first encode it into binary data.

What encoding does the web service expect? ASCII? UTF-8? Latin1?

Here is an example using UTF-8 encoding:

base64Encoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(pass word))

--
Göran Andersson
_____
http://www.guffa.com
Mar 18 '07 #3
On Mar 18, 10:35 am, Göran Andersson <g...@guffa.comwrote:
Lauren Quantrell wrote:
I have a spec that calls for a Base64 encrypted password to be passed
to a web service.
I have poked around Convert.ToBase64 but am at a total loss on how to
do this.
Made more complicated is that the password is part of a complex data
type class.
What I am trying to do is something functions like this below
(replacing FOO code with something that works) Any help is greatly
appreciated:
Public Property password() As String
'******** start totally FOO code: ************
Dim xRawString as string
Dim xEncryptedString as string
xRawString = "MyPasswordString"
xEncryptedString = SomehowConvertToBase64(xRawString)
'******** end totally FOO code: ************
Get
Return xEncryptedString
End Get
Set(ByVal value As String)
Me.passwordField = xEncryptedString
End Set
End Property

As Michel pointed out, Base64 is not encryption. It's just encoding.

The Convert.ToBase64String method takes a byte array, so if you have a
string as input, you have to first encode it into binary data.

What encoding does the web service expect? ASCII? UTF-8? Latin1?

Here is an example using UTF-8 encoding:

base64Encoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(pass word))

--
Göran Andersson
_____http://www.guffa.com- Hide quoted text -

- Show quoted text -
Goran,
Thanks much. Now I understand this and your line of code made it work
for me.
lq

Mar 20 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Phil C. | last post by:
(Cross post from framework.aspnet.security) Hi. I testing some asp.net code that generates a 256 bit Aes Symmetric Key and a 256 bit entropy value. I encrypt the Aes key(without storing it as...
1
by: Bob | last post by:
Does ASP.NET 2.0 have built-in base64 encryption methods?
7
by: Neo Geshel | last post by:
Greetings. I have managed to stitch together an awesome method of posting text along with an image to a database, in a way that allows an unlimited number of previews to ensure that text and...
1
by: Arvind P Rangan | last post by:
Hi, Trying to convert excel file data to base64 for encryption. Can anyone help me on this. Thanks Arvind
14
by: BB | last post by:
Hello. i am trying to decode a block of (what i think is) base64 into text, and i have NO idea how to begin. I'm going to paste the whole string here, but i want to know the steps necessary to...
2
by: Lonewolf | last post by:
Hi all, please pardon me if this question is too trivial. I have an XML file which stores data in base64. The schema is something like this, <Remokon> <Brand Name="SONY"> <Model Name="Type 1",...
1
by: Mr. T | last post by:
Hello, i'm developing an application where i want to use the login auth application provided by our organisation. However i'm a bit stuck on processing the auth string i get back. The way it...
8
by: Jeremy Kitchen | last post by:
I have encoded a string into Base64 for the purpose of encryption. I then later decrypted it and converted it back from Base64 the final string returns with four nothing characters. "pass" what...
26
by: Jim Brandley | last post by:
I need to append a short ciphertext string as a query variable encoded so it's valid for a URL. After encryption, I convert the bytes to Base64. However, the result includes characters that are...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.