Quantcast
Channel: Chilkat Forum - latest questions
Viewing all 1061 articles
Browse latest View live

rsa crypt & decrypt in vfp

$
0
0

Hi,

I'm still using visua lfoxpro and i'm trying your examples. One of them particularly interest me (rsa crypting and decrypting string) and it is said you can crypt with the public key and decrypt with the private key but you only use the private key ? Is there a reason??

I want to use private key for crypting and use the public key for decrypting. Is that possible??

Is it possible to decrypt directly from a signature with a public key??

Thank you in advance for your answers

Regards

Jean-Pierre SENET


How to change the names of the contents of the file using perl?

$
0
0

I treid the below code to change the directory names as per matching with text file.Ho can i do same process for contents of the file using perl?

READ THE TEXT FILE AND RENAME THE DIRECTORIES

my $dir_map = read_map($mapfile);
my $top_dir=$output_dir;
rename_dirs( $top_dir, $dir_map );
sub rename_dirs {
    my ( $top_dir, $dir_map ) = @_;
    opendir (my $dh, $top_dir) or die "Can't open $top_dir: $!";
    my $save_dir = getcwd();
    chdir $top_dir;
    while (my $dir = readdir $dh) {
    #print $dir,"\n";
        next if ($dir eq '.') or ($dir eq '..'); 
        if ( exists $dir_map->{$dir} ) {
            my $new_name = $dir_map->{$dir};
            File::Copy::move( $dir, $new_name )
                or die "Could not rename '$dir' as '$new_name': $!";
            $dir = $new_name;
        }
        rename_dirs( $dir, $dir_map ) if -d $dir;
    }
    chdir $save_dir;

}

SUB ROUTINE TO READ THE TEXT FILE FROM COMMAND LINE ARGUMENTS

sub read_map {
    my ( $fn ) = @_;
    my %dir_map;
    open( my $fh, '<', $fn ) or die "Could not open file '$fn': $!";
    while( my $line = <$fh> ) {
    chomp $line;
    my @fields = split /:/, $line;
    if ( @fields == 3 ) {
        $dir_map{$fields[2]} = $fields[1];
        }
    }
    close $fh;
    return \%dir_map;
}

CSR is invalidate to apply for CA's certificate

vbscript and non ascii characters

$
0
0

I am trying to import a csv file via vbs. There appears to be some non ascii characters in the data.

Is there a simple way or function I can use that will clean the data, or change each non ascii character with something like a caret?

Thanks

Sender address rejected: not owned by user

$
0
0

when we set bounce email address we are getting below error

Sender address rejected: not owned by user SmtpCmdResp: 553 5.7.1 <bounce@abc.com>: Sender address rejected: not owned by user **estatement@abc.com** you can find our email setting properties below

Email email = new Email() email.FromAddress ="estatement@abc.com"; email.FromName ="estatement"; email.BounceAddress = "bounce@abc.com";

Note: we are able to send mails without setting bounceaddress if we set we are getting above error . is there any alternative solution for this. can you help me in this issue.

Thanks and Regards, Greypad Technlogies pvt ltd Team.

How to get a 64-bit number value using chilkat json?

$
0
0

I am parsing json that contains 64-bit numbers. The chilkat json objects contain methods to get int (32-bit) values, but I don't see a good way to get larger numbers. Is there a recommended/built-in way to do this?

Notes: Just wanted to add that I currently use stringOf() and just convert the string to a number, just wanted to know if you have a built in method similar to Intof() or are planning on adding something like this in the future.

Thanks

Async functions with old license

$
0
0

We have an old chilkat license from 2013, with a seperat key for every part of the library. But no new "bundle"-key.
Is it allowed and possible to use the async-functions in licensed parts like CkHttp or CkSocket?
The functions themself are part of licensed classes, but the return value is CkTask, which is part of the "bundle"-license. Obviously some of the CkTask functions are needed, if the async-functions are allowed to used.

file transfer completion progress when using ckoTask SyncTreeUploadAsync

$
0
0

Hi,

Looking for a bit of help. I'm using SyncTreeUploadAsync to transfer large file sets to an SFTP server. Unfortunately the data link is very variable and fails many times (destination is in China). I can detect the failure of the link using the current transfer rate and the bytes transferred and can then reestablish the connection and restart the sync. Unfortunately with the very large numbers of files in the transfer the time taken to reestablish the transfer grows and grows. More files are added to the transfer folder daily...

