src/TAO/Ledger/tritium_minter.cpp
bool TritiumMinter::SignBlock(const memory::encrypted_ptr<TAO::Ledger::SignatureChain>& user, const SecureString& strPIN)
        {
            /* Get the sigchain and the PIN. */
            /* Sign the submitted block */
            std::vector<uint8_t> vBytes = user->Generate(block.producer.nSequence, strPIN).GetBytes();
            LLC::CSecret vchSecret(vBytes.begin(), vBytes.end());

            /* Switch based on signature type. */
            switch(block.producer.nKeyType)
            {
                /* Support for the FALCON signature scheeme. */
                case TAO::Ledger::SIGNATURE::FALCON:
                {
                    /* Create the FL Key object. */
                    LLC::FLKey key;

                    /* Set the secret parameter. */
                    if(!key.SetSecret(vchSecret))
                        return debug::error(FUNCTION, "TritiumMinter: Unable to set key for signing Tritium Block ",
                                            block.GetHash().SubString());

                    /* Generate the signature. */
                    if(!block.GenerateSignature(key))
                        return debug::error(FUNCTION, "TritiumMinter: Unable to sign Tritium Block ",
                                            block.GetHash().SubString());

                    break;
                }

                /* Support for the BRAINPOOL signature scheme. */
                case TAO::Ledger::SIGNATURE::BRAINPOOL:
                {
                    /* Create EC Key object. */
                    LLC::ECKey key = LLC::ECKey(LLC::BRAINPOOL_P512_T1, 64);

                    /* Set the secret parameter. */
                    if(!key.SetSecret(vchSecret, true))
                        return debug::error(FUNCTION, "TritiumMinter: Unable to set key for signing Tritium Block ",
                                            block.GetHash().SubString());

                    /* Generate the signature. */
                    if(!block.GenerateSignature(key))
                        return debug::error(FUNCTION, "TritiumMinter: Unable to sign Tritium Block ",
                                            block.GetHash().SubString());

                    break;
                }

                default:
                    return debug::error(FUNCTION, "TritiumMinter: Unknown signature type");
            }

            return true;
         }
/* Sign a candidate block after it is successfully mined. */
Sign a candidate block after it is successfully mined.
Sign a candidate block after it is successfully mined .
bool TritiumMinter::SignBlock(const memory::encrypted_ptr<TAO::Ledger::SignatureChain>& user, const SecureString& strPIN)
        {
            std::vector<uint8_t> vBytes = user->Generate(block.producer.nSequence, strPIN).GetBytes();
            LLC::CSecret vchSecret(vBytes.begin(), vBytes.end());
            switch(block.producer.nKeyType)
            {
                case TAO::Ledger::SIGNATURE::FALCON:
                {
                    LLC::FLKey key;
                    if(!key.SetSecret(vchSecret))
                        return debug::error(FUNCTION, "TritiumMinter: Unable to set key for signing Tritium Block ",
                                            block.GetHash().SubString());
                    if(!block.GenerateSignature(key))
                        return debug::error(FUNCTION, "TritiumMinter: Unable to sign Tritium Block ",
                                            block.GetHash().SubString());
                    break;
                }
                case TAO::Ledger::SIGNATURE::BRAINPOOL:
                {
                    LLC::ECKey key = LLC::ECKey(LLC::BRAINPOOL_P512_T1, 64);
                    if(!key.SetSecret(vchSecret, true))
                        return debug::error(FUNCTION, "TritiumMinter: Unable to set key for signing Tritium Block ",
                                            block.GetHash().SubString());
                    if(!block.GenerateSignature(key))
                        return debug::error(FUNCTION, "TritiumMinter: Unable to sign Tritium Block ",
                                            block.GetHash().SubString());
                    break;
                }
                default:
                    return debug::error(FUNCTION, "TritiumMinter: Unknown signature type");
            }
            return true;
         }
bool TritiumMinter :: SignBlock ( const memory :: encrypted_ptr < TAO :: Ledger :: SignatureChain > & user , const SecureString & strPIN ) { std :: vector < uint8_t > vBytes = user -> Generate ( block . producer . nSequence , strPIN ) . GetBytes ( ) ; LLC :: CSecret vchSecret ( vBytes . begin ( ) , vBytes . end ( ) ) ; switch ( block . producer . nKeyType ) { case TAO :: Ledger :: SIGNATURE :: FALCON : { LLC :: FLKey key ; if ( ! key . SetSecret ( vchSecret ) ) return debug :: error ( FUNCTION , " " , block . GetHash ( ) . SubString ( ) ) ; if ( ! block . GenerateSignature ( key ) ) return debug :: error ( FUNCTION , " " , block . GetHash ( ) . SubString ( ) ) ; break ; } case TAO :: Ledger :: SIGNATURE :: BRAINPOOL : { LLC :: ECKey key = LLC :: ECKey ( LLC :: BRAINPOOL_P512_T1 , 64 ) ; if ( ! key . SetSecret ( vchSecret , true ) ) return debug :: error ( FUNCTION , " " , block . GetHash ( ) . SubString ( ) ) ; if ( ! block . GenerateSignature ( key ) ) return debug :: error ( FUNCTION , " " , block . GetHash ( ) . SubString ( ) ) ; break ; } default : return debug :: error ( FUNCTION , " " ) ; } return true ; }
Sign a candidate block after it is successfully mined.
Sign a candidate block after it is successfully mined .
/* Get the sigchain and the PIN. */ /* Sign the submitted block */ /* Switch based on signature type. */ /* Support for the FALCON signature scheeme. */ /* Create the FL Key object. */ /* Set the secret parameter. */ /* Generate the signature. */ /* Support for the BRAINPOOL signature scheme. */ /* Create EC Key object. */ /* Set the secret parameter. */ /* Generate the signature. */