public int ReadPublicKey(KeyBlob keyBlob, ulong handle) { int rc = wolfTPM2_ReadPublicKey(device, keyBlob.keyblob, handle); if (rc != (int)Status.TPM_RC_SUCCESS && rc != (int)Status.TPM_RC_HANDLE) { throw new WolfTpm2Exception( "wolfTPM2_ReadPublicKey", rc); } return(rc); }
public int StoreKey(KeyBlob keyBlob, ulong primaryHandle, ulong persistentHandle) { int rc = wolfTPM2_NVStoreKey(device, primaryHandle, keyBlob.keyblob, persistentHandle); if (rc != (int)Status.TPM_RC_SUCCESS && rc != (int)Status.TPM_RC_NV_UNAVAILABLE) { throw new WolfTpm2Exception( "wolfTPM2_NVStoreKey", rc); } return(rc); }
public int LoadKey(KeyBlob keyBlob, Key parent) { int rc = wolfTPM2_LoadKey(device, keyBlob.keyblob, parent.GetHandle()); if (rc != (int)Status.TPM_RC_SUCCESS) { throw new WolfTpm2Exception( "wolfTPM2_LoadKey", rc); } return(rc); }
public int MakeAndSign(Device device, KeyBlob keyBlob, X509_Format outputFormat, byte[] output) { int rc = wolfTPM2_CSR_MakeAndSign(device.Ref, csr, keyBlob.keyblob, (int)outputFormat, output, output.Length); /* positive return code is length of resulting output */ if (rc < 0) { throw new WolfTpm2Exception( "wolfTPM2_CSR_MakeAndSign", rc); } return(rc); }
public int MakeAndSign(Device device, KeyBlob keyBlob, X509_Format outputFormat, byte[] output, int sigType, int selfSign) { int rc = wolfTPM2_CSR_MakeAndSign_ex(device.Ref, csr, keyBlob.keyblob, (int)outputFormat, output, output.Length, sigType, selfSign, Device.INVALID_DEVID); if (rc != (int)Status.TPM_RC_SUCCESS) { throw new WolfTpm2Exception( "wolfTPM2_CSR_MakeAndSign_ex", rc); } return(rc); }
public int CreateKey(KeyBlob keyBlob, Key parent, Template publicTemplate, string auth) { int rc = wolfTPM2_CreateKey(device, keyBlob.keyblob, parent.GetHandle(), publicTemplate.template, auth, auth.Length); if (rc != (int)Status.TPM_RC_SUCCESS) { throw new WolfTpm2Exception( "wolfTPM2_CreateKey", rc); } return(rc); }
public int GenerateCSR( KeyBlob keyBlob, string subject, string keyUsage, X509_Format outputFormat, byte[] output) { int rc = wolfTPM2_CSR_Generate( device, keyBlob.keyblob, subject, keyUsage, (int)outputFormat, output, output.Length); /* positive return code is length of resulting output */ if (rc < 0) { throw new WolfTpm2Exception( "wolfTPM2_CSR_Generate", rc); } return(rc); }
public int UnloadHandle(KeyBlob keyBlob) { return(wolfTPM2_UnloadHandle(device, keyBlob.GetHandle())); }