Example #1
0
   def __init__(self, parent, main, wlt, prefill=None, onlyOfflineWallets=False):
      super(TxWizard,self).__init__(parent, main)
      self.setWindowTitle(tr("Offline Transaction Wizard"))
      self.setOption(QWizard.IgnoreSubTitles, on=True)
      self.setOption(QWizard.HaveCustomButton1, on=True)
      self.setOption(QWizard.HaveFinishButtonOnEarlyPages, on=True)
      
      # Page 1: Create Offline TX
      self.createTxPage = CreateTxPage(self, wlt, prefill, onlyOfflineWallets=onlyOfflineWallets)
      self.addPage(self.createTxPage)
      
      # Page 2: Sign Offline TX
      self.reviewOfflineTxPage = ReviewOfflineTxPage(self)
      self.addPage(self.reviewOfflineTxPage)
      
      # Page 3: Broadcast Offline TX
      self.signBroadcastOfflineTxPage = SignBroadcastOfflineTxPage(self)
      self.addPage(self.signBroadcastOfflineTxPage)

      self.setButtonText(QWizard.NextButton, tr('Create Unsigned Transaction'))
      self.setButtonText(QWizard.CustomButton1, tr('Send!'))
      self.connect(self, SIGNAL('customButtonClicked(int)'), self.sendClicked)
      self.setButtonLayout([QWizard.CancelButton,
                            QWizard.BackButton,
                            QWizard.Stretch,
                            QWizard.NextButton,
                            QWizard.CustomButton1])
 def done(self, event):
     if self.newWallet and not self.walletBackupPage.pageFrame.isBackupCreated:
         reply = QMessageBox.question(
             self,
             tr("Wallet Backup Warning"),
             tr(
                 """<qt>
            You have not made a backup for your new wallet.  You only have 
            to make a backup of your wallet <u>one time</u> to protect 
            all the funds held by this wallet <i>any time in the future</i>
            (it is a backup of the signing keys, not the coins themselves).
            <br><br>
            If you do not make a backup, you will <u>permanently</u> lose
            the money in this wallet if you ever forget your password, or 
            suffer from hardware failure.
            <br><br>
            Are you sure that you want to leave this wizard without backing 
            up your wallet?</qt>"""
             ),
             QMessageBox.Yes | QMessageBox.No,
         )
         if reply == QMessageBox.No:
             # Stay in the wizard
             return None
     return super(WalletWizard, self).done(event)
Example #3
0
 def __init__(self, wizard):
    super(WalletCreationPage, self).__init__(wizard,
          NewWalletFrame(wizard, wizard.main, "Primary Wallet"))
    self.setTitle(tr("Step 1: Create Wallet"))
    self.setSubTitle(tr("""
          Create a new wallet for managing your funds.
          The name and description can be changed at any time."""))
   def __init__(self, parent, main):
      super(VerifyOfflinePackageDialog, self).__init__(parent)
      self.main = main

      layout = QVBoxLayout(self)
      
      load = QGroupBox(tr("Load Signed Package"), self)
      layout.addWidget(load)
      
      layoutload = QVBoxLayout()
      load.setLayout(layoutload)
      self.loadFileButton = QPushButton(tr("Select file to verify..."), load);
      layoutload.addWidget(self.loadFileButton)
      self.connect(self.loadFileButton, SIGNAL('clicked()'), self.load)

      self.lblVerified = QRichLabel('', hAlign=Qt.AlignHCenter, doWrap=False)
      layout.addWidget(self.lblVerified)

      
      save = QGroupBox(tr("Save Verified Package"), self)
      layout.addItem(QSpacerItem(10,10))
      layout.addWidget(save)
      layoutsave = QVBoxLayout()
      save.setLayout(layoutsave)
      self.saveFileButton = QPushButton(tr("Select file to save to..."), load);
      self.saveFileButton.setEnabled(False)
      layoutsave.addWidget(self.saveFileButton)
      self.connect(self.saveFileButton, SIGNAL('clicked()'), self.save)
Example #5
0
   def __init__(self, parent, main, wlt, prefill=None, onlyOfflineWallets=False):
      super(TxWizard,self).__init__(parent, main)
      self.setWindowTitle(tr("Offline Transaction Wizard"))
      self.setOption(QWizard.IgnoreSubTitles, on=True)
      self.setOption(QWizard.HaveCustomButton1, on=True)
      self.setOption(QWizard.HaveFinishButtonOnEarlyPages, on=True)
      
      # Page 1: Create Offline TX
      self.createTxPage = CreateTxPage(self, wlt, prefill, onlyOfflineWallets=onlyOfflineWallets)
      self.addPage(self.createTxPage)
      
      # Page 2: Sign Offline TX
      self.reviewOfflineTxPage = ReviewOfflineTxPage(self)
      self.addPage(self.reviewOfflineTxPage)
      
      # Page 3: Broadcast Offline TX
      self.signBroadcastOfflineTxPage = SignBroadcastOfflineTxPage(self)
      self.addPage(self.signBroadcastOfflineTxPage)

      self.setButtonText(QWizard.NextButton, tr('Create Unsigned Transaction'))
      self.setButtonText(QWizard.CustomButton1, tr('Send!'))
      self.connect(self, SIGNAL('customButtonClicked(int)'), self.sendClicked)
      self.setButtonLayout([QWizard.CancelButton,
                            QWizard.BackButton,
                            QWizard.Stretch,
                            QWizard.NextButton,
                            QWizard.CustomButton1])
