예제 #1
0
        public void SetBarrierConfig(SealConfig config)
        {
            CheckCore();

            // Provide a way to wipe out the cached value (also prevents actually
            // saving a nil config)
            if (config == null)
            {
                Config = null;
                return;
            }

            config.Type = BarrierType;

            // Encode the seal configuration
            var buf = JsonConvert.SerializeObject(config); //json.Marshal(config);

            // if err != nil {
            //  return fmt.Errorf("failed to encode seal configuration: %v", err)
            // }

            // // Store the seal configuration
            // pe := &physical.Entry{
            //  Key:   barrierSealConfigPath,
            //  Value: buf,
            // }

            // if err := d.core.physical.Put(pe); err != nil {
            //  d.core.logger.Error("core: failed to write seal configuration", "error", err)
            //  return fmt.Errorf("failed to write seal configuration: %v", err)
            // }

            Config = config.Clone();
        }
예제 #2
0
        public SealConfig Clone()
        {
            var ret = new SealConfig
            {
                Type            = Type,
                SecretShares    = SecretShares,
                SecretThreshold = SecretThreshold,
                Nonce           = Nonce,
                Backup          = Backup,
                StoredShares    = StoredShares,
            };

            if (PGPKeys.Length > 0)
            {
                ret.PGPKeys = new string[PGPKeys.Length];
                Array.Copy(PGPKeys, ret.PGPKeys, PGPKeys.Length);
            }
            // if len(s.PGPKeys) > 0 {
            //     ret.PGPKeys = make([]string, len(s.PGPKeys))
            //     copy(ret.PGPKeys, s.PGPKeys)
            // }

            return(ret);
        }
예제 #3
0
 public void SetRecoveryConfig(SealConfig config)
 {
     throw new NotSupportedException("recovery not supported");
 }