Is there a way to determine when individual files have successfully transferred as part of the SyncTreeUploadAsync task? If I can capture that information I will be able to delete the file from the local folder once the file is safely on the server. That will stop the local folder getting ever larger and the SyncTreeUploadAsync process taking longer each time. In effect I'm trying to create a move function rather than a copy.

I think my alternative will be to write a function that handles this 'manually' transferring a single file at a time using ResumeUploadFileByName and deleting the file on success. I'm really hoping that there is a way to use SyncTreeUploadAsync as it does 99% of the heavy lifting for me.

Some context on the transferred data. The link is limited to 1MB/s and the typical daily transfer is 30 to 40GB (some days more some days less. On average the weekly data will transfer in a week). The transfer folder receives around 750 files in a two deep folder structure daily. At the server end data accumulates for a week then gets transferred to another location.

Thanks in advance


Perl Ftp WindowsErrorCode: 0x2746

$
0
0

Hello

I am trying to use the Chilkat Library for Perl FtP

After connection, I would like change the current directory on ftp server: no problem with ChangeRemoteDir.

But if I try to change the current directory a lot of time, I get the folowed error. ChangeRemoteDir:

DllDate: Dec 28 2016

ChilkatVersion: 9.5.0.65

UnlockPrefix: Anything for 30-day trial

Architecture: Little Endian; 64-bit

Language: Windows Perl

VerboseLogging: 0

dir: /Disque dur

changeRemoteDir:

  simplePathCommand:

    simpleCommand:

      sendCommand:

        sendingCommand: CWD /Disque dur

      --sendCommand

      readCommandResponse:

        WindowsError: Une connexion existante a dre fermpar ldistant.

        WindowsErrorCode: 0x2746

        numBytesRequested: 5

        Failed to receive data on the TCP socket

        sockRecv: Socket fatal error.

        Failed to read beginning of SSL/TLS record.

        b: 0

        dbSize: 0

        nReadNBytes: 0

        Failed to receive more TLS applicaton data.

        Failed to read FTP control channel reply.

        readFtpReply: Socket fatal error.

      --readCommandResponse

    --simpleCommand

    Simple path command failed.

    socketResults: Socket fatal error.

  --simplePathCommand

--changeRemoteDir

Failed.

--ChangeRemoteDir

--ChilkatLog

1

Some details Envrionnement : Windows 10 64 bits Language : Perl 5.24 (Active perl) Network between PC and Ftp Server : wifi g (local network)

Could you explain this problem ?

Thank in advance

QR Code with URL

Using CkRsa C++ to satisfy Java SE7 Cipher Algorithm over GRPC

$
0
0

I'm trying to encrypt/decrypt using RSA-4096 over GRPC (a communication protocol) to a Java SE7 server using javax/crypto/Cipher algorithm's, specifically: RSA/ECB/PKCS1Padding

Java SE7 Crypto Cipher

However over the span of a few hours of trial & erroring, the server is reporting a 'padding error'.

I'm starting to believe it's either the way I'm setting up CkRsa or perhaps the way I'm converting the const unsigned chars to const chars.

I'm setting out my C++ like this:

CkRsa rsa;
rsa.put_littleEndian(false); // Prior to using Chilkat we were using OpenSSL
rsa.put_OAEPPadding(false);  // Uses PKCS#1.5 padding (Confused since Java's cipher says only PKCS1)

// ... setup CkPrivateKey/CkPublicKey with keys via CkStringBuilder

// Encryption
CkByteData outData;
string dump = GetJSONInfo(); // Just returns a JSON string
rsa.EncryptString(dump.c_str(), false, outData); // Encrypt using public key

// GRPC requires the message to be in const string& or const char*
string msg = string(reinterpret_cast<const char*>(const_cast<unsigned char*>(outData.getBytes())), outData.getSize());

// ... Send GRPC request

Please implement a Websocket library

$
0
0

It will soon become necessary to have a client side websocket library - and it would fit very well into the chilkat portfolio. The currently existing free solutions aren't satisfying, Websocket++ seem to be good but it's hardcore C++ and requires Boost for network access.

HTTP "sockRecv: Socket operation timeout." on clientHandshake2

$
0
0