Example #6
0
    def __init__(self, parent, main):
        super(VerifyOfflinePackageDialog, self).__init__(parent, main)
        self.main = main

        layout = QVBoxLayout(self)

        load = QGroupBox(tr("Load Signed Package"), self)
        layout.addWidget(load)

        layoutload = QVBoxLayout()
        load.setLayout(layoutload)
        self.loadFileButton = QPushButton(tr("Select file to verify..."), load)
        layoutload.addWidget(self.loadFileButton)
        self.connect(self.loadFileButton, SIGNAL('clicked()'), self.load)

        self.lblVerified = QRichLabel('', hAlign=Qt.AlignHCenter, doWrap=False)
        layout.addWidget(self.lblVerified)

        save = QGroupBox(tr("Save Verified Package"), self)
        layout.addItem(QSpacerItem(10, 10))
        layout.addWidget(save)
        layoutsave = QVBoxLayout()
        save.setLayout(layoutsave)
        self.saveFileButton = QPushButton(tr("Select file to save to..."),
                                          load)
        self.saveFileButton.setEnabled(False)
        layoutsave.addWidget(self.saveFileButton)
        self.connect(self.saveFileButton, SIGNAL('clicked()'), self.save)
        self.setWindowTitle('Verify Signed Package')
Example #7
0
 def __init__(self, wizard):
     super(WalletCreationPage, self).__init__(
         wizard, NewWalletFrame(wizard, wizard.main, "Primary Wallet"))
     self.setTitle(tr("Step 1: Create Wallet"))
     self.setSubTitle(
         tr("""
         Create a new wallet for managing your funds.
         The name and description can be changed at any time."""))
Example #8
0
 def __init__(self, wizard):
    super(ManualEntropyPage, self).__init__(wizard,
          CardDeckFrame(wizard, wizard.main, "Shuffle a deck of cards"))
    self.wizard = wizard
    self.setTitle(tr("Step 1: Add Manual Entropy"))
    self.setSubTitle(tr("""
          Use a deck of cards to get a new random number for your wallet.
          """))
Example #9
0
 def __init__(self, wizard):
    super(ManualEntropyPage, self).__init__(wizard,
          CardDeckFrame(wizard, wizard.main, "Shuffle a deck of cards"))
    self.wizard = wizard
    self.setTitle(tr("Step 1: Add Manual Entropy"))
    self.setSubTitle(tr("""
          Use a deck of cards to get a new random number for your wallet.
          """))
Example #10
0
 def __init__(self, wizard):
     super(CreateWatchingOnlyWalletPage, self).__init__(
         wizard,
         WizardCreateWatchingOnlyWalletFrame(wizard, wizard.main,
                                             "Create Watching Only Wallet"))
     self.wizard = wizard
     self.setTitle(tr("Step 5: Create Watching Only Wallet"))
Example #11
0
 def __init__(self, wizard):
     super(WalletBackupPage, self).__init__(
         wizard, WalletBackupFrame(wizard, wizard.main, "Backup Wallet"))
     self.wizard = wizard
     self.myWizard = wizard
     self.setTitle(tr("Step 4: Backup Wallet"))
     self.setFinalPage(True)
Example #12
0
 def __init__(self, wizard):
     super(VerifyPassphrasePage, self).__init__(
         wizard,
         VerifyPassphraseFrame(wizard, wizard.main, "Verify Passphrase"))
     self.wizard = wizard
     self.passphrase = None
     self.setTitle(tr("Step 3: Verify Passphrase"))
Example #13
0
 def __init__(self, wizard):
     super(SetPassphrasePage, self).__init__(
         wizard,
         SetPassphraseFrame(wizard, wizard.main, "Set Passphrase",
                            self.updateNextButton))
     self.setTitle(tr("Step 2: Set Passphrase"))
     self.updateNextButton()
