2 * Copyright (c) 2000-2001,2011,2013-2014 Apple Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
20 * RawSigner.h - low-level virtual sign/verify object (no digest)
23 #ifndef _RAW_SIGNER_H_
24 #define _RAW_SIGNER_H_
26 #include <security_cdsa_utilities/context.h>
27 #include <security_utilities/alloc.h>
33 CSSM_ALGORITHMS digestAlg
) :
36 mDigestAlg(digestAlg
),
38 virtual ~RawSigner() { }
41 * The use of our mDigestAlg variable is pretty crufty. For some algs, it's
42 * known and specified at construction time (e.g., CSSM_ALGID_MD5WithRSA).
43 * For some algs, it's set by CSPFullPluginSession via
44 * CSPContext::setDigestAlgorithm during raw sign/verify.
46 void setDigestAlg(CSSM_ALGORITHMS alg
)
50 * The remaining functions must be implemented by subclass.
54 virtual void signerInit(
55 const Context
&context
,
63 size_t *sigLen
) = 0; /* IN/OUT */
72 /* works for both, but only used for signing */
73 virtual size_t maxSigSize() = 0;
76 bool mInitFlag
; // true after init
77 bool mOpStarted
; // true after update
79 CSSM_ALGORITHMS mDigestAlg
; // for raw sign/verify
82 bool initFlag() { return mInitFlag
; }
83 void setInitFlag(bool flag
) { mInitFlag
= flag
; }
84 bool opStarted() { return mOpStarted
; }
85 void setOpStarted(bool flag
) { mOpStarted
= flag
; }
86 bool isSigning() { return mIsSigning
; }
87 void setIsSigning(bool signing
)
88 { mIsSigning
= signing
; }
89 CSSM_ALGORITHMS
digestAlg() { return mDigestAlg
; }
90 Allocator
&alloc() { return mAlloc
; }
94 #endif /* _RAW_SIGNER_H_ */