We have software that tries to make a connection to a third party. The software was utilizing the Microsoft MSXML HTTP object to make HTTP POSTs. Recently the third party disabled the SSLv3 protocol and will be disabling TLS 1.0 in the near future. After the SSLv3 protocol disabling, one of our clients has 2 Windows 7 PCs that fail to make the connection to the third party server, but 1 Windows 7 PC that is successful. Numerous other clients with different OSes have no issue.

Figuring it might have been an issue in the MSXML HTTP object, I wrote a test application using the Chilkat ActiveX library we have access to. This test application connects without issue to the third party on my Windows 10 PC, on a separate client's Windows 7 PC (that is not having this issue), and on the 1 Windows PC that can still connect at the client having this connection issue. However, the other 2 PCs get an error during the clientHandshake2 process according to the log. We have numerous other clients who have no issues with this connection, it is just this one client with 2 PCs that don't work and 1 PC that does with all 3 PCs going through the same network.

1) Does Chilkat use OS level components to make the HTTP connection. For example, Windows XP cannot make TLS 1.1 or TLS 1.2 connections because it is limited to TLS 1.0 in the OS and all Windows components are affected. Could Chilkat make a TLS 1.1 or TLS 1.2 connection on a Windows XP machine? I ask this because we may have some clients that do work right now but will fail when the third party disables TLS 1.0 due to having Win XP or Win Vista clients.

2) What would prevent a handshake on PCs similar to another PC with the same OS allowing the handshake? Here is the snippet of the log where the handshake fails:

             clientHandshake(20000ms):
                The client cert chain is NULL.
                cacheClientCerts:
                  Cached TLS client certificates.
                  Client cert chain is NULL.
                --cacheClientCerts
                clientHandshake2(20000ms):
                  readHandshakeMessages(20000ms):
                    sockRecv: Socket operation timeout.
                    Failed to read beginning of SSL/TLS record.
                    b: 0
                    dbSize: 0
                    nReadNBytes: 0
                  --readHandshakeMessages
                --clientHandshake2
              --clientHandshake
              Client handshake failed. (3)

Here is a successful handshake log (I have forced Chilkat to use TLS 1.2 protocol in the test):

            clientHandshake(203ms):
                The client cert chain is NULL.
                cacheClientCerts:
                  Cached TLS client certificates.
                  Client cert chain is NULL.
                --cacheClientCertsclientHandshake2(203ms):
                  readHandshakeMessages(78ms):
                    processHandshakeRecord:
                      processHandshakeMessage:
                        processServerHello:
                          negotiatedTlsVersion: TLS 1.2
                          negotiatedCipherSuite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
                          minAcceptableRsaKeySize: 1024
                        --processServerHello
                      --processHandshakeMessage
                    --processHandshakeRecord
                  --readHandshakeMessages
                  Sending 0-length certificate (this is normal).
                  sendClientCertificates:
                    buildCertificatesMessage:
                      numCerts: 0
                    --buildCertificatesMessage
                  --sendClientCertificates
                  buildClientKeyExchange(16ms):
                    buildClientKeyExchangeECDHE(16ms):
                      verifyServerKeyExchange:
                        verifyHash:
                          keyType: Public
                          hashInSize: 32
                          padding: PKCS v1.5
                          HashOid: 2.16.840.1.101.3.4.2.1
                        --verifyHash
                      --verifyServerKeyExchange
                      Verified server key exchange.
                      generateNewKey_ecc(16ms):
                        loadCurveByName:
                          name: secp256r1
                        --loadCurveByName
                      --generateNewKey_ecc
                      loadSshPubKey:
                        loadCurveByName:
                          name: secp256r1
                        --loadCurveByName
                      --loadSshPubKey
                    --buildClientKeyExchangeECDHE
                  --buildClientKeyExchange
                --clientHandshake2
              --clientHandshake

Both the successful and erroring clients are running version 9.5.0.64 of the Chilkat ActiveX single DLL, so it does not seem to be version issue. Both clients are Win 7 Pro 32 bit as well.

Problem in syncing files for more than one hour

$
0
0

I am using chilkat extension in PHP. The problem I am getting is with keeping the connection alive. It automatically time out after one hour. And I got e mail for the time out of the FTP connection. It works well where I need to download lesser files. Problem is in some large amount of file. On inspection found that it is the connection to remote host which is not lasting for more than 1 hour.

Can any one please help me ?

Thanks

Cryopt: Trial period has expired, but only 2/3 in the trial.

$
0
0

We are in the evaluation process and are now getting this message even though we shoul have at least 10 days left of the trial period. Anything we can do to correct this?

