2 * Copyright (c) 2000-2001 Apple Computer, 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 <CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h>
27 #include <Security/context.h>
28 #include <Security/cssmalloc.h>
34 CSSM_ALGORITHMS digestAlg
) :
37 mDigestAlg(digestAlg
),
39 virtual ~RawSigner() { }
42 * The use of our mDigestAlg variable is pretty crufty. For some algs, it's
43 * known and specified at construction time (e.g., CSSM_ALGID_MD5WithRSA).
44 * For some algs, it's set by CSPFullPluginSession via
45 * CSPContext::setDigestAlgorithm during raw sign/verify.
47 void setDigestAlg(CSSM_ALGORITHMS alg
)
51 * The remaining functions must be implemented by subclass.
55 virtual void signerInit(
56 const Context
&context
,
64 size_t *sigLen
) = 0; /* IN/OUT */
73 /* works for both, but only used for signing */
74 virtual size_t maxSigSize() = 0;
77 bool mInitFlag
; // true after init
78 bool mOpStarted
; // true after update
80 CSSM_ALGORITHMS mDigestAlg
; // for raw sign/verify
81 CssmAllocator
&mAlloc
;
83 bool initFlag() { return mInitFlag
; }
84 void setInitFlag(bool flag
) { mInitFlag
= flag
; }
85 bool opStarted() { return mOpStarted
; }
86 void setOpStarted(bool flag
) { mOpStarted
= flag
; }
87 bool isSigning() { return mIsSigning
; }
88 void setIsSigning(bool signing
)
89 { mIsSigning
= signing
; }
90 CSSM_ALGORITHMS
digestAlg() { return mDigestAlg
; }
91 CssmAllocator
&alloc() { return mAlloc
; }
95 #endif /* _RAW_SIGNER_H_ */