Pkcs08PrivateKeyInfo::Pkcs08PrivateKeyInfo(void)
: __pPkcs08PrivateKeyInfoImpl(null)
{
- __pPkcs08PrivateKeyInfoImpl = new (std::nothrow) _Pkcs08PrivateKeyInfoImpl();
- SysTryReturnVoidResult(NID_SEC_CRYPTO, __pPkcs08PrivateKeyInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory in insufficient.");
+
}
//Default Destructor
{
result r = E_SUCCESS;
- SysAssertf(__pPkcs08PrivateKeyInfoImpl != null, "Not yet constructed. Reconstructor the object.");
+ SysAssertf(__pPkcs08PrivateKeyInfoImpl == null,
+ "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class");
+
+ __pPkcs08PrivateKeyInfoImpl = new (std::nothrow) _Pkcs08PrivateKeyInfoImpl();
+ SysTryReturnResult(NID_SEC_CRYPTO, __pPkcs08PrivateKeyInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory in insufficient.");
+
r = __pPkcs08PrivateKeyInfoImpl->Construct(encodedData);
- SysTryReturn(NID_SEC_CRYPTO, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
+ SysTryCatch(NID_SEC_CRYPTO, !IsFailed(r), , r, "[%s] Propagated.", GetErrorMessage(r));
+
+ return r;
+
+CATCH:
+
+ delete __pPkcs08PrivateKeyInfoImpl;
+ __pPkcs08PrivateKeyInfoImpl = null;
return r;
}
{
result r = E_SUCCESS;
- SysAssertf(__pPkcs08PrivateKeyInfoImpl != null, "Not yet constructed. Reconstructor the object.");
+ SysAssertf(__pPkcs08PrivateKeyInfoImpl == null,
+ "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class");
+
+ __pPkcs08PrivateKeyInfoImpl = new (std::nothrow) _Pkcs08PrivateKeyInfoImpl();
+ SysTryReturnResult(NID_SEC_CRYPTO, __pPkcs08PrivateKeyInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory in insufficient.");
+
+
r = __pPkcs08PrivateKeyInfoImpl->Construct(privAlgoId, privKey);
- SysTryReturn(NID_SEC_CRYPTO, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
+ SysTryCatch(NID_SEC_CRYPTO, !IsFailed(r), , r, "[%s] Propagated.", GetErrorMessage(r));
+
+ return r;
+
+CATCH:
+
+ delete __pPkcs08PrivateKeyInfoImpl;
+ __pPkcs08PrivateKeyInfoImpl = null;
return r;
}