// CreateIdentityRequest returns a new CSR to create the identity. If an
// identity was already present it reuses the private key.
CreateIdentityRequest returns a new CSR to create the identity. If an
identity was already present it reuses the private key.
// CreateIdentityRequest returns a new CSR to create the identity . If an // identity was already present it reuses the private key .
func CreateIdentityRequest(commonName string, sans ...string) (*api.CertificateRequest, crypto.PrivateKey, error) {
	var identityKey crypto.PrivateKey
	if i, err := identity.LoadDefaultIdentity(); err == nil && i.Key != "" {
		if k, err := pemutil.Read(i.Key); err == nil {
			identityKey = k
		}
	}
	if identityKey == nil {
		return CreateCertificateRequest(commonName, sans...)
	}
	return createCertificateRequest(commonName, sans, identityKey)
}
func CreateIdentityRequest ( commonName string , sans ... string ) ( * api . CertificateRequest , crypto . PrivateKey , error ) { var identityKey crypto . PrivateKey if i , err := identity . LoadDefaultIdentity ( ) ; err == nil && i . Key != " " { if k , err := pemutil . Read ( i . Key ) ; err == nil { identityKey = k } } if identityKey == nil { return CreateCertificateRequest ( commonName , sans ... ) } return createCertificateRequest ( commonName , sans , identityKey ) }
CreateIdentityRequest returns a new CSR to create the identity.
CreateIdentityRequest returns a new CSR to create the identity .