Ejemplo n.º 1
0
        public static Signature FromBytes(byte[] bytes)
        {
            if (bytes is null)
            {
                throw new ArgumentNullException(nameof(bytes));
            }
            if (bytes.Length == 0)
            {
                throw Errors.ArrayCannotBeEmpty(nameof(bytes));
            }

            if (BytesComparer.IsZero(bytes))
            {
                throw Errors.BytesArrayCannotContainsOnlyZeros(nameof(bytes));
            }

            return(new(bytes));
        }
Ejemplo n.º 2
0
        public DraftMetadata WithAdditionalCertificates(string[] certificates)
        {
            if (certificates is null)
            {
                throw new ArgumentNullException(nameof(certificates));
            }
            if (certificates.Length == 0)
            {
                throw Errors.ArrayCannotBeEmpty(nameof(certificates));
            }
            if (certificates.Any(s => string.IsNullOrWhiteSpace(s)))
            {
                throw Errors.StringsCannotContainNullOrWhitespace(nameof(certificates));
            }

            additionalCertificates = certificates;
            return(this);
        }
        public BusinessRegistrationDraftsBuilderDocumentData(SvdregCode svdregCode, Signer[] signers)
        {
            if (svdregCode.IsEmpty)
            {
                throw Errors.ValueShouldNotBeEmpty(nameof(svdregCode));
            }

            if (signers is null)
            {
                throw new ArgumentNullException(nameof(signers));
            }

            if (signers.Length == 0)
            {
                throw Errors.ArrayCannotBeEmpty(nameof(signers));
            }

            SvdregCode = svdregCode;
            Signers    = signers;
        }
        public CertificateTokenRequest([NotNull] byte[] decryptedKey, string thumbprint, string scope, string clientId, string clientSecret)
            : base(scope, clientId, clientSecret)
        {
            if (decryptedKey == null)
            {
                throw new ArgumentNullException(nameof(decryptedKey));
            }

            if (decryptedKey.Length == 0)
            {
                throw Errors.ArrayCannotBeEmpty(nameof(decryptedKey));
            }

            if (string.IsNullOrWhiteSpace(thumbprint))
            {
                throw Errors.StringShouldNotBeNullOrWhiteSpace(nameof(thumbprint));
            }

            DecryptedKey = decryptedKey;
            Thumbprint   = thumbprint;
        }