login about faq

I want to use LoadPkcs8Encrypted instead of LoadPkcs8EncryptedFile method in a "privateKey" class, up to now first I am getting/reading each byte of the "Encypted File" into a string varible (my_KEYstr), and then, I use this string variable as the parameter to the LoadPkcs8Encrypted, but It fails.


Example of "fail" on LoadPkcs8EncryptedFile:

Public Function get_keyPEMstr(ByVal my_KEYstr As String, ByVal keyPassword As String, _ Optional ByRef errDescripcion As String) As String

Dim privKey As privateKey 'chilkatcert.dll

Dim success As Long

Set privKey = New privateKey

Let success = privKey.LoadPkcs8Encrypted(my_KEYstr, keyPassword) ' ERROR!

If (success <> 1) Then Let errDescripcion = privKey.LastErrorText Set privKey = Nothing Exit Function End If

Let get_keyPEMstr = privKey.GetRsaPem

Set privKey = Nothing

End Function


By the other hand, if I use LoadPkcs8EncryptedFile, I do not get the error and result is good:


Example of success on LoadPkcs8EncryptedFile:

Public Function get_keyPEMstrFromKEYfile(ByVal PathFileNameKey As String, ByVal keyPassword As String, _ Optional ByRef errDescripcion As String) As String

Dim privKey As privateKey 'chilkatcert.dll

Dim success As Long

Set privKey = New privateKey

Let success = privKey.LoadPkcs8EncryptedFile(PathFileNameKey, keyPassword)

If (success <> 1) Then Let errDescripcion = privKey.LastErrorText

Set privKey = Nothing

Exit Function

End If

Let get_keyPEMstrFromKEYfile = privKey.GetRsaPem

Set privKey = Nothing

End Function


Does anybody know what is the condition to be meet by the string variable "my_KEYstr" in order to be accepted by the LoadPkcs8Encrypted method?

asked Feb 02 '14 at 03:14

gorsacv's gravatar image

gorsacv
1223

edited Feb 02 '14 at 03:16

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×35
×10
×3

Asked: Feb 02 '14 at 03:14

Seen: 823 times

Last updated: Feb 02 '14 at 03:16

powered by OSQA