pasar a chilkat "openssl rsa -in RFC.key.pem -des3 -out RFC.enc.key -passout pass:'wordpaswors'"

227 views
Skip to first unread message

jahs...@hotmail.com

unread,
Dec 6, 2013, 12:17:46 PM12/6/13
to vfp-factura-ele...@googlegroups.com
hola que tal
alguien sabe como pasar "openssl rsa -in filekey.pem -des3 -out fileenc.key -passout pass:'wordpaswors'"  a instrucciones de chilkat.
cabe mencionar que esa instrucción es para encriptar llaves de certificados  según lo requiere el pac FINKOK para la cancelación.
 yo utilizo este código pero al parecer no es lo mismo:

*  Objetos 
TRY 
loPkey = CreateObject('Chilkat.PrivateKey')
CATCH 
   aux_error = .t.  
ENDTRY  
IF aux_error
DO FORM LOCFILE('formularios\mensaje_eli.scx') WITH "No se puede crear el objeto Chilkat.PrivateKey" + RIGHT(aux_tex_crearxml,26),.t.
    RETURN .f.
ENDIF 
*
TRY 
locrypt = CreateObject('Chilkat.Crypt2')
CATCH 
   aux_error = .t.  
ENDTRY  
IF aux_error
DO FORM LOCFILE('formularios\mensaje_eli.scx') WITH "No se puede crear el objeto Chilkat.PrivateKey" + RIGHT(aux_tex_crearxml,26),.t.
    RETURN .f.
ENDIF 
*
TRY 
loCert = CreateObject('Chilkat.Cert')
CATCH
aux_error = .t.  
ENDTRY  
IF aux_error
DO FORM LOCFILE('formularios\mensaje_eli.scx') WITH "No se puede crear el objeto Chilkat.Cert" + RIGHT(aux_tex_crearxml,26),.t.
    RETURN .f.
ENDIF
*  Load the Certificado 
TRY 
loCert.LoadFromFile(arcer) 
CATCH
   aux_error = .t.  
ENDTRY  
IF aux_error
DO FORM LOCFILE('formularios\mensaje_eli.scx') WITH "No se encontro el archivo de certificado." + RIGHT(aux_tex_crearxml,26),.t.
RETURN .f.
ENDIF 
*  Load the private key from an RSA PEM file:    
TRY 
loPkey.LoadPkcs8EncryptedFile(arkey, PasswordKey)
CATCH 
   aux_error = .t.  
ENDTRY  
IF aux_error
   DO FORM LOCFILE('formularios\mensaje_eli.scx') WITH "No se encontro el archivo de Llave (*.key)." + RIGHT(aux_tex_crearxml,26),.t.
   RETURN .f.
ENDIF 
*
*  Get the private key in XML format:
TRY 
lcPkeypem = loPkey.GetPkcs8EncryptedPem('NewPasswordkey')
CATCH 
   aux_error = .t.  
ENDTRY  
IF aux_error
RETURN .f.
ENDIF

*
locrypt.CryptAlgorithm = '3des'
key_can = locrypt.Encode(lcPkeypem, 'base64')
cer_can = SubStr(loCert.GetEncoded(), 1, Len(loCert.GetEncoded()) - 2)




Reply all
Reply to author
Forward
0 new messages