Example #1
0
 public static MultiValuedProperty <byte[]> CertificateFromRawBytes(MultiValuedProperty <byte[]> rawBytes, Task.TaskErrorLoggingDelegate writeError)
 {
     if (writeError == null)
     {
         throw new ArgumentNullException("writeError");
     }
     if (rawBytes == null)
     {
         return(null);
     }
     byte[][] rawBytesArray = null;
     try
     {
         rawBytesArray = rawBytes.ToArray();
     }
     catch (InvalidOperationException innerException)
     {
         writeError(new TaskException(Strings.ErrorNotSupportedModifyMultivaluedProperties, innerException), ErrorCategory.InvalidArgument, null);
     }
     return(OAuthTaskHelper.InternalCertificateFromRawBytes(rawBytesArray, writeError));
 }
Example #2
0
        private static MultiValuedProperty <byte[]> InternalCertificateFromBase64String(string[] rawStringArray, Task.TaskErrorLoggingDelegate writeError)
        {
            MultiValuedProperty <byte[]> result;

            try
            {
                result = OAuthTaskHelper.InternalCertificateFromRawBytes((from s in rawStringArray
                                                                          select Convert.FromBase64String(s)).ToArray <byte[]>(), writeError);
            }
            catch (ArgumentNullException innerException)
            {
                writeError(new TaskException(Strings.ErrorInvalidBase64String, innerException), ErrorCategory.InvalidArgument, null);
                throw;
            }
            catch (FormatException innerException2)
            {
                writeError(new TaskException(Strings.ErrorInvalidBase64String, innerException2), ErrorCategory.InvalidArgument, null);
                throw;
            }
            return(result);
        }