Example #14
0
    def __init__(self, parent, main):
        super(WalletWizard, self).__init__(parent, main)
        self.newWallet = None
        self.isBackupCreated = False
        self.setWindowTitle(tr("Wallet Creation Wizard"))
        self.setOption(QWizard.HaveFinishButtonOnEarlyPages, on=True)
        self.setOption(QWizard.IgnoreSubTitles, on=True)

        # Page 1: Create Wallet
        self.walletCreationPage = WalletCreationPage(self)
        self.addPage(self.walletCreationPage)

        # Page 2: Set Passphrase
        self.setPassphrasePage = SetPassphrasePage(self)
        self.addPage(self.setPassphrasePage)

        # Page 3: Verify Passphrase
        self.verifyPassphrasePage = VerifyPassphrasePage(self)
        self.addPage(self.verifyPassphrasePage)

        # Page 4: Create Paper Backup
        self.walletBackupPage = WalletBackupPage(self)
        self.addPage(self.walletBackupPage)

        # Page 5: Create Watching Only Wallet -- but only if expert, or offline
        self.hasCWOWPage = False
        if self.main.usermode == USERMODE.Expert or not self.main.internetAvail:
            self.hasCWOWPage = True
            self.createWOWPage = CreateWatchingOnlyWalletPage(self)
            self.addPage(self.createWOWPage)

        self.setButtonLayout([
            QWizard.BackButton, QWizard.Stretch, QWizard.NextButton,
            QWizard.FinishButton
        ])
    def __init__(self, parent, main):
        super(WalletWizard, self).__init__(parent, main)
        self.newWallet = None
        self.isBackupCreated = False
        self.setWindowTitle(tr("Wallet Creation Wizard"))
        self.setOption(QWizard.HaveFinishButtonOnEarlyPages, on=True)
        self.setOption(QWizard.IgnoreSubTitles, on=True)

        # Page 1: Create Wallet
        self.walletCreationPage = WalletCreationPage(self)
        self.addPage(self.walletCreationPage)

        # Page 2: Set Passphrase
        self.setPassphrasePage = SetPassphrasePage(self)
        self.addPage(self.setPassphrasePage)

        # Page 3: Verify Passphrase
        self.verifyPassphrasePage = VerifyPassphrasePage(self)
        self.addPage(self.verifyPassphrasePage)

        # Page 4: Create Paper Backup
        self.walletBackupPage = WalletBackupPage(self)
        self.addPage(self.walletBackupPage)

        # Page 5: Create Watching Only Wallet -- but only if expert, or offline
        self.hasCWOWPage = False
        if self.main.usermode == USERMODE.Expert or TheBDM.getState() == BDM_OFFLINE:
            self.hasCWOWPage = True
            self.createWOWPage = CreateWatchingOnlyWalletPage(self)
            self.addPage(self.createWOWPage)

        self.setButtonLayout([QWizard.BackButton, QWizard.Stretch, QWizard.NextButton, QWizard.FinishButton])
Example #16
0
 def __init__(self, wizard):
     super(ReviewOfflineTxPage, self).__init__(
         wizard,
         ReviewOfflineTxFrame(wizard, wizard.main,
                              "Review Offline Transaction"))
     self.setTitle(tr("Step 2: Review Offline Transaction"))
     self.setFinalPage(True)
Example #17
0
 def __init__(self, wizard):
    super(WalletBackupPage, self).__init__(wizard,
                              WalletBackupFrame(wizard, wizard.main, "Backup Wallet"))
    self.wizard = wizard
    self.myWizard = wizard
    self.setTitle(tr("Step 4: Backup Wallet"))
    self.setFinalPage(True)
Example #18
0
 def __init__(self, wizard, wlt, prefill=None, onlyOfflineWallets=False):
    super(CreateTxPage, self).__init__(wizard,
             SendBitcoinsFrame(wizard, wizard.main,
                               "Create Transaction", wlt, prefill,
                               selectWltCallback=self.updateOnSelectWallet,
                               onlyOfflineWallets=onlyOfflineWallets))
    self.setTitle(tr("Step 1: Create Transaction"))
    self.txdp = None
 def initializePage(self, *args, **kwargs):
     if self.currentPage() == self.createTxPage:
         self.createTxPage.pageFrame.fireWalletChange()
     elif self.currentPage() == self.reviewOfflineTxPage:
         self.setButtonText(QWizard.NextButton, tr("Next"))
         self.setButtonLayout([QWizard.BackButton, QWizard.Stretch, QWizard.NextButton, QWizard.FinishButton])
         self.reviewOfflineTxPage.pageFrame.setTxDp(self.createTxPage.txdp)
         self.reviewOfflineTxPage.pageFrame.setWallet(self.createTxPage.pageFrame.wlt)
Example #20
0
 def save(self):
     tofile = QFileDialog.getSaveFileName(self, tr("Save confirmed package"), \
                       QDir.homePath() + "/" + self.fileName)
     if len(tofile) == 0:
         return
     df = open(tofile, "wb")
     df.write(self.fileData)
     df.close()
