Ejemplo n.º 1
0
        /**
         * Generate a scannable and displayble fingerprint.
         *
         * @param localStableIdentifier The client's "stable" identifier.
         * @param localIdentityKey The client's identity key.
         * @param remoteStableIdentifier The remote party's "stable" identifier.
         * @param remoteIdentityKey The remote party's identity key.
         * @return A unique fingerprint for this conversation.
         */

        public Fingerprint createFor(string localStableIdentifier, IdentityKey localIdentityKey,
                                     string remoteStableIdentifier, IdentityKey remoteIdentityKey)
        {
            DisplayableFingerprint displayableFingerprint = new DisplayableFingerprint(getDisplayStringFor(localStableIdentifier, localIdentityKey),
                                                                                       getDisplayStringFor(remoteStableIdentifier, remoteIdentityKey));

            ScannableFingerprint scannableFingerprint = new ScannableFingerprint(VERSION,
                                                                                 localStableIdentifier, localIdentityKey,
                                                                                 remoteStableIdentifier, remoteIdentityKey);

            return(new Fingerprint(displayableFingerprint, scannableFingerprint));
        }
        /**
         * Generate a scannable and displayble fingerprint for logical identities that have multiple
         * physical keys.
         *
         * Do not trust the output of this unless you've been through the device consistency process
         * for the provided localIdentityKeys.
         *
         * @param localStableIdentifier The client's "stable" identifier.
         * @param localIdentityKeys The client's collection of physical identity keys.
         * @param remoteStableIdentifier The remote party's "stable" identifier.
         * @param remoteIdentityKeys The remote party's collection of physical identity key.
         * @return A unique fingerprint for this conversation.
         */
        public Fingerprint createFor(string localStableIdentifier, List <IdentityKey> localIdentityKeys,
                                     string remoteStableIdentifier, List <IdentityKey> remoteIdentityKeys)
        {
            byte[] localFingerprint  = getFingerprint(iterations, localStableIdentifier, localIdentityKeys);
            byte[] remoteFingerprint = getFingerprint(iterations, remoteStableIdentifier, remoteIdentityKeys);

            DisplayableFingerprint displayableFingerprint = new DisplayableFingerprint(localFingerprint, remoteFingerprint);

            ScannableFingerprint scannableFingerprint = new ScannableFingerprint(localFingerprint, remoteFingerprint);

            return(new Fingerprint(displayableFingerprint, scannableFingerprint));
        }