// NewKeyring returns a new v2 Keyring, with the created time set to now
777310
func NewKeyring(orgID, projectID *identity.ID, pathExp *pathexp.PathExp) *Keyring {
	return &Keyring{
		BaseKeyring: BaseKeyring{
			Created:   time.Now().UTC(),
			OrgID:     orgID,
			PathExp:   pathExp,
			ProjectID: projectID,

			// This is the first instance of the keyring, so version is 1,
			// and there is no previous instance.
			Previous:       nil,
			KeyringVersion: 1,
		},
	}
}
1119706
func NewKeyObject(key interface{}, expiryTime int64) KeyObject {
	k := KeyObject{
		Key: key,
	}
	if expiryTime >= 0 {
		k.ExpiryTime = time.Unix(expiryTime/1000, 0).UTC()
	}

	return k
}
174276
func WithNoNewKeyring(ctx context.Context, c *Client, ti *TaskInfo) error {
	if CheckRuntime(ti.Runtime(), "io.containerd.runc") {
		if ti.Options == nil {
			ti.Options = &options.Options{}
		}
		opts, ok := ti.Options.(*options.Options)
		if !ok {
			return errors.New("invalid v2 shim create options format")
		}
		opts.NoNewKeyring = true
	} else {
		if ti.Options == nil {
			ti.Options = &runctypes.CreateOptions{}
		}
		opts, ok := ti.Options.(*runctypes.CreateOptions)
		if !ok {
			return errors.New("could not cast TaskInfo Options to CreateOptions")
		}
		opts.NoNewKeyring = true
	}
	return nil
}
1040893
func NewPGPKeyGen(g *libkb.GlobalContext, arg keybase1.PGPKeyGenDefaultArg) *PGPKeyGen {
	return &PGPKeyGen{
		Contextified: libkb.NewContextified(g),
		arg:          arg,
	}
}
269683
func NewPbkdf2Key(password []byte, size int) Key {
	return pbkdf2Key{password: password, size: size}
}
31991
func New(params *stripe.EphemeralKeyParams) (*stripe.EphemeralKey, error) {
	return getC().New(params)
}
955215
func newV2Key(oldKey, mm, field []byte) []byte {
	newKey := make([]byte, len(mm)+1+len(MeasurementTagKey)+1+len(oldKey)+1+len(FieldKeyTagKey)+1+len(field))
	buf := newKey

	copy(buf, mm)
	buf = buf[len(mm):]

	buf[0], buf[1], buf[2], buf = ',', MeasurementTagKeyBytes[0], '=', buf[3:]
	copy(buf, oldKey)
	buf = buf[len(oldKey):]

	buf[0], buf[1], buf[2], buf = ',', FieldKeyTagKeyBytes[0], '=', buf[3:]
	copy(buf, field)

	return newKey
}
436481
func (cipher CipherFunction) new(key []byte) (block cipher.Block) {
	switch cipher {
	case Cipher3DES:
		block, _ = des.NewTripleDESCipher(key)
	case CipherCAST5:
		block, _ = cast5.NewCipher(key)
	case CipherAES128, CipherAES192, CipherAES256:
		block, _ = aes.NewCipher(key)
	}
	return
}
1204458
func New(accessKey string, secretKey string) *Ivona {
	return &Ivona{AccessKey: accessKey, SecretKey: secretKey}
}
186172
func NewKey(path, name string) (*Key, error) {
	k := &Key{
		P: path,
		N: name,
	}

	if !k.Exists() {
		return nil, fmt.Errorf("Key file with path `%s` does not exist", k.Path())
	}

	return k, nil
}
587093
func NewPaperKeyGen(g *libkb.GlobalContext, arg *PaperKeyGenArg) *PaperKeyGen {
	return &PaperKeyGen{
		arg:          arg,
		Contextified: libkb.NewContextified(g),
	}
}
1120125
func New(t time.Time) Time {
	return Time(time.Date(
		t.Year(),
		t.Month(),
		t.Day(),
		t.Hour(),
		t.Minute(),
		t.Second(),
		0,
		fixedZone,
	))
}
741456
func NewKeySet(keys ...Key) KeySet {
	set := make(KeySet)
	for _, key := range keys {
		set.Add(key)
	}

	return set
}
812270
func NewDockerKeyring() DockerKeyring {
	keyring := &lazyDockerKeyring{
		Providers: make([]DockerConfigProvider, 0),
	}

	keys := reflect.ValueOf(providers).MapKeys()
	stringKeys := make([]string, len(keys))
	for ix := range keys {
		stringKeys[ix] = keys[ix].String()
	}
	sort.Strings(stringKeys)

	for _, key := range stringKeys {
		provider := providers[key]
		if provider.Enabled() {
			klog.V(4).Infof("Registering credential provider: %v", key)
			keyring.Providers = append(keyring.Providers, provider)
		}
	}

	return keyring
}
136891
func NewKeychain(path string, password string) (Keychain, error) {
	return newKeychain(path, password, false)
}
749336
func New(key []byte) *Params {
	k := make([]byte, len(key))
	copy(k, key)
	return &Params{
		key:    k,
		timer:  time.Now,
		MaxAge: 10 * time.Minute,
	}
}
188399
func NewKeyStringValueTree(k, v string, duplicates bool) KeyStringValueTree {
	return &keyStringValueTree{
		container: newNodeContainer(keyValue{k, v}, duplicates),
	}
}