🔒 Keys Backup Protocol

At Perpetual3, we value your security and privacy. That's why we've designed a robust Keys Backup Protocol that secures your encrypts your data right on your device.

Creating a Secure Encryption Key 🔑

A vital part of Perpetual3's keys backup protocol involves creating a secure encryption key for user data.

This key is used to encrypt private keys of previously generated key pairs and sensitive data.

Here's how it works:

  1. Pin Generation: The Perpetual3 app asks the user to generate a secure 6-digit pin.

  2. Key Derivation Function (KDF): This user-generated pin is sent through a Password-Based Key Derivation Function 2 (PBKDF2) with the following parameters:

final pbkdf2 = Pbkdf2(
    macAlgorithm: Hmac.sha512(),
    iterations: 10000,
    bits: 256,
);
  1. Transaction Creation: The result of the KDF is added to a special transaction object, where the user's wallet is both the sender and receiver. We generate fixed transaction parameters for this process:

var authParams = {
    "genesis-id": "testnet-v1.0",
    "genesis-hash": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",
    "last-round": 1000,
    "min-fee": 1000,
    "fee": 1000,
    "consensus-version": ""
};

The final transaction object looks like this:

final secretKeyTxn = await (algo.PaymentTransactionBuilder()
    ..sender = ownerWalletaddr
    ..receiver = ownerWalletaddr
    ..note = Uint8List.fromList(pinKDFBytes)
    ..suggestedParams = algo.TransactionParams.fromJson(authParams))
  .build();
  1. Transaction Signing: The app then asks the user to sign this transaction object.

  2. Further Key Derivation: The signature is passed through another round of KDF with the following function:

final secretSignatureKDF = await pbkdf2.deriveKey(
    secretKey: SecretKey(secretKeyObject.signature!.toList()),
    nonce: signNonce,
);
  1. Secure Key Creation: The result of this last KDF round is used as the secure encryption key. This key provides a robust layer of security, safeguarding your sensitive data throughout the backup process.

Security considerations

The use of a transaction signature as a basis for generating an encryption key isn't a common practice in the realm of cryptography, and is currently under active evaluation.

Currently this method is supported only with Algorand transactions

Transaction parameters used to craft the transaction object are designed in such a way to ensure that the transaction will never be accepted on-chain because the last valid round has already passed. This helps prevent potential leak of the signature on chain.

Transaction sign request is done using only using WalletConnect protocol that ensures a secure P2P encrypted channel so the transaction cannot be intercepted by a third party

Replay Attacks: As this approach uses a transaction signature, it's important to prevent replay attacks where an old signature might be reused to generate the encryption key. To mitigate this risk the user the provided PIN is processed through a Key Derivation Function (KDF), and the resultant output is utilized as note parameter of the transaction.

Wallet Security: The security of this approach relies heavily on the security of the user's wallet. Users should be advised to maintain good security hygiene for their wallets, such as using hardware wallets and keeping private keys offline.

Mitigation of Signature Theft through User-Generated PIN: While an attacker could potentially trick the user into signing a transaction with identical parameters, our protocol includes an additional safeguard. The transaction object must also encapsulate a user-generated PIN. Thus, in order for an attacker to illicitly acquire the signature, they would need knowledge of the specific PIN. This significantly reduces the likelihood of a successful attack.

Brute Force Attack Infeasibility: A theoretically possible but highly improbable attack vector could be an attacker attempting to brute force the PIN by persuading another user to sign multiple transactions with varying PINs. However, this is practically unfeasible due to the immense number of possibilities for a 6-digit PIN that would require 1,000,000 possible transaction sign request.

In case this secure encryption key generation is considered insecure we will enable a similar protocol based on Algorand ARC-35.

After the secure encryption key has been generated, the user's data is encrypted on their device. Once encrypted, this data can then be stored on any data storage service of the user's choice, ensuring that their information is safe and secure no matter where it resides.

Perpetual3 offers its own specialized data storage service. Built with privacy and security at the core, this service ensures that encrypted data is properly stored and can be easily retrieved when required. The codebase for our data storage service is set to be open-sourced in the near future, further testament to our commitment to transparency and community collaboration.

Our data storage service has been built to be compatible with Perpetual3's unique encryption and key management protocols. This ensures that users can easily back up and restore their encrypted data without having to worry about compatibility issues.

While we recommend our own data storage service for the best user experience, we have designed our encryption protocols to be storage system agnostic. This means that users are free to choose whichever data storage service they prefer or trust the most.

🔒 💽 🌐

Please remember: Your data belongs to you and can be decrypted only by you. We make sure it stays that way.

Last updated