Example #21
0
 def __init__(self, wizard, wlt, prefill=None, onlyOfflineWallets=False):
    super(CreateTxPage, self).__init__(wizard,
             SendBitcoinsFrame(wizard, wizard.main,
                               "Create Transaction", wlt, prefill,
                               selectWltCallback=self.updateOnSelectWallet,
                               onlyOfflineWallets=onlyOfflineWallets))
    self.setTitle(tr("Step 1: Create Transaction"))
    self.txdp = None
 def save(self):
    tofile = QFileDialog.getSaveFileName(self, tr("Save confirmed package"), \
                      QDir.homePath() + "/" + self.fileName)
    if len(tofile)==0:
       return
    df = open(tofile, "wb")
    df.write(self.fileData)
    df.close()
Example #23
0
 def done(self, event):
     if self.newWallet and not self.walletBackupPage.pageFrame.isBackupCreated:
         reply = QMessageBox.question(self, tr('Wallet Backup Warning'), tr("""
            You have not made a backup for your new wallet.  You only have 
            to make a backup of your wallet <u>one time</u> to protect 
            all the funds held by this wallet <i>any time in the future</i>
            (it is a backup of the signing keys, not the coins themselves).
            <br><br>
            If you do not make a backup, you will <u>permanently</u> lose
            the money in this wallet if you ever forget your password, or 
            suffer from hardware failure.
            <br><br>
            Are you sure that you want to leave this wizard without backing 
            up your wallet?"""), \
               QMessageBox.Yes | QMessageBox.No)
         if reply == QMessageBox.No:
             # Stay in the wizard
             return None
     return super(WalletWizard, self).done(event)
Example #24
0
 def initializePage(self, *args, **kwargs):
     if self.currentPage() == self.createTxPage:
         self.createTxPage.pageFrame.fireWalletChange()
     elif self.currentPage() == self.reviewOfflineTxPage:
         self.setButtonText(QWizard.NextButton, tr('Next'))
         self.setButtonLayout([
             QWizard.BackButton, QWizard.Stretch, QWizard.NextButton,
             QWizard.FinishButton
         ])
         self.reviewOfflineTxPage.pageFrame.setTxDp(self.createTxPage.txdp)
         self.reviewOfflineTxPage.pageFrame.setWallet(
             self.createTxPage.pageFrame.wlt)
Example #25
0
    def __init__(self, parent, main):
        super(WalletWizard, self).__init__(parent, main)
        self.newWallet = None
        self.isBackupCreated = False
        self.setWindowTitle(tr("Wallet Creation Wizard"))
        self.setOption(QWizard.HaveFinishButtonOnEarlyPages, on=True)
        self.setOption(QWizard.IgnoreSubTitles, on=True)

        self.walletCreationId, self.manualEntropyId, self.setPassphraseId, self.verifyPassphraseId, self.walletBackupId, self.WOWId = range(
            6)

        # Page 1: Create Wallet
        self.walletCreationPage = WalletCreationPage(self)
        self.setPage(self.walletCreationId, self.walletCreationPage)

        # Page 1.5: Add manual entropy
        self.manualEntropyPage = ManualEntropyPage(self)
        self.setPage(self.manualEntropyId, self.manualEntropyPage)

        # Page 2: Set Passphrase
        self.setPassphrasePage = SetPassphrasePage(self)
        self.setPage(self.setPassphraseId, self.setPassphrasePage)

        # Page 3: Verify Passphrase
        self.verifyPassphrasePage = VerifyPassphrasePage(self)
        self.setPage(self.verifyPassphraseId, self.verifyPassphrasePage)

        # Page 4: Create Paper Backup
        self.walletBackupPage = WalletBackupPage(self)
        self.setPage(self.walletBackupId, self.walletBackupPage)

        # Page 5: Create Watching Only Wallet -- but only if expert, or offline
        self.hasCWOWPage = False
        if self.main.usermode == USERMODE.Expert or TheBDM.getState(
        ) == BDM_OFFLINE:
            self.hasCWOWPage = True
            self.createWOWPage = CreateWatchingOnlyWalletPage(self)
            self.setPage(self.WOWId, self.createWOWPage)

        self.setButtonLayout([
            QWizard.BackButton, QWizard.Stretch, QWizard.NextButton,
            QWizard.FinishButton
        ])
