summaryrefslogtreecommitdiffstats
blob: 03aadf05c08d163949f13d8a869d181e501cd88f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * Copyright (c) 2010 Remko Tronçon
 * Licensed under the GNU General Public License v3.
 * See Documentation/Licenses/GPLv3.txt for more information.
 */

#include "Swiften/TLS/SecurityError.h"
#include "Swiften/TLS/CertificateVerificationError.h"

namespace Swift {

SecurityError::SecurityError(Type type) : type(type) {
}

SecurityError::SecurityError(const CertificateVerificationError& verificationError) {
	type = UnknownError;
	switch(verificationError.getType()) {
		case CertificateVerificationError::UnknownError: type = UnknownError;
		case CertificateVerificationError::Expired: type = Expired;
		case CertificateVerificationError::NotYetValid: type = NotYetValid;
		case CertificateVerificationError::SelfSigned: type = SelfSigned;
		case CertificateVerificationError::Rejected: type = Rejected;
		case CertificateVerificationError::Untrusted: type = Untrusted;
		case CertificateVerificationError::InvalidPurpose: type = InvalidPurpose;
		case CertificateVerificationError::PathLengthExceeded: type = PathLengthExceeded;
		case CertificateVerificationError::InvalidSignature: type = InvalidSignature;
		case CertificateVerificationError::InvalidCA: type = InvalidCA;
	}
}

}