ChilkatLog: SignStringENC: DllDate: Dec 29 2016 ChilkatVersion: 9.5.0.65 UnlockPrefix: 30-day trial Architecture: Little Endian; 64-bit Language: .NET 4.6 / x64 VerboseLogging: 0 Trial period has expired. lastUnlockCode: 30-day trial --SignStringENC --ChilkatLog


RSASSA-PSS Signature algorithm

$
0
0

Hi,

supports Chilkat the RSASSA-PSS Signature algorithm e.c for eMail-signing?

also Schlüsselverschlüsselung (Key encryption): RSAES-OAEP
(IETF RFC 3447)

▪ Inhaltsverschlüsselung (Content encryption): AES-128 CBC oder AES-192 CBC
(IETF RFC 3565).

imap copy - what uid does new message have?

$
0
0

I am copying an imail from the inbox to another folder in vb.net using a command similar to: imap.Copy(msgId,isUid,"Inbox.testing")

Is there a quick and easy way to find the UID of the email in the destination folder?

Thanks,

Martin.

SFTP Upload: Incoming message size is too small, then disconnect

$
0
0

I'm having an issue with the SFTP (ActiveX) module using version 9.5.0.56:

There is a folder which will trigger a program when files are dropped into it, uploading them to a FTP server through SFTP.

The weird thing is: the first couple of files get the following error, while the files afterwards just get the error that there needs to be a connection to the SSH server first.

Once in a blue moon, all the files get uploaded at once, whilst the previous 20 times I get errors as seen below.

The error for the first two files:

ChilkatLog:   UploadFileByName:
    DllDate: Mar 21 2016
    ChilkatVersion: 9.5.0.56
    UnlockPrefix: ---------
    Username: ---------
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    SshVersion: SSH-2.0-OpenSSH_6.6p2-hpn14v4
    SftpVersion: 3
    uploadFileByName:
      remoteFilePath: home/Prod/OUT/E342_000000710676.xml
      localFilePath: G:\PCIL9\Communication\Interfaces\Dossier\Outgoing\E342_000000710676.xml
      localFileSize: 554
      sftpOpenFile:
        remotePath: home/Prod/OUT/E342_000000710676.xml
        access: writeOnly
        createDisposition: createTruncate
        v3Flags: 0x1a
        Sent FXP_OPEN
        Received EOF..
        Failed to read expected SFTP packet.
        msgSize: 0
        Incoming message size is too small.
        Failed to receive response to FXP_OPEN
      --sftpOpenFile
      Failed to open file.
    --uploadFileByName
    Failed.   --UploadFileByName
--ChilkatLog   (COM successful)

The error for the third file which includes a DISCONNECT message

ChilkatLog:
  UploadFileByName:
    DllDate: Mar 21 2016
    ChilkatVersion: 9.5.0.56
    UnlockPrefix: ---------
    Username: ---------
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    SshVersion: SSH-2.0-OpenSSH_6.6p2-hpn14v4
    SftpVersion: 3
    uploadFileByName:
      remoteFilePath: home/Prod/OUT/E342_000000710723.xml
      localFilePath: G:\PCIL9\Communication\Interfaces\Dossier\Outgoing\E342_000000710723.xml
      localFileSize: 554
      sftpOpenFile:
        remotePath: home/Prod/OUT/E342_000000710723.xml
        access: writeOnly
        createDisposition: createTruncate
        v3Flags: 0x1a
        Sent FXP_OPEN
        Received DISCONNECT message
        DisconnectReason: Received data for nonexistent channel 0.
        readChannelData: Socket connection closed.
        Received SSH disconnect.
        disconnectCode: 2
        disconnectReason: Received data for nonexistent channel 0.
        Failed to read expected SFTP packet.
        Failed to receive response to FXP_OPEN
      --sftpOpenFile
      Failed to open file.
    --uploadFileByName
    Failed.
  --UploadFileByName
--ChilkatLog
  (COM successful)

And lastly the rest of the files:

ChilkatLog:
  UploadFileByName:
    DllDate: Mar 21 2016
    ChilkatVersion: 9.5.0.56
    UnlockPrefix: ---------
    Username: ---------
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    SftpVersion: 3
    Must first connect to the SSH server.
  --UploadFileByName
--ChilkatLog
  (COM successful)

Is this problem because of the configuration of Chilkat in my application, or their SFTP server?

Any help is much appreciated.

-B