Example #26
0
def createPrintScene(wallet, amountString, expiresString):
   
   scene = SimplePrintableGraphicsScene(None, None)

   INCH = scene.INCH
   MARGIN = scene.MARGIN_PIXELS 
   scene.resetCursor()
   scene.drawPixmapFile(':/armory_logo_h36.png') 
   scene.newLine()
   scene.drawText('Paper Backup for Armory Wallet', GETFONT('Var', 11))
   scene.newLine()
   scene.drawText('http://www.bitcoinarmory.com')

   scene.newLine(extra_dy=20)
   scene.drawHLine()
   scene.newLine(extra_dy=20)


   ssType = ' (Unencrypted)'
   bType = tr('Single-Sheet ' + ssType)
   colRect, rowHgt = scene.drawColumn(['Wallet Version:', 'Wallet ID:', \
                                                'Wallet Name:', 'Backup Type:'])
   scene.moveCursor(15, 0)
   suf = 'c'
   colRect, rowHgt = scene.drawColumn(['1.35'+suf, wallet.uniqueIDB58, \
                                                wallet.labelName, bType])
   scene.moveCursor(15, colRect.y() + colRect.height(), absolute=True)

   # Display warning about unprotected key data
   wrap = 0.9*scene.pageRect().width()

   container = 'this wallet'
   warnMsg = tr(""" 
         <font color="#aa0000"><b>WARNING:</b></font> Anyone who has access to this 
         page has access to all the bitcoins in %s!  Please keep this 
         page in a safe place.""" % container)

   scene.newLine()
   scene.drawText(warnMsg, GETFONT('Var', 9), wrapWidth=wrap)

   scene.newLine(extra_dy=20)
   scene.drawHLine()
   scene.newLine(extra_dy=20)
   numLine = 'two'

   descrMsg = tr(""" 
      The following %s lines backup all addresses 
      <i>ever generated</i> by this wallet (previous and future).
      This can be used to recover your wallet if you forget your passphrase or 
      suffer hardware failure and lose your wallet files. """ % numLine)
   scene.drawText(descrMsg, GETFONT('var', 8), wrapWidth=wrap)
   scene.newLine(extra_dy=10)
  
   ###########################################################################
   # Finally, draw the backup information.
   bottomOfSceneHeader = scene.cursorPos.y()

   code12 = wallet.addrMap['ROOT'].binPrivKey32_Plain.toBinStr()
   Lines = []
   Prefix = [] 
   Prefix.append('Root Key:')
   Lines.append(makeSixteenBytesEasy(code12[:16]))
   Prefix.append('')
   Lines.append(makeSixteenBytesEasy(code12[16:]))
   # Draw the prefix
   origX,origY = scene.getCursorXY()
   scene.moveCursor(20,0) 
   colRect, rowHgt = scene.drawColumn(['<b>'+l+'</b>' for l in Prefix])
   
   nudgeDown = 2  # because the differing font size makes it look unaligned
   scene.moveCursor(20, nudgeDown)
   scene.drawColumn(Lines, 
                    
                           font=GETFONT('Fixed', 8, bold=True), \
                           rowHeight=rowHgt, 
                           useHtml=False)

   scene.moveCursor(MARGIN, colRect.y()-2, absolute=True)
   width = scene.pageRect().width() - 2*MARGIN
   scene.drawRect( width, colRect.height()+7, edgeColor=QColor(0,0,0), fillColor=None)

   scene.newLine(extra_dy=30)
   scene.drawText( tr("""
      The following QR code is for convenience only.  It contains the 
      exact same data as the %s lines above.  If you copy this backup 
      by hand, you can safely ignore this QR code. """ % numLine), wrapWidth=4*INCH)

   scene.moveCursor(20,0)
   x,y = scene.getCursorXY()
   edgeRgt = scene.pageRect().width() - MARGIN
   edgeBot = scene.pageRect().height() - MARGIN

   qrSize = max(1.5*INCH, min(edgeRgt - x, edgeBot - y, 2.0*INCH))
   scene.drawQR('\n'.join(Lines), qrSize)
   scene.newLine(extra_dy=25)
   scene.drawHLine(7*INCH, 5)
   scene.newLine(extra_dy=25)
   scene.drawText(tr(""" 
         <font color="#aa0000"><b>CONGRATULATIONS:</b></font> Thank you for participating
         in the MIT BitComp. You have received a Bitcoin Armory
         wallet containing %s You may collect this money by installing Bitcoin Armory
         from the website shown above. After you install the software move the funds to a new
         wallet or any address that you own. Do not deposit any bitcoins to this wallet. You
         don't know who else has access to this wallet! You have until %s to claim your bitcoins. After
         this date we will remove all remaining bitcoins from this wallet.""" %
         (amountString, expiresString)), GETFONT('Var', 11), wrapWidth=wrap)
      
   scene.newLine(extra_dy=25)
   return scene
