Skip to content

Commit d01abef

Browse files
Merge pull request #37 from LucassCPS/master
Add new PKCS12 error code handling
2 parents 47178a7 + 36a3261 commit d01abef

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

include/libcryptosec/exception/Pkcs12Exception.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Pkcs12Exception : public LibCryptoSecException
1515
KEY_AND_CERT_DO_NOT_MATCH,
1616
PARSE_ERROR,
1717
MAC_VERIFY_FAILURE,
18+
ASN1_INVALID_OBJECT_ENCODING,
1819
};
1920

2021
Pkcs12Exception(std::string where)
@@ -73,12 +74,9 @@ class Pkcs12Exception : public LibCryptoSecException
7374
case Pkcs12Exception::PARSE_ERROR :
7475
ret = "Parse error";
7576
break;
76-
// case Pkcs12Exception:::
77-
// ret = "";
78-
// break;
79-
// case Pkcs12Exception:::
80-
// ret = "";
81-
// break;
77+
case Pkcs12Exception::ASN1_INVALID_OBJECT_ENCODING :
78+
ret = "ASN1 invalid enconding";
79+
break;
8280
}
8381
return ret;
8482
}

src/Pkcs12.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,12 @@ void Pkcs12::parse(string password) throw(Pkcs12Exception)
144144
case PKCS12_R_MAC_VERIFY_FAILURE :
145145
throw Pkcs12Exception(Pkcs12Exception::PARSE_ERROR, "Pkcs12::parse");
146146
break;
147-
148147
case PKCS12_R_PARSE_ERROR :
149148
throw Pkcs12Exception(Pkcs12Exception::MAC_VERIFY_FAILURE, "Pkcs12::parse");
150149
break;
150+
case ASN1_R_INVALID_OBJECT_ENCODING :
151+
throw Pkcs12Exception(Pkcs12Exception::ASN1_INVALID_OBJECT_ENCODING, "Pkcs12::parse");
152+
break;
151153
}
152154
}
153155

0 commit comments

Comments
 (0)