32 bit or 64 bit dll

$
0
0

My development environment is 32 bit. Application is build under 32 bit. When deploy to 64 bit machine, which version (32 or 64 bit) of activeX & dll should I register?

[AES GCM] Authentication Tag error

$
0
0

Hi,

I am suffering an issue of AES regarding to Authentication Tag.

Here is my purchase receipt

I follow this sample: https://www.example-code.com/java/crypt2_aes_gcm.asp

And modify as bellow:

- After encryption, I create a new instance of CkCrypt2 instead of reusing the existing CkCrypt2 instance (it work well if reusing but I need new an instance of CkCrypt2 to simulate the situation that backend and frontend is exchange plantexts. - Set Key

- Set IV

- Set authentication tag Perform decryption ->>> I always got the error that Authentication tag is wrong, something like:

DllDate: Mar 20 2017
                                                                 ChilkatVersion: 9.5.0.66
                                                                 UnlockPrefix: DRRLWC.CRX0318
                                                                 Architecture: Little Endian; 32-bit
                                                                 Language: Android Java
                                                                 VerboseLogging: 0
                                                                 decryptBytesNew:
                                                                   GCM decrypt authentication tag not equal to the expected value.
                                                                   decryptTag: 1F78 B80F AE3F 6EFF DE70 0C5D 5376 F52F
                                                                   expectedTag: 5BC9 4FBC 3221 A5DB 94FA E95A E712 1A47
                                                                 --decryptBytesNew
                                                                 Failed.
                                                               --DecryptEncoded
                                                             --ChilkatLog

Here is my code:

 public void checkSample() {
    CkCrypt2 crypt = new CkCrypt2();

    boolean success = crypt.UnlockComponent("Anything for 30-day trial");
    if (success != true) {
        System.out.println(crypt.lastErrorText());
        return;
    }

    //  Set the encryption algorithm to "AES"
    crypt.put_CryptAlgorithm("aes");

    //  Indicate that the Galois/Counter Mode (GCM) should be used:
    crypt.put_CipherMode("gcm");

    //  KeyLength may be 128, 192, 256
    crypt.put_KeyLength(128);

    //  This is the 128-bit AES secret key (in hex format)
    String K = "feffe9928665731c6d6a8f9467308308";

    //  This is the 16-byte initialization vector:
    String IV = "cafebabefacedbaddecaf888";

    //  This is the additional data to be used as input to the GCM AEAD algorithm,
    //  but is not included in the output.  It plays a role in the computation of the
    //  resulting authenticated tag.
    String AAD = "feedfacedeadbeeffeedfacedeadbeefabaddad2";

    //  The plain-text bytes (in hex format) to be encrypted.
    String PT = "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39";

    //  The expected cipher text (in hex format)
    String CT = "42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091";

    //  The expected authenticated tag given the above inputs.
    String T = "5bc94fbc3221a5db94fae95ae7121a47";

    //  Note: The above data are the values for test vector #4 from
    //  the PDF document at: http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-spec.pdf

    //  EncodingMode specifies the encoding of the output for
    //  encryption, and the input for decryption.
    //  It may be "hex", "url", "base64", or "quoted-printable".
    crypt.put_EncodingMode("hex");

    //  Set the secret key and IV
    crypt.SetEncodedIV(IV,"hex");
    crypt.SetEncodedKey(K,"hex");

    //  Set the additional authenticated data (AAD)
    success = crypt.SetEncodedAad(AAD,"hex");

    //  For the purpose of duplicating the test vectors, we are using the EncryptEncoded method.
    //  This method decodes the input string according to the encoding specified by the EncodingMode
    //  property, which in this case is "hex".  The decoded bytes are encrypted using the mode specified
    //  by the CipherMode property.  The resulting
    //  encrypted bytes are encoded (again using the encoding mode specified by EncodingMode),
    //  and the result is returned.
    //  <b>Note:</b> The CipherMode property sets the block mode of operation (gcm, cfb, cbc, ofb, ecb, etc.)
    //  for any of the Chilkat encryption/decryption methods (such as EncryptBytes, EncryptString,
    //  CkEncryptFile, etc.)   Just because GCM mode is demonstrated with EncryptEncoded/DecryptEncoded,
    //  does not imply that GCM mode is specific to only these methods.
    String ctResult = crypt.encryptEncoded(PT);
    String checkTag = crypt.getEncodedAuthTag("hex");
    Log.d("DEBUG", "checkTag: " + checkTag);
    if (crypt.get_LastMethodSuccess() != true) {
        System.out.println(crypt.lastErrorText());
        return;
    }

    //  Examine the result.  It should be the same (case insensitive) as our expected result:
    System.out.println("computed result: " + ctResult);
    System.out.println("expected result: " + CT);

    //  Examine the authenticated tag. It should be the same (case insensitive) as our expected authenticated tag:
    String tResult = crypt.getEncodedAuthTag("hex");
    Log.d("DEBUG", "checkTag: " + checkTag);
    Log.d("DEBUG", "computed authTag: " + tResult);
    Log.d("DEBUG", "expected authTag: " + checkTag);
    System.out.println("computed authTag: " + T);

    /**
     * =======================
     * DECRYPT MODIFICATION STARTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
     */
     /**
     * =======================
     * CREATE a NEW INSTANCE of CkCrypt2()
     */
    crypt = new CkCrypt2();

    success = crypt.UnlockComponent("Anything for 30-day trial");
    if (success != true) {
        System.out.println(crypt.lastErrorText());
        return;
    }

    //  Set the encryption algorithm to "AES"
    crypt.put_CryptAlgorithm("aes");

    //  Indicate that the Galois/Counter Mode (GCM) should be used:
    crypt.put_CipherMode("gcm");

    //  KeyLength may be 128, 192, 256
    crypt.put_KeyLength(128);
    /**
     * =======================
     * SetEncodedAuthTag
     */
    success = crypt.SetEncodedAuthTag(T,"hex");
    Log.d("DEBUG", "success>>: " + success);
    crypt.SetEncodedIV(IV,"hex");
    crypt.SetEncodedKey(K,"hex");

    //  -------------------------------------------------------------------------------------
    //  Now let's GCM decrypt...
    //  -------------------------------------------------------------------------------------

    //  Before GCM decrypting, we must set the authenticated tag to the value that is expected.
    //  The decryption will fail if the resulting authenticated tag is not equal (case insensitive) to
    //  the expected result.
    //  Note: The return value of SetEncodedAuthTag indicates whether the string passed was a valid
    //  representation of the encoding specified in the 2nd arg.
    //  All of our properties (IV, secret key, cipher mode, and AAD) are already set from the code above...

    //  So let's decrypt CT to and check to see if we get PT.
    String ptResult = crypt.decryptEncoded(ctResult);
    if (crypt.get_LastMethodSuccess() != true) {
        /**
         * ==================
         ALWAYS GOT THE ERROR:
         DecryptEncoded:
                                                                 DllDate: Mar 20 2017
                                                                 ChilkatVersion: 9.5.0.66
                                                                 UnlockPrefix: DRRLWC.CRX0318
                                                                 Architecture: Little Endian; 32-bit
                                                                 Language: Android Java
                                                                 VerboseLogging: 0
                                                                 decryptBytesNew:
                                                                   GCM decrypt authentication tag not equal to the expected value.
                                                                   decryptTag: 1F78 B80F AE3F 6EFF DE70 0C5D 5376 F52F
                                                                   expectedTag: 5BC9 4FBC 3221 A5DB 94FA E95A E712 1A47
                                                                 --decryptBytesNew
                                                                 Failed.
                                                               --DecryptEncoded
                                                             --ChilkatLog
         */
        //  Failed.  The resultant authenticated tag did not equal the expected authentication tag.
        Log.d("DEBUG", "error>>: " + crypt.lastErrorText());
        System.out.println(crypt.lastErrorText());
        return;
    }

    //  Examine the decrypted result.  It should be the same as our expected plaintext (case insensitive)
    System.out.println("plaintext decrypted: " + ptResult);
    System.out.println("plaintext expected:  " + PT);

    //  Let's intentionally set the expected authenticated tag to an incorrect value.
    //  The decrypt operation should fail:
   /* String tInvalid = "ffaabbbc3221a5db94fae95ae7121a47";

    success = crypt.SetEncodedAuthTag(tInvalid,"hex");

    ptResult = crypt.decryptEncoded(CT);
    if (crypt.get_LastMethodSuccess() != true) {
        Log.d("DEBUG", crypt.lastErrorText());
        //  Failed.  The resultant authenticated tag did not equal the expected authentication tag.
        System.out.println(crypt.lastErrorText());
    }*/
}

Thank you very much,

Viewing all 1061 articles
Browse latest View live