Beispiel #1
0
        public int GenerateCSR(
            KeyBlob keyBlob,
            string subject,
            string keyUsage,
            X509_Format outputFormat,
            byte[] output,
            int sigType,
            int selfSignCert)
        {
            int rc = wolfTPM2_CSR_Generate_ex(
                device,
                keyBlob.keyblob,
                subject,
                keyUsage,
                (int)outputFormat,
                output, output.Length,
                sigType,
                selfSignCert,
                Device.INVALID_DEVID);

            /* positive return code is length of resulting output */
            if (rc < 0)
            {
                throw new WolfTpm2Exception(
                          "wolfTPM2_CSR_Generate_ex", rc);
            }
            return(rc);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }