コード例 #1
0
        //Build the OCSP response
        public byte[] BuildOCSPResp(byte[] cert, byte[] ocspResp)
        {
            //Generate the VLR structure
            DataStructs.VLRHeader vlrHeader = Utils.GenerateVLR(DataStructs.VLR_ID_TYPE.OCSP_RESP_VLR_ID, ocspResp.Length);
            byte[] ret = new byte[vlrHeader.VLRLength];

            Utils.StructureToByteArray(vlrHeader).CopyTo(ret, 0);
            ocspResp.CopyTo(ret, DataStructs.VLR_HEADER_LEN);

            return(ret);
        }
コード例 #2
0
        //Check whther BK exists in the signed message, as a p ert of the S3 message validation
        bool DoesBKExist(DataStructs.SIGMA_S3_MESSAGE S3Message, ref byte[] GaGbSig)
        {
            //Process certificate header in order to get cert length
            byte[] header = new byte[DataStructs.VLR_HEADER_LEN];
            Array.Copy(S3Message.data, header, header.Length);
            object certHeader = new DataStructs.VLRHeader();

            Utils.ByteArrayToStructure(header, ref certHeader);
            int certLen = ((DataStructs.VLRHeader)certHeader).VLRLength;

            //Extract GaGb from the signed message data
            Array.Copy(S3Message.data, certLen + DataStructs.VLR_HEADER_LEN, GaGbSig, 0, GaGbSig.Length);
            BK = Utils.GetBKValuesFromSignedMessage(GaGbSig);
            return(BK != null);
        }