Example #27
0
    def load(self):
        self.fileData = None
        #self.fromfile = QFileDialog.getOpenFileName(self, tr("Load file to verify"), "", tr("Armory Signed Packages (*.signed)"))
        self.fromfile = self.main.getFileLoad(tr('Load file to Verify'),\
                                         ['Armory Signed Packages (*.signed)'])
        if len(self.fromfile) == 0:
            return

        df = open(self.fromfile, "rb")
        allfile = df.read()
        df.close()
        magicstart = "START_OF_SIGNATURE_SECTION"
        magicend = "END_OF_SIGNATURE_SECTION"
        if 0 != allfile.find(magicstart, 0,
                             1024 * 1024 * 4):  # don't search past 4MiB
            QMessageBox.warning(self, tr("Invalid File"),
                                tr("This file is not a signed package"))
            return

        end = allfile.find(magicend, 0,
                           1024 * 1024 * 4)  # don't search past 4MiB
        if -1 == end:  # don't search past 4MiB
            QMessageBox.warning(
                self, tr("Invalid File"),
                tr("The end of the signature in the file could not be found"))

        signatureData = allfile[len(magicstart):end]
        fileData = allfile[end + len(magicend):]

        print "All:", end, end + len(magicend), len(fileData), len(allfile)

        allsigs = downloadLinkParser(filetext=signatureData).downloadMap

        res = binary_to_hex(sha256(fileData))

        good = False
        url = None
        print "Hash of package file: ", res

        # simply check if any of the hashes match
        for pack in allsigs.itervalues():
            for packver in pack.itervalues():
                for packos in packver.itervalues():
                    for packosver in packos.itervalues():
                        for packosarch in packosver.itervalues():
                            okhash = packosarch[1]
                            if okhash == res:
                                url = packosarch[0]
                                good = True

        if good:
            self.saveFileButton.setEnabled(True)
            self.fileData = fileData
            self.fileName = os.path.basename(url)
            self.lblVerified.setText(
                tr("""<font color="%s"><b>Signature is 
            Valid!</b></font>""") % htmlColor('TextGreen'))
            reply = QMessageBox.warning(self, tr("Signature Valid"),  tr("""
            The downloaded file has a <b>valid</b> signature from 
            <font color="%s"><b>Armory Technologies, Inc.</b></font>, and is 
            safe to install.  
            <br><br>
            Would you like to overwrite the original file with the extracted
            installer?  If you would like to save it to a new location, click 
            "No" and then use the "Save Verified Package" button to select
            a new save location.""") % htmlColor('TextGreen'), \
               QMessageBox.Yes | QMessageBox.No)

            if reply == QMessageBox.Yes:
                newFile = self.fromfile
                if newFile.endswith('.signed'):
                    newFile = self.fromfile[:-7]

                LOGINFO('Saving installer to: ' + newFile)

                with open(newFile, 'wb') as df:
                    df.write(self.fileData)

                if os.path.exists(newFile):
                    LOGINFO('Removing original file: ' + self.fromfile)
                    os.remove(self.fromfile)

                QMessageBox.warning(
                    self, tr('Saved!'),
                    tr("""
               The installer was successfully extracted and saved to the
               following location:
               <br><br>
               %s""") % newFile, QMessageBox.Ok)

        else:
            self.saveFileButton.setEnabled(False)
            self.lblVerified.setText(
                tr("""<font color="%s">Invalid signature
            on loaded file!</font>""") % htmlColor('TextRed'))
            QMessageBox.warning(self, tr("Signature failure"),  \
                           tr("This file has an invalid signature"))
Example #28
0
 def __init__(self, wizard):
     super(SignBroadcastOfflineTxPage, self).__init__(
         wizard,
         SignBroadcastOfflineTxFrame(wizard, wizard.main,
                                     "Sign/Broadcast Offline Transaction"))
     self.setTitle(tr("Step 3: Sign/Broadcast Offline Transaction"))
Example #29
0
 def __init__(self, wizard):
    super(SignBroadcastOfflineTxPage, self).__init__(wizard,
                SignBroadcastOfflineTxFrame(wizard, wizard.main, "Sign/Broadcast Offline Transaction"))
    self.setTitle(tr("Step 3: Sign/Broadcast Offline Transaction"))      
Example #30
0
def createPrintScene(wallet, amountString, expiresString):
   
   scene = SimplePrintableGraphicsScene(None, None)

   INCH = scene.INCH
   MARGIN = scene.MARGIN_PIXELS 
   scene.resetCursor()
   scene.drawPixmapFile(':/armory_logo_h36.png') 
   scene.newLine()
   scene.drawText('Paper Backup for Armory Wallet', GETFONT('Var', 11))
   scene.newLine()
   scene.drawText('http://www.bitcoinarmory.com')

   scene.newLine(extra_dy=20)
   scene.drawHLine()
   scene.newLine(extra_dy=20)


   ssType = ' (Unencrypted)'
   bType = tr('Single-Sheet ' + ssType)
   colRect, rowHgt = scene.drawColumn(['Wallet Version:', 'Wallet ID:', \
                                                'Wallet Name:', 'Backup Type:'])
   scene.moveCursor(15, 0)
   suf = 'c'
   colRect, rowHgt = scene.drawColumn(['1.35'+suf, wallet.uniqueIDB58, \
                                                wallet.labelName, bType])
   scene.moveCursor(15, colRect.y() + colRect.height(), absolute=True)

   # Display warning about unprotected key data
   wrap = 0.9*scene.pageRect().width()

   container = 'this wallet'
   warnMsg = tr(""" 
         <font color="#aa0000"><b>WARNING:</b></font> Anyone who has access to this 
         page has access to all the bitcoins in %s!  Please keep this 
         page in a safe place.""" % container)

   scene.newLine()
   scene.drawText(warnMsg, GETFONT('Var', 9), wrapWidth=wrap)

   scene.newLine(extra_dy=20)
   scene.drawHLine()
   scene.newLine(extra_dy=20)
   numLine = 'two'

   descrMsg = tr(""" 
      The following %s lines backup all addresses 
      <i>ever generated</i> by this wallet (previous and future).
      This can be used to recover your wallet if you forget your passphrase or 
      suffer hardware failure and lose your wallet files. """ % numLine)
   scene.drawText(descrMsg, GETFONT('var', 8), wrapWidth=wrap)
   scene.newLine(extra_dy=10)
  
   ###########################################################################
   # Finally, draw the backup information.
   bottomOfSceneHeader = scene.cursorPos.y()

   code12 = wallet.addrMap['ROOT'].binPrivKey32_Plain.toBinStr()
   Lines = []
   Prefix = [] 
   Prefix.append('Root Key:')
   Lines.append(makeSixteenBytesEasy(code12[:16]))
   Prefix.append('')
   Lines.append(makeSixteenBytesEasy(code12[16:]))
   # Draw the prefix
   origX,origY = scene.getCursorXY()
   scene.moveCursor(20,0) 
   colRect, rowHgt = scene.drawColumn(['<b>'+l+'</b>' for l in Prefix])
   
   nudgeDown = 2  # because the differing font size makes it look unaligned
   scene.moveCursor(20, nudgeDown)
   scene.drawColumn(Lines, 
                    
                           font=GETFONT('Fixed', 8, bold=True), \
                           rowHeight=rowHgt, 
                           useHtml=False)

   scene.moveCursor(MARGIN, colRect.y()-2, absolute=True)
   width = scene.pageRect().width() - 2*MARGIN
   scene.drawRect( width, colRect.height()+7, edgeColor=QColor(0,0,0), fillColor=None)

   scene.newLine(extra_dy=30)
   scene.drawText( tr("""
      The following QR code is for convenience only.  It contains the 
      exact same data as the %s lines above.  If you copy this backup 
      by hand, you can safely ignore this QR code. """ % numLine), wrapWidth=4*INCH)

   scene.moveCursor(20,0)
   x,y = scene.getCursorXY()
   edgeRgt = scene.pageRect().width() - MARGIN
   edgeBot = scene.pageRect().height() - MARGIN

   qrSize = max(1.5*INCH, min(edgeRgt - x, edgeBot - y, 2.0*INCH))
   scene.drawQR('\n'.join(Lines), qrSize)
   scene.newLine(extra_dy=25)
   scene.drawHLine(7*INCH, 5)
   scene.newLine(extra_dy=25)
   scene.drawText(tr(""" 
         <font color="#aa0000"><b>CONGRATULATIONS:</b></font> Thank you for participating
         in the MIT BitComp. You have received a Bitcoin Armory
         wallet containing %s You may collect this money by installing Bitcoin Armory
         from the website shown above. After you install the software move the funds to a new
         wallet or any address that you own. Do not deposit any bitcoins to this wallet. You
         don't know who else has access to this wallet! You have until %s to claim your bitcoins. After
         this date we will remove all remaining bitcoins from this wallet.""" %
         (amountString, expiresString)), GETFONT('Var', 11), wrapWidth=wrap)
      
   scene.newLine(extra_dy=25)
   return scene
   def load(self):
      self.fileData = None
      #self.fromfile = QFileDialog.getOpenFileName(self, tr("Load file to verify"), "", tr("Armory Signed Packages (*.signed)"))
      self.fromfile = self.main.getFileLoad(tr('Load file to Verify'),\
                                       ['Armory Signed Packages (*.signed)'])
      if len(self.fromfile)==0:
         return
         
      df = open(self.fromfile, "rb")
      allfile = df.read()
      df.close()
      magicstart="START_OF_SIGNATURE_SECTION"
      magicend="END_OF_SIGNATURE_SECTION"
      if 0 != allfile.find(magicstart, 0, 1024*1024*4): # don't search past 4MiB
         QMessageBox.warning(self, tr("Invalid File"), tr("This file is not a signed package"))
         return
      
      end = allfile.find(magicend, 0, 1024*1024*4) # don't search past 4MiB
      if -1 == end: # don't search past 4MiB
         QMessageBox.warning(self, tr("Invalid File"), tr("The end of the signature in the file could not be found"))
      
      signatureData = allfile[len(magicstart):end]
      fileData = allfile[end+len(magicend):]
      
      print "All:",end, end+len(magicend), len(fileData), len(allfile)
      
      allsigs = downloadLinkParser(filetext=signatureData).downloadMap
      
      res = binary_to_hex(sha256(fileData))
      
      good=False
      url=None
      print "Hash of package file: ", res
      
      # simply check if any of the hashes match
      for pack in allsigs.itervalues():
         for packver in pack.itervalues():
            for packos in packver.itervalues():
               for packosver in packos.itervalues():
                  for packosarch in packosver.itervalues():
                     okhash = packosarch[1]
                     if okhash == res:
                        url = packosarch[0]
                        good=True

      if good:
         self.saveFileButton.setEnabled(True)
         self.fileData = fileData
         self.fileName = os.path.basename(url)
         self.lblVerified.setText(tr("""<font color="%s"><b>Signature is 
            Valid!</b></font>""") % htmlColor('TextGreen'))
         reply = QMessageBox.warning(self, tr("Signature Valid"),  tr("""
            The downloaded file has a <b>valid</b> signature from 
            <font color="%s"><b>Armory Technologies, Inc.</b></font>, and is 
            safe to install.  
            <br><br>
            Would you like to overwrite the original file with the extracted
            installer?  If you would like to save it to a new location, click 
            "No" and then use the "Save Verified Package" button to select
            a new save location.""") % htmlColor('TextGreen'), \
            QMessageBox.Yes | QMessageBox.No)

         if reply==QMessageBox.Yes:
            newFile = self.fromfile
            if newFile.endswith('.signed'):
               newFile = self.fromfile[:-7]

            LOGINFO('Saving installer to: ' + newFile)

            with open(newFile, 'wb') as df:
               df.write(self.fileData)

            if os.path.exists(newFile):
               LOGINFO('Removing original file: ' + self.fromfile)
               os.remove(self.fromfile)

            QMessageBox.warning(self, tr('Saved!'), tr("""
               The installer was successfully extracted and saved to the
               following location:
               <br><br>
               %s""") % newFile, QMessageBox.Ok)
         
            
      else:
         self.saveFileButton.setEnabled(False)
         self.lblVerified.setText(tr("""<font color="%s">Invalid signature
            on loaded file!</font>""") % htmlColor('TextRed'))
         QMessageBox.warning(self, tr("Signature failure"),  \
                        tr("This file has an invalid signature"))
Example #32
0
 def __init__(self, wizard):
    super(ReviewOfflineTxPage, self).__init__(wizard,
                ReviewOfflineTxFrame(wizard, wizard.main, "Review Offline Transaction"))
    self.setTitle(tr("Step 2: Review Offline Transaction"))
    self.setFinalPage(True)
Example #33
0
 def cleanupPage(self, *args, **kwargs):
    if self.currentPage() == self.reviewOfflineTxPage:
       self.updateOnSelectWallet(self.createTxPage.pageFrame.wlt)
       self.setButtonText(QWizard.NextButton, tr('Create Unsigned Transaction'))
Example #34
0
 def __init__(self, wizard):
    super(SetPassphrasePage, self).__init__(wizard, 
             SetPassphraseFrame(wizard, wizard.main, "Set Passphrase", self.updateNextButton))
    self.wizard = wizard
    self.setTitle(tr("Step 2: Set Passphrase"))
    self.updateNextButton()
Example #35
0
 def __init__(self, wizard):
    super(CreateWatchingOnlyWalletPage, self).__init__(wizard,
                WizardCreateWatchingOnlyWalletFrame(wizard, wizard.main, "Create Watching Only Wallet"))
    self.wizard = wizard
    self.setTitle(tr("Step 5: Create Watching Only Wallet"))
Example #36
0
 def cleanupPage(self, *args, **kwargs):
     if self.currentPage() == self.reviewOfflineTxPage:
         self.updateOnSelectWallet(self.createTxPage.pageFrame.wlt)
         self.setButtonText(QWizard.NextButton,
                            tr('Create Unsigned Transaction'))
Example #37
0
 def __init__(self, wizard):
    super(VerifyPassphrasePage, self).__init__(wizard, 
          VerifyPassphraseFrame(wizard, wizard.main, "Verify Passphrase"))
    self.wizard = wizard
    self.passphrase = None
    self.setTitle(tr("Step 3: Verify Passphrase"))